BIGTREETECH
19 / 22
4.3.2 Work with BIGTREETECH RPI-CAN HAT
1. Type and run the following command sudo nano /boot/config.txt, and added
below contents on file config.txt.
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25,spimaxfrequency=1000000
After modification, save(Ctrl + S)and exist(Ctrl + X), type sudo reboot to
reboot Raspberry Pi.
2. Type and run commands dmesg | grep -i '\(can\|spi\)' to test if RPI-CAN HAT
module is normally connected. The normal response should be as below:
[ 8.680446] CAN device driver interface
[ 8.697558] mcp251x spi0.0 can0: MCP2515 successfully initialized.
[ 9.482332] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
3. Type sudo nano /etc/network/interfaces.d/can0 on the SSH terminal and run
the command.
auto can0
iface can0 can static
bitrate 250000
up ifconfig $IFACE txqueuelen 1024
Set the speed for CANBus at 250K(must be the same as the speed set in the
firmware (250000) CAN bus speed). Save (Ctrl + S) after modification and
exit (Ctrl + X). Type command sudo reboot to reboot Raspberry Pi.
4. Every device on CANBus will generate a canbus_uuid base on MCU's UID. If
users want to find the ID for every microcontroller, please make sure the