# Klipper keeps losing connection to MCU - CANBUS over USB

**URL:** <https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932>\
**Category:** General Discussion\
**Created:** [January 7, 2024, 2:28pm UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932 "2024-01-07T14:28:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjb3d](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jjb3d](https://klipper.discourse.group/u/jjb3d)\
**Post date:** [January 7, 2024, 2:28pm UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932/1 "2024-01-07T14:28:25Z")

</div>

Printer Model: Ender 3 V2  
MCU / Printerboard: E3EZ with CB1 board and a EBB42 v1.1 for the hotend  
[klippy.log](https://klipper.discourse.group/uploads/short-url/vpGda5cZdR5LdkKrQ34sHOfcX7d.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:

```auto
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

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

```

Any help would be great, thanks!

…

---

<div class="post-metadata">

**Author:** ![jjb3d](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jjb3d](https://klipper.discourse.group/u/jjb3d)\
**Post date:** [January 7, 2024, 2:39pm UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932/2 "2024-01-07T14:39:49Z")

</div>

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](https://klipper.discourse.group/uploads/short-url/g7REpA5pkhysRqUI9fSHNO7iVtA.log) (857.7 KB)

---

<div class="post-metadata">

**Author:** ![jakep\_82](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@jakep\_82](https://klipper.discourse.group/u/jakep_82)\
**Post date:** [January 7, 2024, 6:18pm UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932/3 "2024-01-07T18:18:18Z")

</div>

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](https://www.klipper3d.org/CANBUS.html#finding-the-canbus_uuid-for-new-micro-controllers)

---

<div class="post-metadata">

**Author:** ![jjb3d](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jjb3d](https://klipper.discourse.group/u/jjb3d)\
**Post date:** [January 7, 2024, 7:04pm UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932/4 "2024-01-07T19:04:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jakep\_82](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@jakep\_82](https://klipper.discourse.group/u/jakep_82)\
**Post date:** [January 7, 2024, 7:30pm UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932/5 "2024-01-07T19:30:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jakep\_82](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@jakep\_82](https://klipper.discourse.group/u/jakep_82)\
**Post date:** [January 7, 2024, 7:37pm UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932/6 "2024-01-07T19:37:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jjb3d](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jjb3d](https://klipper.discourse.group/u/jjb3d)\
**Post date:** [January 7, 2024, 8:16pm UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932/7 "2024-01-07T20:16:07Z")

</div>

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

```auto
~/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.

```auto
 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

```

---

<div class="post-metadata">

**Author:** ![jjb3d](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jjb3d](https://klipper.discourse.group/u/jjb3d)\
**Post date:** [January 7, 2024, 8:36pm UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932/8 "2024-01-07T20:36:22Z")

</div>

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](https://klipper.discourse.group/uploads/short-url/yLfzWyy3A4RWhCErHZ503H6HJR5.log) (1.6 MB)

---

<div class="post-metadata">

**Author:** ![jakep\_82](https://avatars.discourse-cdn.com/v4/letter/j/ea666f/32.png) [@jakep\_82](https://klipper.discourse.group/u/jakep_82)\
**Post date:** [January 7, 2024, 9:17pm UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932/9 "2024-01-07T21:17:32Z")

</div>

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

> <https://github.com/bigtreetech/Manta-E3EZ/blob/master/Firmware/Klipper/generic-bigtreetech-manta-e3ez.cfg>

---

<div class="post-metadata">

**Author:** ![jjb3d](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jjb3d](https://klipper.discourse.group/u/jjb3d)\
**Post date:** [January 7, 2024, 10:17pm UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932/11 "2024-01-07T22:17:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/klipper/original/1X/64419bf2aac6639e6ef5cef200dcd456b0a01ac3.png) [@system](https://klipper.discourse.group/u/system)\
**Post date:** [February 7, 2024, 8:18am UTC](https://klipper.discourse.group/t/klipper-keeps-losing-connection-to-mcu-canbus-over-usb/12932/12 "2024-02-07T08:18:26Z")

</div>

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