#EBB36 / Octopus / CAN Configuration

128 messages · Page 1 of 1 (latest)

mossy egret
#

These are the general steps I took to get my Octopus 1.1 and EBB36 v1.2 boards talking to each other over CAN - I use MainsailOS on my Raspberry Pi.

#

Blog post here for easier reading: https://garagenotes.lmnt.co/#can-bus-breakout-boards---what-why-how

Configuration / Setup Overview

  1. Build Klipper with support for USB to CAN bus bridge (no need for CanBoot on Octopus)
  2. Flash Octopus with updated Klipper firmware
  3. Update RaspberryPi with CAN network interface
  4. Discover Octopus CAN bus UUID and update printer.cfg
  5. Build CanBoot firmware for EBB36
  6. Flash CanBoot onto EBB36
  7. Create cabling to connect EBB36 to Octopus
  8. Flash Klipper to EBB36 over CAN bus
  9. Add EBB36 MCU to printer.cfg
  10. Profit

** What is CanBoot?**

  • CanBoot is firmware that allows one to install Klipper firmware over a CAN network
  • You'll want to install CanBoot on CAN bus boards making it more convenient to install and upgrade Klipper firmware
    • Without it you would need to connect to the board via USB, boot the toolhead into DFU mode and Flash
    • With it you can flash from the RaspberryPi using the flash_can.py utility over the CAN bus network
  • I didn't install CanBus on the Octopus, however, it may be helpful if you can flash it directly from the RaspberryPi (like EBB36), eliminating the need to do the SD Card shuffle... I haven't tested this idea yet!

1. Build Klipper with support for USB to CAN bus bridge for the Octopus:

STMicroelectrnics STM32
STM32F446
32KiB Bootloader
12Mhz Clock
Communications for interface (USB to CAN bus bridge (USB on PA11/PA12))
CAN bus interface (CAN bus on (PD0/PD1))
(250000) CAN bus speed
make clean 
make

USB and CAN bus Pins can be found here https://github.com/bigtreetech/BIGTREETECH-OCTOPUS-V1.0/blob/master/Hardware/BIGTREETECH Octopus - PIN.pdf

CAN bus speed should match all other CAN connected devices - changing from default 500000 to 250000
There are several different STM32 processors on the Octopus - you should verify and ensure correct setting here...

#

2. Flash Octopus with updated Klipper firmware
Copy newly generated firmware from Raspberry Pi to a local computer
scp pi@mainsail.lmnt.local:/home/pi/klipper/out/klipper.bin ~/Downloads/

  • Power off printer
  • Remove SD Card from Octopus
  • Connect SD Card to computer you copied the new firmware build to
  • Copy klipper.bin to SD Card and rename it to firmware.bin
  • Eject the SD Card from computer and Put it back in Octopus board
  • Power on printer - wait

Note:
At this point it will appear that things are no longer working, eg: Mainsail can't connect to your controller board... This should be due to the fact that the Octopus MCU is no longer listening on the USB serial port, but has switched over to listening on the CAN interface.

If you're worried something went wrong with the Firmware update you can shutdown the Octopus, take out the SD Card and see if the firmware.bin was deleted and replaced with a FIRMWARE.CUR. This is a good indication that the firmware was created and copied to the board successfully.

In order to reconnect Mainsail with your Octopus board you'll need to configure the RaspberryPI to talk to the board over the USB - CAN bridge instead of the /dev/serial/by-id/ and update the printer.cfg

3. Configure Raspberry PI CAN interface

Create the can0 network interface:

#
sudo vi /etc/network/interfaces.d/can0

allow-hotplug can0
iface can0 can static
 bitrate 250000
 pre-up ip link set can0 type can bitrate 250000
 pre-up ip link set can0 txqueuelen 1024
 up ifconfig $IFACE txqueuelen 1024
#

Restart networking and ensure the CAN0 interface is up:

