Skip to content

Instantly share code, notes, and snippets.

@fredrikasberg
Last active November 21, 2024 12:09
Show Gist options
  • Save fredrikasberg/c14f08eb8617bf8981f77dbc01b00602 to your computer and use it in GitHub Desktop.
Save fredrikasberg/c14f08eb8617bf8981f77dbc01b00602 to your computer and use it in GitHub Desktop.
BTT Manta M8P v1.1 + BTT EBB 2209 Canbus setup

BTT Manta M8P v1.1 + BTT EBB 2209 Canbus setup

Since documentation has been somewhat lacking... here is a quick write-up to get started!

Sources:

Boards:

NOTE This guide assumes that you are running Mainsail (Raspbian Buster). While the firmware compilation/flashing is more or less the same on all systems there will probably be differences in configuring the canbus interface if you are running a newer version of Raspbian (Bookworm or later).

Systemd configuration by @yzheka in the comments.

Manta M8P

NOTE Do not forget the 120R jumper just above the canbus connector!

Board overview

Katapult (previously CanBoot)

As julianschweizer pointed out, the CanBoot project has been renamed Katapult

First, ssh into your system and from the home directory pull the latest version of katapult

git clone https://github.com/Arksine/katapult.git

Enter directory and compile Katapult

cd ~/katapult
make menuconfig

Use the following config

Micro-controller Architecture (STMicroelectronics STM32)  --->
Processor model (STM32G0B1)  --->
Build CanBoot deployment application (Do not build)  --->
Clock Reference (8 MHz crystal)  --->
Communication interface (CAN bus (on PD12/PD13))  --->
Application start offset (8KiB offset)  --->
(250000) CAN bus speed
() GPIO pins to set on bootloader entry
[*] Support bootloader entry on rapid double click of reset button
[ ] Enable bootloader entry on button (or gpio) state
[ ] Enable Status LED

Now build Katapult

make clean
make

Klipper

Enter klipper directory and compile klipper

cd ~/klipper
make menuconfig

Use the following configuration

[*] Enable extra low-level configuration options
Micro-controller Architecture (STMicroelectronics STM32) --->
Processor model (STM32G0B1) --->
Bootloader offset (8KiB 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)) --->
USB ids --->
(250000) CAN bus speed
() GPIO pins to set at micro-controller startup

Now build klipper

make clean
make

Flashing Katapult and Klipper

First flash your Manta M8P by entering DFU mode

  1. Hold down Boot0 AND Reset
  2. Release Reset and then Boot0

Make sure that your board is in DFU mode by running

lsusb

This should show you the Manta M8P as Bus 001 Device 008: ID 0483:df11 STMicroelectronics STM Device in DFU Mode.

When you have validated that the Manta M8P is ready, flash Katapult.

sudo dfu-util -a 0 -D ~/katapult/out/katapult.bin --dfuse-address 0x08000000:force:leave -d 0483:df11

Then reset the board by pressing Reset and then put the board in DFU mode once again to flash Klipper.

sudo dfu-util -a 0 -d 0483:df11 --dfuse-address 0x08002000 -D ~/klipper/out/klipper.bin

Now the board should be running Katapult with Klipper. Verify by pressing Reset once again and then run lsusb. The board should be identified by Bus 001 Device 011: ID 1d50:606f OpenMoko, Inc. Geschwister Schneider CAN adapter.

Enable Canbus on the Raspberry Pi

To enable the canbus on the raspberry pi you need to create the interface file

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

Paste the following content

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

To bring the canbus interface can0 up simply run sudo ifup can0. If everything worked you should now be able to query your Manta board using python3 ~/katapult/scripts/flash_can.py -q. This command will present you with the UUID of the Manta board which you need to reference in your printer.cfg.

[mcu]
canbus_uuid: <your uuid goes here>
canbus_interface: can0

BTT EBB2209

The procedure is more or less the same for the EBB2209 board.

NOTE I don't know with 100% certainty that the heater won't turn on when the board is in DFU mode so keep the heater cartridge disconnected just to be safe!

NOTE Do not forget the 120R jumper on the bottom of the board (beside BL-Touch connector)!

Katapult

Just enter the katapult folder from the last step and re-run menuconfig.

cd ~/katapult
make menuconfig

Use the followin config

[*] Enable extra low-level configuration options
Micro-controller Architecture (STMicroelectronics STM32) --->
Processor model (STM32G0B1) --->
Bootloader offset (8KiB bootloader) --->
Clock Reference (8 MHz crystal) --->
Communication interface (CAN bus (on PB0/PB1)) --->
(250000) CAN bus speed

Now compile Katapult

make clean
make

Klipper

Enter klipper directory and compile klipper

cd ~/klipper
make menuconfig

Use the following config

[*] Enable extra low-level configuration options
Micro-controller Architecture (STMicroelectronics STM32) --->
Processor model (STM32G0B1) --->
Bootloader offset (8KiB bootloader) --->
Clock Reference (8 MHz crystal) --->
Communication interface (CAN bus (on PB0/PB1)) --->
(250000) CAN bus speed

