Klipper keeps losing connection to MCU - CANBUS over USB

Printer Model: Ender 3 V2
MCU / Printerboard: E3EZ with CB1 board and a EBB42 v1.1 for the hotend
klippy.log (793.1 KB)

I had my E3EZ setup with the EBB42 but manged to let out the magic smoke so had to replace it - the heated bed controller no longer functioned. I transferred in the new board, flashed the E3EZ MCU (same settings as used for the initial board) and ran ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0 to get the can UUID.

E3EZ Menuconfig settings:

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))
CAN bus speed (500000)

This worked initailly and I upated the printer.cfg, which allowed klipper to control the E3EZ board, but after a minute or two running the same command returned Total 0 uuids found.

The board was present in Fluidd still, but with the connected EBB42 not being displayed still I decied to reinstall debian on the CB1 using the same image as before and to reflash the E3EZ MCU again.

Now querying for the Can uuids continues to return 0 results and klipper cannot connect to the E3EZ MCU.

Here are my can interface settings:
/etc/network/interfaces.d/can0

allow-hotplug can0
iface can0 can static
    bitrate 500000
    up ifconfig $IFACE txqueuelen 2048

Any help would be great, thanks!

Klipper is managing to intermittently connect to the E3EZ MCU despite no changes being made, but ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0 is consistently returning Total 0 uuids found. Updated klippy.log attached
klippy (1).log (857.7 KB)

canbus_query will only return results for uninitialized uuids. If you want to see the uuid for your EZ board in the results, stop the Klipper service before running the query.

https://www.klipper3d.org/CANBUS.html#finding-the-canbus_uuid-for-new-micro-controllers

That is useful info, thank you!

I stopped the klipper service (sudo service klipper stop) and still get zero uuids found. I think I still need to find the root cause of this flaky/intermittent connection.

After stopping the service you would also need to reset or power cycle the MCU.

If you intend to use USB to CAN bus I would also recommend following the Klipper docs. Specifically you should be using 1M, not 500K for the speed. At 500K you’ll probably have issues with the accelerometer.

Thanks, I stopped the service and reset the both MCUs, only the mainboard was showing up.

~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
Found canbus_uuid=4fb17aa8ad60, Application: Klipper
Total 1 uuids found

I’d been following a guide produced for the EBB when setting up previously, was working alright though. I’m using a seperate usb accelerometer as my EBB doesn’t have one, but I have now updated the interface and flashed the mainboard to use a bitrate of 1M - thinking this may have been premature though as I’d previously flashed the EBB with a lower bitrate and Katapult/canboot is not managing to flash the new 1M klipper firmware I generated.

 python3 ~/katapult/scripts/flash_can.py -i can0 -f ~/klipper/out/klipper.bin -u ef03e7b2eeb6
Sending bootloader jump command...
Resetting all bootloader node IDs...
Attempting to connect to bootloader
ERROR:root:Flash Error
Traceback (most recent call last):
  File "/home/biqu/katapult/scripts/flash_can.py", line 475, in run
    await flasher.connect_btl()
  File "/home/biqu/katapult/scripts/flash_can.py", line 89, in connect_btl
    ret = await self.send_command('CONNECT')
  File "/home/biqu/katapult/scripts/flash_can.py", line 193, in send_command
    raise FlashCanError("Error sending command [%s] to Can Device"
FlashCanError: Error sending command [CONNECT] to Can Device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/biqu/katapult/scripts/flash_can.py", line 622, in main
    loop.run_until_complete(sock.run(intf, uuid, fpath, req_only))
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/biqu/katapult/scripts/flash_can.py", line 483, in run
    await flasher.finish()
  File "/home/biqu/katapult/scripts/flash_can.py", line 272, in finish
    await self.send_command("COMPLETE")
  File "/home/biqu/katapult/scripts/flash_can.py", line 193, in send_command
    raise FlashCanError("Error sending command [%s] to Can Device"
FlashCanError: Error sending command [COMPLETE] to Can Device

To be clear klipper is still not connecting to the E3EZ mainboard despite the changes, but does show when queried using the command in the terminal (after disabling the service and resetting).
klippy (5).log (1.6 MB)

Check the sample config file for this board. It looks like you are using the wrong pins for the CAN bus.

2 Likes

You’re a gent! Saved me another day of endless reflashing. That was the issue, apologies for taking up your time

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.