As shown in the figure below, when used with raspberry pi or CM4, we need to push the switch to the top, and when used with CB1, we need to pull the switch to the bottom.
/boot/config.txt
file
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=24,spimaxfrequency=10000000
and restart raspberry pi
/boot/dtb/allwinner/sun50i-h616-biqu.dtb
in the OS with the downloaded sun50i-h616-biqu.dtb. overlays=mcp2515
in /boot/BoardEnv.txt
. Input the dmesg | grep -i '\(can\|spi\)'
command to test whether MCP2515 has been connected normally after the restart is completed.
The normal response should be as follows
[ 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
Input sudo nano /etc/network/interfaces.d/can0
command to create a new file named can0
, and write the following content
auto can0
iface can0 can static
bitrate 500000
up ifconfig $IFACE txqueuelen 1024
Set the Canbus speed to 500K (consistent with the speed set in klipper), and set the txqueuelen
to 1024 bytes. Save(Ctrl + S
) and Exit(Ctrl + X
) after modification, input sudo reboot
to restart host
Each micro-controller on the CAN bus is assigned a unique id based on the factory chip identifier encoded into each micro-controller. To find each micro-controller device id, make sure the hardware is powered and wired correctly, and then run:
~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
If uninitialized CAN devices are detected the above command will report lines like the following:
Found canbus_uuid=0e0d81e4210c
set the correct ID number in printer.cfg
[mcu EBB]
canbus_uuid: 0e0d81e4210c