Flashing Katapult and Klipper

Board overview

First flash your EBB2209 by entering DFU mode

  1. Hold down Boot AND Rst
  2. Release Reset and then Boot

Make sure that your board is in DFU mode by running

lsusb

This should show you the EBB22009 as Bus 001 Device 008: ID 0483:df11 STMicroelectronics STM Device in DFU Mode.

When you have validated that the board is ready, flash Katapult.

sudo dfu-util -a 0 -D ~/katapult/out/katapult.bin --dfuse-address 0x08000000:force:leave -d 0483:df11

Then reset the board by pressing Rst and then put the board in DFU mode once again to flash Klipper.

sudo dfu-util -a 0 -d 0483:df11 --dfuse-address 0x08002000 -D ~/klipper/out/klipper.bin

Now the board should be running Katapult with Klipper. Verify by pressing Reset once again and then run lsusb. The board should be identified by Bus 001 Device 011: ID 1d50:606f OpenMoko, Inc. Geschwister Schneider CAN adapter.

Since you already have a canbus network up and running, simply run python3 ~/katapult/scripts/flash_can.py -q to get the UUID for the EBB2209 board.

Using the UUID from that command you should reference the board the same way you did your Manta board but this time with a identifier.

[mcu EBBCan]
canbus_uuid: <your uuid goes here>
canbus_interface: can0

Now you need to update your printer configuration to use the appropriate pins and if you named your mcu EBBCan you can more or less copy the example configuration!

Happy printing!

@rafous
Copy link

rafous commented Nov 9, 2023

nice, I succeeded in 10 minutes thanks to you my m8P and my EBB36

@julianschweizer
Copy link

Quick notes:
CanBoot is now called "katapult":
git clone https://github.com/Arksine/katapult.git
cd ~/katapult
sudo dfu-util -a 0 -D ~/katapult/out/katapult.bin --dfuse-address 0x08000000:force:leave -d 0483:df11

If you try to flash Manta M8P V2.0 use this guide:

https://letstry.science/2023/10/flashing-bigtreetech-manta-m8p-v2.0/

@fredrikasberg
Copy link
Author

I have updated the gist since Arksine has changed the name of CanBoot as @julianschweizer pointed out.

@heissenberger
Copy link

i have used this guide before and it worked great. i did an update and my canbus went down, so i just restarted fron scratch and now when I query it just says

biqu@BTT-CB1:~$ python3 ~/katapult/scripts/flash_can.py -q
Resetting all bootloader node IDs...
Checking for Katapult nodes...
Query Complete

any ideas?

@danielsmoura
Copy link

i have used this guide before and it worked great. i did an update and my canbus went down, so i just restarted fron scratch and now when I query it just says

biqu@BTT-CB1:~$ python3 ~/katapult/scripts/flash_can.py -q Resetting all bootloader node IDs... Checking for Katapult nodes... Query Complete

any ideas?

Same issue here !

@heissenberger
Copy link

I figured it out and after I did the enable on Raspberry pi section inbetween the Manta and EBB in this guide, Yes i realize I use a CB1,and maybe you do to, but after I did those steps I was able to look up the UUID

@Bullseyeadept
Copy link

I am still having the issues you listed heissenberger, I keep losing the nodes! Any ideas what I should do?

@mray190
Copy link

mray190 commented May 27, 2024

I also keep losing the MCU node after a few power cycles. Anyone have a fix? Seen this problem from a few users without resolution

@feliksyasnopolski
Copy link

Check out your wiring. Firmware doesn't have anything related to it

@yzheka
Copy link

yzheka commented Nov 20, 2024

I was unable to bring can0 up using sudo ifup can0 from this tutorial. but sudo ip link set up can0 type can bitrate 250000 worked

@yzheka
Copy link

yzheka commented Nov 21, 2024

also can0 is down by default for me after reboot. To fix it I should do
sudo nano /etc/systemd/network/80-can.network

[Match]
Name=can*

[CAN]
BitRate=250K

Then (re-)start the systemd-networkd service:

sudo systemctl restart systemd-networkd
To have it start automatically when booting:

sudo systemctl enable systemd-networkd

@fredrikasberg
Copy link
Author

@yzheka You are not running Mainsail right?

@yzheka
Copy link

yzheka commented Nov 21, 2024

@yzheka You are not running Mainsail right?

fluidd. does it matter?

@fredrikasberg
Copy link
Author

@yzheka Not for the firmware parts but im guessing you are running latest Raspbian (Bookworm) and fluidd through kiauh?
Mainsail is based on Raspbian Buster which still supports the /etc/network/interfaces method as where Bookworm has moved on to systemd. I will update the gist.

@yzheka
Copy link

yzheka commented Nov 21, 2024

@fredrikasberg I am using raspberry pi os lite 64 bit + fluidd via kiauh

@yzheka
Copy link

yzheka commented Nov 21, 2024

@fredrikasberg I have added some more instructions on how to restart systemd and enable on boot

@fredrikasberg
Copy link
Author

@yzheka Great! I have updated the gist linking to your post.

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