-
Notifications
You must be signed in to change notification settings - Fork 8
CAN bus
Marija Golubović edited this page Feb 15, 2023
·
6 revisions
- Append the following configuration at the end of the
/boot/firmware/config.txt
file:# CAN bus dtparam=spi=on dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
- and restart the Raspberry Pi to apply the configuration.
At the boot, the CAN bus interface is not active.
The hardware_launch.py
will make sure the CAN interface is up (see here).
To get the interface manually you can run:
sudo ip link set can0 up type can bitrate 500000 restart-ms 100 sjw 3
sudo ip link set can0 txqueuelen 100
There is a very useful tool can-utils
for debugging a CAN communication:
sudo apt install can-utils
Use candump can0
to receive CAN messages and for example cansend can0 00006C00#01
to send a CAN message.