Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nero-dv/94c3e7a198746c818951f3d3a145a667 to your computer and use it in GitHub Desktop.
Save nero-dv/94c3e7a198746c818951f3d3a145a667 to your computer and use it in GitHub Desktop.
Flashing bootloader and klipper to Manta M8P - Backing up the instructions I wrote at https://github.com/bigtreetech/Manta-M8P/issues/85#issuecomment-2702943520

I had the same problem. What ended up happening is that I borked the bootloader on the M8P, and the CM4 could not see the M8P board when I ran the lsusb command. What I ended up doing was flashing the bootloader available in the Manta-M8P/V2.0 repo (link) with dfu-util.

  1. Press and hold the boot0 button of M8P first, then (while holding boot0) click the reset button to make the M8P boot into DFU mode.
  2. You can confirm that the M8P is in DFU mode by running lsusb. The device should show up as 'STMicroelectronics STM Device in DFU Mode'
  3. After running lsusb and confirm that the device is in DFU mode, copy the ID. For my M8P, it was "0483:df11"
  4. While logged in to the CB1/CM4, follow these steps to download and write the bootloader (M8P_V2_H723_bootloader.bin) to the chip:

If you haven't downloaded the bootloader yet, download it first:

curl -4 -L -o  ~/M8P_V2_H723_bootloader.bin https://github.com/bigtreetech/Manta-M8P/raw/refs/heads/master/V2.0/Firmware/M8P_V2_H723_bootloader.bin

The bootloader's MD5 checksum is b079e375a1b4ba9c28f01a9a8b9b6d17. It is the version that was uploaded to their github repo in commit 50abb9ae56584d6018ef99c584a8bf4982013d31

You can confirm that you have the correct binary by running

md5sum ~/M8P_V2_H723_bootloader.bin

After confirming that you have the correct binary, you can flash it to the M8P:

sudo dfu-util -d ,0483:df11 -a 0 --dfuse-address 0x8000000:force:mass-erase -D ./M8P_V2_H723_bootloader.bin

After this, I set up the can0 interface:

sudo nano /etc/network/interfaces.d/can0

I used the following configuration:

allow-hotplug can0
iface can0 can static
    bitrate 1000000
    up ifconfig $IFACE txqueuelen 1024

I power cycled the device then logged back in via SSH and ran the klipper install process:

cd ~/klipper
make menuconfig

I used the following settings:

Note: Klipper v13.x settings include a new option to optimize the stepper code to use 'step on both edges'. I found more information about this on their discourse forum

Klipper v11.x

[*] Enable extra low-level configuration options

Micro-controller Architecture (STMicroelectronics STM32)  --->

Processor model (STM32H723)  --->

Bootloader offset (128KiB bootloader (SKR SE BX v2.0))  --->

Clock Reference (25 MHz crystal)  --->

Communication interface (USB to CAN bus bridge (USB on PA11/PA12))  --->

CAN bus interface (CAN bus (on PD0/PD1))  --->

USB ids  --->

(1000000) CAN bus speed

()  GPIO pins to set at micro-controller startup (NEW)

Klipper v13.x

  [*] Enable extra low-level configuration options

  Micro-controller Architecture (STMicroelectronics STM32)  --->

  Processor model (STM32H723)  --->

  Bootloader offset (128KiB bootloader)  --->

  Clock Reference (25 MHz crystal)  --->

  Communication interface (USB to CAN bus bridge (USB on PA11/PA12))  --->

  CAN bus interface (CAN bus (on PD0/PD1))  --->

  USB ids  --->

  (1000000) CAN bus speed

  [*] Optimize stepper code for 'step on both edges'

  ()  GPIO pins to set at micro-controller startup

Then I ran make, rebooted into DFU mode again, and I used the same device ID from when I ran lsusb prior to pushing the bootloader to it to flash Klipper:

make flash FLASH_DEVICE=0483:df11

After that finished, I reset the MCU by clicking the reset button on the board and verified that the M8P showed a CAN address:

python3 ~/klipper/lib/canboot/flash_can.py -q
-or-
~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0

Finally, after confirming that I had a uuid for the M8P, I updated my printer config to assign the MCU:

mcu section of printer.cfg:

[mcu]
canbus_uuid: d185719b1d76

I followed a guide on flashing Katapult and Klipper onto the tool-head board I'm using (SB2209 RP2040).

Update: mpx.wiki changed their links. The updated link to mpx's guide on flashing Katapult and Klipper onto the SB2209 RP2040 tool-head is https://mpx.wiki/Firmware-Flash/flash-m8p-v2-ebb

Another note specific to using a tool-head PCB: A lot of guides mention shorting the 120R terminator resistor, but they don't specify that it has to be done on both the Manta and the tool-head PCB. As someone new to this kind of thing back then, it was definitely something that needed clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment