MCU / Printerboard: CAN enabled stm32, same5x, and rp2040 chips
Over on the BTT Manta-M8P repo, people have been having a lot of issues getting the MCU into CANBUS bridge mode, so I wrote up the procedure for them to follow. I thought I’d reproduce it here for anyone else struggling to get CAN bridge mode up and running.
This example is specific to the BigTreeTech Manta M8P v1.1, but generalizes to other boards with a CAN-enabled MCU and CAN transceiver built in.
- In the host’s terminal, navigate to the klipper repository and open the build configuration:
cd ~/klipper make menuconfig
- Setup the configuration shown below:
(Manta M8P v1.1 specific, you will have to review the schematic for your printboard to see which pins are used.)
[\*] Enable extra low level configuration options Micro controller Architecture (STMicroelectronics STM32 ) Processor model (STM32G0B1 ) Bootloader offset 8 KiB bootloader) Clock Reference (8 MHz crystal) Communication interface (USB to CAN bus bridge (USB on PA11/PA12)) CAN bus interface (CAN bus (on PD12/PD13)) (250000) CAN bus speed
- Press ‘q’ to exit, save the configuration
- Build the firmware:
make clean make
(Manta M8P v1.1 specific, you will have to follow your printboard’s flashing instructions here)
Put the Manta MCU in bootloader mode:
i) Hold down the BOOT0 button
ii) Press and release the RESET button
iii) Release the BOOT0 button
iv) Flash the MCU:
make flash FLASH_DEVICE=0483:df11
v) Look for the success message. If the file does not download successfully, try again.
Check that the MCU is showing up as a CANBUS device:
~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
> Found canbus_uuid=[UUID], Application: Klipper > Total 1 uuids found
If the UUID doesn’t appear, make sure you’ve setup the host as recommended in the instructions under CANBUS#Host-hardware, then reflash the board
Wire up the CAN bus using a twisted pair between the manta and your other boards.
See the Manta M8P v1.1 pinout on page 11 of the manual.
Make sure to verify that you have 120ohm resistors terminating the bus, and that your other boards are flashed for CANBUS communication at the same speed (250000)
Once flashed in CAN bridge mode the MCU no longer appears as a serial device, but instead shows up as a CAN device on
can0. So you’ll need the CAN UUID in your config,
[mcu] #serial: not needed canbus_uuid: [UUID]
Once you’ve gotten to this point, the Klipper CANBUS documentation will get you the rest of the way