Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script to start can bus interface on a Beagle Bone Black
#!/bin/bash
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
echo -e "ERROR: Can bus bitrate not a number or a value wasn't entered.\n\nPlease enter a speed in Kbit/s\n\n Example: canbus_start.sh 100\n Speeds: 100,125,250,500\n" >&2; exit 1
fi
echo Bitrate: ${1}Kbit/s
sudo modprobe can
sudo modprobe can-dev
sudo modprobe can-raw
sudo ip link set can0 up type can bitrate ${1}000
sudo ifconfig can0 up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.