#
sudo service networking restart
sudo ifup can0
#
$ ifconfig can0
can0: flags=193<UP,RUNNING,NOARP>  mtu 16
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1024  (UNSPEC)
        RX packets 5973  bytes 44435 (43.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 832  bytes 4922 (4.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
#

4. Query CAN Network - Discover Octopus CAN bus UUID and update printer.cfg

cd /CanBoot/scripts
python3 flash_can.py -i can0 -q
#

Note
At this point you may want to reboot the Raspberry Pi just to ensure that networking starts up as expected

#

Update printer.cfg

#
[mcu]
#serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_0A001A000A50534E4E313020-if00
canbus_uuid: b1382ad2b4b4
#

5. Create CAN Boot firmware for EBB36

#
pi@mainsail:~/ $
pi@mainsail:~/ $ git clone
pi@mainsail:~/ $ cd CanBoot
pi@mainsail:~/CanBoot $ make menuconfig
#
  • Install jumper to enable board power via USB
  • Connect board to RaspberryPi via USB
  • Ensure you can see the device (non-dfu mode)
  • lsusb should show the following when not in DFU mode
#
pi@mainsail:~/CanBoot $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 009: ID 04d8:e72b Microchip Technology, Inc.
>> Bus 001 Device 010: ID 1d50:614e OpenMoko, Inc.
Bus 001 Device 007: ID 1bcf:0215 Sunplus Innovation Technology Inc.
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
#

Reboot the toolhead board in DFU mode for flashing

  • Hold the RESET button and BOOT shown above
  • Release Reset
  • Release Boot
    lsusb should show the device in DFU mode
  • get the device ID (0483:df11) from the output
#
pi@mainsail:~/CanBoot $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 009: ID 04d8:e72b Microchip Technology, Inc.
>> Bus 001 Device 011: ID 0483:df11 STMicroelectronics STM Device in DFU Mode
Bus 001 Device 007: ID 1bcf:0215 Sunplus Innovation Technology Inc.
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
#

6. Flash the CAN Boot firmware to EBB36

#
sudo dfu-util -a 0 -D ~/CanBoot/out/canboot.bin --dfuse-address 0x08000000:force:mass-erase:leave -d 0483:df11

pi@mainsail:~/CanBoot $ sudo dfu-util -a 0 -D ~/CanBoot/out/canboot.bin --dfuse-address 0x08000000:force:mass-erase:leave -d 0483:df11
[sudo] password for pi:
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 1024
DfuSe interface name: "Internal Flash   "
Performing mass erase, this can take a moment
Downloading to address = 0x08000000, size = 4152
Download    [=========================] 100%         4152 bytes
Download done.
File downloaded successfully
dfu-util: Error during download get_status
#

7. Make Klipper firmware for the EBB36

#
cd ~/klipper
make menuconfig
make clean
make
#

Discover Device EBB36 CAN device UUID

#
$ ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
Found canbus_uuid=2c3dfa09d234, Application: CanBoot
Total 1 uuids found
#

8. Flash Klipper to EEB36 over CAN using flash_can.py

#
python3 ~/CanBoot/scripts/flash_can.py -i can0 -f ~/klipper/out/klipper.bin -u MYUUID

pi@mainsail:~/klipper $ ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
Found canbus_uuid=2c3dfa09d234, Application: CanBoot
Total 1 uuids found

pi@mainsail:~/klipper $python3 ~/CanBoot/scripts/flash_can.py -i can0 -f ~/klipper/out/klipper.bin -u 2c3dfa09d234

Sending bootloader jump command...
Resetting all bootloader node IDs...
Checking for canboot nodes...
Detected UUID: 2c3dfa09d234, Application: CanBoot
Attempting to connect to bootloader
CanBoot Connected
Protocol Version: 1.0.0
Block Size: 64 bytes
Application Start: 0x8002000
MCU type: stm32g0b1xx
Verifying canbus connection
Flashing '/home/pi/klipper/out/klipper.bin'...

[##################################################]

Write complete: 13 pages
Verifying (block count = 413)...

[##################################################]

Verification Complete: SHA = 03162D5DC012B2A63CF3D1130D598AD07BEAB251
CAN Flash Success
#

9. Add EBB36 MCU to printer.cfg

[mcu EBB36]
canbus_uuid: 2c3dfa09d234
mossy egret
#
  1. 💸 💰 💶 🫰
#

For those who know more than I do about this CAN configuration - please feel free to help me correct any obviously incorrect information here. I mainly wanted to document the steps I took to get things configured, but recognize that I may have missed some important details, or simply have incorrect information.

turbid spade
#

Niiice. Looks right to me, though I'm going by memory.

harsh cloak
#

Excellent write up. Only thing I do differently nowadays is flashing mainboard MCUs in DFU mode. Fiddling with microSDs is no longer my thing…
Oh and I have CanBoot running on my Manta boards even though it doesn’t support reflashing/upgrading Klipper over CAN, rather simply because it’s readily available, unlike vanilla BTT bootloaders.

mossy egret
#

Yeah the microSD method is fairly straightforward, but difficult to verify that the update worked as expected... I could see where flashing in DFU mode would be simpler and easier to validate. To me, there's always a certain amount of 'magic' when flashing firmware, and I do a fair bit of microcontroller programming too! I can imagine how confusing/nerve wracking it is for someone with little to no knowledge, especially when things don't go as planned! Lot's of room for vendor improvement in this area for sure...

sullen shadow
#

@mossy egret Is it the same procedure for when you want to update an existing klipper firmware image on the ebb36?

mossy egret
#

I haven't actually tried it, there may be another step involved?

sullen shadow
#

ok. thats the step that I missed. I never installed canboot when I initially set my ebb36 up. I misunderstood that detail since my mainboard is an octopus pro and all instructions said that canboot was not needed if using an octopus. Missed that canboot was not needed for the octopus, but was still needed for the ebb36. I'll give it a shot.

mossy egret
#

👍

#

Or you could put the ebb36 back in DFU mode and flash it over USB? But seems like can boot is a little more convenient

sullen shadow
#

canboot would be better since I don't have to set jumpers and hold buttons. I would rather be able to update without touching it.

sullen shadow
#

Thanks for the help. Got it updated. Installed canboot, then was able to flash the klipper image.

mossy egret
#

Awesome!

frozen cobalt
#

@mossy egret so are you saying no longer need u2c board with ebb36 . I have octopus. And is adxl on ebb working ok without u2c?

harsh cloak
# frozen cobalt <@815474628892950589> so are you saying no longer need u2c board with ebb36 . I ...

Obviously I’m not djsplice but I’ll allow myself to answer anyway 🙂

New models of BTT Manta M8P, the M5P and all variants of BTT Octopus can be operated in CAN bridge mode and do not require a CAN adapter such as the U2C.
There are other boards that can operate in such way as well.
Moreover, BTT’s U2C, Fly’s UTOC and similar boards are all flawed products and in my opinion and should be avoided at all costs. In most cases of boards which do not have a native CAN bus output, a separate CAN transceiver ($2 on AliExpress) can be used instead. Almost all STM32 MCUs have CAN support built-in, but only the more modern/higher-end boards have a transceiver onboard and a CAN bus output.

Whether or not the onboard ADXL can be used for input shaping depends on the baudrate (speed) of the CAN network. 500kbit is said to be the minimum, but 1Mbit is more optimal.
However, high baud rates come at a cost of the CAN network being more sensitive to noise, and thus may lead to unexpected Klipper errors during normal operations.

I run all my printers on 250kbit CAN network as I find this to be super robust, one of them with a network of 4 CAN boards successfully.

I don’t rely on the toolhead boards’ accelerometer for input shaping because from my experience its results are not usable anyway. Instead, I’m using a separate Fysetc PIS board mounted at the nozzle when I need it.

With that said, I’ve recently ran input shaper calibration on one of my printers, observing the CAN network utilizing above 200% of the channel at times, but it still completed successfully.

frozen cobalt
#

Thanks for explaining. Lots of people saying 1million on can. Glad you mentioned noise. I'll remov3 u2c and give bridge a whirl

harsh cloak
mossy egret
#

👍 to all the things gargamel wrote - I'm just a grasshopper when it comes to understanding CAN. I've been able to use the ADXL on the EBB36 without issue with CAN set at 250Kbit, though as others have mentioned it's not in an ideal position for measurement.

frozen cobalt
#

ok, for now sticking with U2c since i don't have adapter for rj11. But i can't seem to get the ebb uuid

#

~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
Found canbus_uuid=4fc2bb7946ed, Application: Klipper
Total 1 uuids found All i get is the u2c id

#

have jumpers connecting canl can-h to the u2c can l can h and not finding it to flash klipper

#

Do i need to set the programming jumper on EBB36?

#

I set the 120 ohm jumper on ebb

frozen cobalt
#

Did anybody get this EBB36 POS flashed? I tried STCubeProgrammer on windows and on pi. ON pi, it does not report a UUID so i can't flash it.

#

STProgrammer throws error.

harsh cloak
frozen cobalt
#

Cable chain and dumb breakout looking good after 3 days struggle. Displace did better docs than btt. Trying his method next before returning everything.

frozen cobalt
#

Got a little further on ebb36, but i get this error when i managed to connect. Using BTT binary still not working.

frozen cobalt
#

Ok, turns out 2.10 version flashed it. Wish me luck. 2.13 version did not work.

frozen cobalt
brisk hatch
#

Canboot is now katapult

mossy egret
brisk hatch
mossy egret
brisk hatch
#

pretty sure it is a difference in how to configure it. i'm running ubuntu server 23.04 and they changed network managers

#

the problem is I don't want to lose wifi when I switch

mossy egret
#

Hmmm, I guess I'm not sure exactly what you're trying to figure out... Plus I only sorted out the config in one specific way, so I'm probably not going to be of massive help!

#

networkd is the Linux networking manager, it will read config to start network interfaces, and you need to define a network interface for the CAN network

brisk hatch
# mossy egret networkd is the Linux networking manager, it will read config to start network i...

Yeah. 5 years ago i would have known which man pages to read and solve my problem and then MS became all open sourcey and easy to work withy. Networkd is one of the managers but there are a few. Thats what im trying to figure out what is baked into ubuntu server for rpi. I tried putting the config in /etc/network/interfaces file and in /etc/network/interfaces.d/can0

It just doesnt see them. Trying to remember how to view the right log. NetworkManager is running as well but it doesnt seem to actually be doing anything.

After not using *nix for 5 years i kind of get why people used to tell me it is complicated lol

mossy egret
#

Let me take a look at my notes, see if I can figure out what I did!

mossy egret
#

Fwiw, if your cabling is good enough, I'd go for a higher bit rate, like 1000000

brisk hatch
#

Octopus runs fine on can0

#

And i can flash canboot to the ebb36, but it doesnt do anything after that. When i monitor dmesg i see nothing when i plug it in

#

But i can still get into dfu mode

mossy egret
#

I'm not sure that you'd see anything in dmesg when connecting the EBB36

#

Assuming you're connected to the pi via USB of course...

#

Also assuming you've got power running correctly

#

this is all I see in dmesg:

[5075922.068478] usb 1-1.1: new full-speed USB device number 47 using xhci_hcd
[5075922.209920] usb 1-1.1: New USB device found, idVendor=1d50, idProduct=606f, bcdDevice= 0.00
[5075922.209940] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[5075922.209956] usb 1-1.1: Product: stm32f446xx
[5075922.209972] usb 1-1.1: Manufacturer: Klipper
[5075922.209986] usb 1-1.1: SerialNumber: 0A001A000A50534E4E313020
[5075922.220666] gs_usb 1-1.1:1.0: Configuring for 1 interfaces
[5075922.489944] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
#

the stm32f446xx is my octopus

brisk hatch
#

Wait so after i flash canbus onto the ebb36, i need to plug it into the octopus?

mossy egret
brisk hatch
#

once I realized that I'm flashing klipper over canbus its running

#

now just finding pin assignments

#

😄

#

I was just over thinking things honestly

mossy egret
#

I'm glad you're up and running!

brisk hatch
mossy egret
#

nice catch

rare mango
turbid spade
#

1, the argument that it uses 3 wires is disingenuous, as USB has 4 wires already. So it's more like 6 wires instead of 3.

#

2, USB cables are often sold that are not up to spec, which he dismisses

#

3, "Is it? Your control board has run on USB for ever. It's been tested and proven to work. It works just as well for toolboards too." This killed it for me. Just shoots down any follow-up questions about heat tolerance, etc.

peak stratus
# rare mango https://os.ratrig.com/blog/no-you-dont-want-to-use-can/ thoughts? i'm feeling a...

Oh boy
I have had so many problems with bad USB cables, especially the original cables that came with both our anycubic vypers
Also using USB Hubs to connect stuff will introduce latency
Why is he saying a con of can is latency but at the same time recommending you to add latency to your system?
Also for USB:
If you have a webcam and an MCU plugged into the same pair on your pi you will have a whole other set of problems
I am not a fan of can myself but purely due to the fact that I never saw the need for it, on the other hand if I ever need more than 8 drivers in my printer, I will go can to free up a slot (if there are normal can boards with tmc2240)
But take all of that with a grain of salt, it's just my personal opinion and experiences

turbid spade
#

My takeaway is that CAN is not ideal, but USB also comes with issues.

#

Really wish we could find a way to standardize CAN. Like, call it 3DCAN or something.

#

Standard connector, etc.

peak stratus
#

Another thing I just realized about USB:
The connectors are big and not meant to endure bending
Can is normally connected to crew terminals iirc so less likely to break

turbid spade
#

Yep, they're meant for consumers wanting to quickly disconnect stuff. Not hanging around a toolhead moving at high speed, lol

#

That said, I have wondered how things would go if we just ran serial over USB and dropped the standard cabling.

peak stratus
#

I mean if you cut off the connector and used screw terminals, USB might be feasible
Use a well shielded cable with a proper bending radius, that might not be too bad🤔

turbid spade
peak stratus
#

But having properly shielded cables in a 3d printer is essential
I had so many problems with my Neopixel until I switched to some double shielded microphone cable

turbid spade
#

terminate with Micro Fit 3 or Mini Fit Jr like we often do for CAN

peak stratus
turbid spade
#

hopefully from reliable suppliers

peak stratus
#

Imo stuff that is moving around should always use some form of locking connector

turbid spade
#

Do you ever use MF3? I really like the format.

peak stratus
#

You mean these guys?
If yes, they are great

#

Problem for me is, I only know German "slang" names for most of the stuff XD

turbid spade
#

lol, it's a Molex Micro Fit 3

#

das connectinplugin!

peak stratus
turbid spade
#

I'm being silly 🙂

peak stratus
#

Fair enough

turbid spade
#

Ever seen the fingerpoken thing? It's a riff on that.

peak stratus
#

Nope

turbid spade
formal root
rare mango
#

I currently just have 2 pars of 20 awg twisted wire in a loom, no shielding. should I be worried

turbid spade