CANBUS Bridge Mode Configuration

Basic Information:

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.

  1. In the host’s terminal, navigate to the klipper repository and open the build configuration:
cd ~/klipper
make menuconfig
  1. 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

image

  1. Press ‘q’ to exit, save the configuration
  2. Build the firmware:
make clean
make
  1. (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.

  2. Check that the MCU is showing up as a CANBUS device:

~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0

Expected response:

> 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

  1. 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)

  2. 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

1 Like

this is great, i have one question. how do i update the manta once all setup. evertime i update i have to reflash klipper which is annoying. im the type to like keeping things updated.

I would expect that’s unavoidable but could likely be scripted to be automatic by someone more familiar with the howto’s than I as I have yet to do this myself. You are adding new functionality to klipper, and whats in the controller card must be made to accept and execute the added commands.