CanBoot icon indicating copy to clipboard operation
CanBoot copied to clipboard

Flashing over CAN not working with Big Tree Tech EBB36 v1.2 from BTT U2C v2.1

Open Norbs12 opened this issue 2 years ago • 31 comments

Currently you can flash CanBoot onto the device and it's recognized over the CAN network, but then trying to flash Klipper, it ends with a bunch of errors during the flash and requires reflash in DFU mode.

I will try to get more details on the errors soon, when this first happened I thought I was just doing somethign wrong but others are also seeing this issue. Just wanted this as a placeholder for now and for awareness.

The board otherwise functions over CAN reliably if flashed with only Klipper via DFU.

Others who also experienced this: https://www.youtube.com/watch?v=Ucq3U-H2N-A

EDIT: Seems to be an issue specifically with the BTT U2C v2.1, I was able to use Octopus Pro can bridge without issue.

Norbs12 avatar Oct 13 '22 21:10 Norbs12

Same for me but using a Huvud 6.1 board. Term resistors are reading 60 Ohms and connection seems fine since it gets UUID.

pi@voron:~/klipper/lib/canboot $ python3 flash_can.py -i can0 -f ~/klipper/out/klipper.bin -u 2d96b9a09c30 Sending bootloader jump command... Resetting all bootloader node IDs... Checking for canboot nodes... Detected UUID: 2d96b9a09c30, Application: CanBoot Attempting to connect to bootloader ERROR:root:Can Read Error Traceback (most recent call last): File "flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Flash Error Traceback (most recent call last): File "flash_can.py", line 603, in main loop.run_until_complete(sock.run(intf, uuid, fpath)) File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete return future.result() File "flash_can.py", line 467, in run await flasher.connect_btl() File "flash_can.py", line 89, in connect_btl ret = await self.send_command('CONNECT') File "flash_can.py", line 187, in send_command % (cmdname)) FlashCanError: Error sending command [CONNECT] to Can Device pi@voron:~/klipper/lib/canboot $

rbrtwtrs avatar Oct 13 '22 22:10 rbrtwtrs

Chime in if you are using a U2C, and if so, what version, V1-STM32F072 or V2-STM32G0B1

I have the STM32F072 without this issue, but I do know of another user that has the STM32G0B1 that has this issue.

NAPCAL avatar Oct 13 '22 23:10 NAPCAL

BTT U2C v2.1 (STM32G0B1) and BTT EBB36 CAN v1.2 (STM32G0B1)

Norbs12 avatar Oct 13 '22 23:10 Norbs12

U2C v2.1 with EBB42 v 1.2 both G0B1 chips. Flashed over DFU and seams to be working. Had to send cmd's sudo ifdown can0 sudo ifup can0 then ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0 to get a uuid otherwise id just get 0 uuid.

ChipTheCat avatar Oct 13 '22 23:10 ChipTheCat

For the people having issues, can you try and follow this guide with all the exact settings? (only thing i did different is 250000 instead of 500000)

https://maz0r.github.io/klipper_canbus/toolhead/ebb36-42_v1.1.html

I was trying to reproduce the issue and it actually worked on hardware that didn't work before.

Norbs12 avatar Oct 14 '22 05:10 Norbs12

I tried both 500000 and 250000, followed the guide verbatim. Tried different offsets etc. Nothing worked.

rbrtwtrs avatar Oct 14 '22 19:10 rbrtwtrs

I'm giving up on the Canbus mod. Way more trouble than it saves in wiring. Huvud board is too big to fit anywhere on a Stealthburner anyway. Disappointing waste of $

rbrtwtrs avatar Oct 14 '22 19:10 rbrtwtrs

I'm giving up on the Canbus mod. Way more trouble than it saves in wiring. Huvud board is too big to fit anywhere on a Stealthburner anyway. Disappointing waste of $

Robert, if you don't mind, are you trying to use the BTT U2C?

If so, please comment with the STM32 version on yours; thanks.

NAPCAL avatar Oct 14 '22 19:10 NAPCAL

I am using a Huvud 6.1 board with an STM32F103C8T6. Latest version w CANBOOT pre installed. CAN interface is a Waveshare RS485 CAN Hat w a RasPi4. Did not have an ST-Link to try re-flashing the CAN bootloader and I have decided to quit screwing with it and just go with direct wires.

rbrtwtrs avatar Oct 14 '22 20:10 rbrtwtrs

So I think I managed to track the issue down to something with possibly the Pi4 (or my specific Pi4).

I'm basically at the point where I can replace my Pi4 with a Pi3 (only changing the Pi, keeping same SD card and everything else connected) and make it work.

Don't think there is any issue with my Pi4 as everything else is stable, but I plan on trying to swap that with another and keep testing.

UPDATE: Tried another Pi4 and same issue.

Not sure if it helps anyone but here is the full error when it fails on my Pi4:

python3 /home/pi/klipper/lib/canboot/flash_can.py -i can0 -f ~/klipper/klipper-ebb36.bin -u 505bd1db8c4c Sending bootloader jump command... Resetting all bootloader node IDs... Checking for canboot nodes... Detected UUID: 505bd1db8c4c, 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/klipper-ebb36.bin'...

[#ERROR:root:Can Read Error Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/klipper/lib/canboot/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/klipper/lib/canboot/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/klipper/lib/canboot/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/klipper/lib/canboot/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 469, in run await flasher.send_file() File "/home/pi/klipper/lib/canboot/flash_can.py", line 207, in send_file resp = await self.send_command('SEND_BLOCK', prefix + buf) File "/home/pi/klipper/lib/canboot/flash_can.py", line 187, in send_command % (cmdname)) FlashCanError: Error sending command [SEND_BLOCK] to Can Device

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/klipper/lib/canboot/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 469, in run await flasher.send_file() File "/home/pi/klipper/lib/canboot/flash_can.py", line 207, in send_file resp = await self.send_command('SEND_BLOCK', prefix + buf) File "/home/pi/klipper/lib/canboot/flash_can.py", line 187, in send_command % (cmdname)) FlashCanError: Error sending command [SEND_BLOCK] to Can Device

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/klipper/lib/canboot/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 469, in run await flasher.send_file() File "/home/pi/klipper/lib/canboot/flash_can.py", line 207, in send_file resp = await self.send_command('SEND_BLOCK', prefix + buf) File "/home/pi/klipper/lib/canboot/flash_can.py", line 187, in send_command % (cmdname)) FlashCanError: Error sending command [SEND_BLOCK] to Can Device

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/klipper/lib/canboot/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 469, in run await flasher.send_file() File "/home/pi/klipper/lib/canboot/flash_can.py", line 207, in send_file resp = await self.send_command('SEND_BLOCK', prefix + buf) File "/home/pi/klipper/lib/canboot/flash_can.py", line 187, in send_command % (cmdname)) FlashCanError: Error sending command [SEND_BLOCK] to Can Device

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/klipper/lib/canboot/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 469, in run await flasher.send_file() File "/home/pi/klipper/lib/canboot/flash_can.py", line 207, in send_file resp = await self.send_command('SEND_BLOCK', prefix + buf) File "/home/pi/klipper/lib/canboot/flash_can.py", line 187, in send_command % (cmdname)) FlashCanError: Error sending command [SEND_BLOCK] to Can Device

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/klipper/lib/canboot/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for raise futures.TimeoutError() concurrent.futures._base.TimeoutError ERROR:root:Can Flash Error Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 469, in run await flasher.send_file() File "/home/pi/klipper/lib/canboot/flash_can.py", line 207, in send_file resp = await self.send_command('SEND_BLOCK', prefix + buf) File "/home/pi/klipper/lib/canboot/flash_can.py", line 187, in send_command % (cmdname)) FlashCanError: Error sending command [SEND_BLOCK] to Can Device

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/klipper/lib/canboot/flash_can.py", line 603, in main loop.run_until_complete(sock.run(intf, uuid, fpath)) File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete return future.result() File "/home/pi/klipper/lib/canboot/flash_can.py", line 475, in run await flasher.finish() File "/home/pi/klipper/lib/canboot/flash_can.py", line 265, in finish await self.send_command("COMPLETE") File "/home/pi/klipper/lib/canboot/flash_can.py", line 187, in send_command % (cmdname)) FlashCanError: Error sending command [COMPLETE] to Can Device

Norbs12 avatar Oct 16 '22 01:10 Norbs12

In another issue post when the EBB's changed to STM32G0B1 when asking about CAN-FD that G0B1 provides and if we needed to upgrade our CAN bus devices to CAN-FD; Arksine responded that the CanBoot for the G0B1 would use the basic CAN bus protocol and not the FD protocol, so no update needed.

Klipper seems to support both basic & FD on the G0B1. Still, the overall bus has to use the same protocol, so the newer U2C with the G0B1 is more than likely setting up for FD and will not fully talk to CanBoot in basic CAN mode, like binary file transfer of the Klipper firmware but can retrieve UUID's from devices running basic CAN.

NAPCAL avatar Oct 16 '22 01:10 NAPCAL

Alright my last update. Seems like this is some kind of interaction between the Pi4 and the BTT U2C v2.1.

Since I have a Octopus Pro, I ended up just using the onboard can bridge and I don't have anymore issues with the same can toolhead.

Norbs12 avatar Oct 16 '22 05:10 Norbs12

I'm also experiencing this issue - canboot and klipper are both flashed via USB, and klipper is working, but attempting to flash over CAN corrupts something, and then you have to start over from scratch with DFU again.

Running the U2C v2.1 and EBB36 v1.2 - both on G0B1 chips, and all connected to a CB1 mounted on a Manta MP8.

Not sure if its related - but I also cannot use the ADXL on my EBB. The moment I enable that section of the klipper config, klipper fails to start. Kinda seems like anything high-bandwidth is having issues? Or maybe its unrelated.

Cova avatar Oct 27 '22 23:10 Cova

Same problem here with a Pi4 and an octopus 1.1

master ✔ $ ip a
...
8: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP group default qlen 128
    link/can
master ✔ $ python3 flash_can.py -i can0 -q
Resetting all bootloader node IDs...
Checking for canboot nodes...
Detected UUID: c2ecdf459ba5, Application: Klipper
Query Complete

If I try a second time the can device is not present anymore.

master ✔ $ python3 flash_can.py -i can0 -q
Resetting all bootloader node IDs...
Checking for canboot nodes...
Query Complete

If I try to flash klipper over can I get the following.

master ✔ $ python3 flash_can.py -i can0 -u c2ecdf459ba5 -f ~/firmware/octopus_1.1_klipper.bin
Sending bootloader jump command...
Resetting all bootloader node IDs...
Checking for canboot nodes...
ERROR:root:Can Flash Error
Traceback (most recent call last):
  File "flash_can.py", line 609, in main
    loop.run_until_complete(sock.run(intf, uuid, fpath))
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "flash_can.py", line 458, in run
    id_list = await self._query_uuids()
  File "flash_can.py", line 406, in _query_uuids
    resp = await self.admin_node.readexactly(8, diff)
  File "flash_can.py", line 282, in readexactly
    return await asyncio.wait_for(self._reader.readexactly(n), timeout)
  File "/usr/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/lib/python3.7/asyncio/streams.py", line 677, in readexactly
    raise IncompleteReadError(incomplete, n)
asyncio.streams.IncompleteReadError: 0 bytes read on a total of 8 expected bytes

And klipper itself also crash image

I can properly flash with the serial usb for the first klipper flash. python3 flash_can.py -f ~/firmware/octopus_1.1_klipper.bin -d /dev/serial/by-id/usb-CanBoot_stm32f446xx_170038000650314D35323820-if00

But after klipper with can is flashed, I can no longer use the serial usb as only the can0 interface is available.

Also note that doing a power cycle put everything back in working condition.

akhamar avatar Oct 28 '22 22:10 akhamar

Some complementary info :

  • octopus 1.1 STM32F446
  • latest version of klipper
  • latest version of canboot
  • klipper configured as USB to CAN bus bridge (USB on PA11/PA12) and CAN bus (on PD0/PD1)

It is the octopus 1.1 board itself that I'm trying to update, not the toolhead.

akhamar avatar Oct 28 '22 22:10 akhamar

After some more test, I get the following.

master ✔ $ python3 flash_can.py -i can0 -u c2ecdf459ba5 -f ~/firmware/octopus_1.1_klipper.bin                                                                                                  130 ↵
Sending bootloader jump command...
Resetting all bootloader node IDs...
Checking for canboot nodes...
ERROR:root:Can Flash Error
Traceback (most recent call last):
  File "flash_can.py", line 609, in main
    loop.run_until_complete(sock.run(intf, uuid, fpath))
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "flash_can.py", line 458, in run
    id_list = await self._query_uuids()
  File "flash_can.py", line 406, in _query_uuids
    resp = await self.admin_node.readexactly(8, diff)
  File "flash_can.py", line 282, in readexactly
    return await asyncio.wait_for(self._reader.readexactly(n), timeout)
  File "/usr/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/lib/python3.7/asyncio/streams.py", line 677, in readexactly
    raise IncompleteReadError(incomplete, n)
asyncio.streams.IncompleteReadError: 0 bytes read on a total of 8 expected bytes

While the flash fail, it appear that the board itself restart and start on the bootloader itself.

Oct 29 00:58:33 mainsailos kernel: [ 6458.109661] usb 1-1.2: USB disconnect, device number 34
Oct 29 00:58:33 mainsailos kernel: [ 6458.109858] gs_usb 1-1.2:1.0 can0: Couldn't shutdown device (err=-19)
Oct 29 00:58:33 mainsailos kernel: [ 6458.443138] usb 1-1.2: new full-speed USB device number 35 using xhci_hcd
Oct 29 00:58:33 mainsailos kernel: [ 6458.589189] usb 1-1.2: New USB device found, idVendor=1d50, idProduct=6177, bcdDevice= 1.00
Oct 29 00:58:33 mainsailos kernel: [ 6458.589210] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 29 00:58:33 mainsailos kernel: [ 6458.589226] usb 1-1.2: Product: stm32f446xx
Oct 29 00:58:33 mainsailos kernel: [ 6458.589241] usb 1-1.2: Manufacturer: CanBoot
Oct 29 00:58:33 mainsailos kernel: [ 6458.589256] usb 1-1.2: SerialNumber: 170038000650314D35323820
Oct 29 00:58:34 mainsailos kernel: [ 6458.596299] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device

The board is now available as a serial usb device and can be flashed with

master ✔ $ python3 flash_can.py -f ~/firmware/octopus_1.1_klipper.bin -d /dev/serial/by-id/usb-CanBoot_stm32f446xx_170038000650314D35323820-if00                                               130 ↵
Attempting to connect to bootloader
CanBoot Connected
Protocol Version: 1.0.0
Block Size: 64 bytes
Application Start: 0x8008000
MCU type: stm32f446xx
Flashing '/home/pi/firmware/octopus_1.1_klipper.bin'...

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

Write complete: 2 pages
Verifying (block count = 446)...

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

Verification Complete: SHA = 5BF4BBAF365293CB52CB338FD720F766B16B1EF1
CAN Flash Success

The board restart immediately on klipper with the can0 interface working.

Oct 29 01:01:10 mainsailos kernel: [ 6615.572625] usb 1-1.2: USB disconnect, device number 35
Oct 29 01:01:11 mainsailos kernel: [ 6615.866358] usb 1-1.2: new full-speed USB device number 36 using xhci_hcd
Oct 29 01:01:11 mainsailos kernel: [ 6616.007819] usb 1-1.2: New USB device found, idVendor=1d50, idProduct=606f, bcdDevice= 0.00
Oct 29 01:01:11 mainsailos kernel: [ 6616.007829] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 29 01:01:11 mainsailos kernel: [ 6616.007837] usb 1-1.2: Product: stm32f446xx
Oct 29 01:01:11 mainsailos kernel: [ 6616.007844] usb 1-1.2: Manufacturer: Klipper
Oct 29 01:01:11 mainsailos kernel: [ 6616.007851] usb 1-1.2: SerialNumber: 170038000650314D35323820
Oct 29 01:01:11 mainsailos kernel: [ 6616.012563] gs_usb 1-1.2:1.0: Configuring for 1 interfaces
Oct 29 01:01:11 mainsailos kernel: [ 6616.186506] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready

akhamar avatar Oct 28 '22 23:10 akhamar

The issue called out is issues flashing the EBB42 with CanBoot.

Flashing the Octopus (when using it as a CAN bus bridge, Klipper), you will not be able to do this because CanBoot doesn't support the CAN bus bridge mode.

When trying to flash using CanBoot via CAN bus will not work because Klipper on the MCU will not be running; therefore, the CAN bus bridge will not be running.

So you will always be required to use the USB to flash CanBoot or Klipper CAN bus bridge.

If you were using a CAN hat or USB to CAN bus adapter, you would be able to flash over the CAN bus.

NAPCAL avatar Oct 28 '22 23:10 NAPCAL

Ok I though the problematic was the same, but as you said it's definitely something else. And you are probably right, since the octopus is in bridge mode.

akhamar avatar Oct 28 '22 23:10 akhamar

When having to flash via USB, CanBoot will have a different USB ID than Klipper.

If you setup CanBoot with the quick double click of the reset to jump into firmware loading. Then quick double click the reset will get you into that mode.

Then using the CanBoot USB ID, you can flash the Octopus with Klipper.

I store my CanBoot ID in my printer.cfg as a comment for easy access.

NAPCAL avatar Oct 28 '22 23:10 NAPCAL

I was going to try to flash the U2C V2 (STM32G0B1) with Klipper in CAN bus bridge mode to see if this would correct the issue, but BTT is using (PB5 RX and PB6 TX), and these are not selectable CAN bus pins under Klipper.

As I see it right now, it is a common issue with U2C V2 and CanBoot, there is no issues with the U2C V1's.

NAPCAL avatar Nov 05 '22 14:11 NAPCAL

Confirming I had the same issue using G0B1_U2C_fw on my u2c v2.1 with ebb36 v1.2, the firmware transfer itself fails and then the canboot ebb becomes non responsive until I re program with cube programmer. issue not observed with U2C v1.1

jmeier5261 avatar Nov 20 '22 18:11 jmeier5261

I can confirm that the issue occurred with U2C 2.1 but not with the 1.0. I had the U2C 2.1 on two different printers, both with EBB36 1.2, and had issues with flashing and using canbus speeds above 250k. Switched both to U2C v1. 0 and was able to flash without issue and run 1MB canbus speed.

e2p2 avatar Nov 27 '22 19:11 e2p2

It sounds like the STM32G0 variants of the U2C cant handle the somewhat larger transfers required to upload firmware...in fact it appears that these devices have general communications issues.

There does appear to be a fork of CandleLight for the G0. If someone is feeling adventurous you could try following these instructions to build and flash it to a U2C v2.1.

Arksine avatar Nov 27 '22 20:11 Arksine

It sounds like the STM32G0 variants of the U2C cant handle the somewhat larger transfers required to upload firmware...in fact it appears that these devices have general communications issues.

There does appear to be a fork of CandleLight for the G0. If someone is feeling adventurous you could try following these instructions to build and flash it to a U2C v1.1.

I have a spare u2c v2.1 and ebb36 v1.2. I’ll try the above and report back

jmeier5261 avatar Nov 27 '22 20:11 jmeier5261

I've tried the candlelight fork on a U2C 2.1 and it didn't help,. That fork hasn't been updated in 5 months.

e2p2 avatar Nov 27 '22 20:11 e2p2

If candlelight doesn't work I added 100% untested support for pins PB5 and PB6 to Klipper here. You can add my fork as a Klipper remote and checkout the dev-stm32g0-can-pins branch, configure and build Klipper in USB to CanBridge mode, then flash the U2C V2.1.

Note: I suspect that this would require adding the U2C V2.1 as an mcu in printer.cfg to work.

Arksine avatar Nov 27 '22 21:11 Arksine

I think the issue is with the BTT U2C V2 firmware trying to use FDCAN for file transfers or not settling this up correctly since the rest of the bus is non-FD.

It seems to be only with binary data transfers, all other communications works.

NAPCAL avatar Nov 27 '22 21:11 NAPCAL

If candlelight doesn't work I added 100% untested support for pins PB5 and PB6 to Klipper here. You can add my fork as a Klipper remote and checkout the dev-stm32g0-can-pins branch, configure and build Klipper in USB to CanBridge mode, then flash the U2C V2.1.

Note: I suspect that this would require adding the U2C V2.1 as an mcu in printer.cfg to work.

I tried flashing the U2C 2.1 board with klipper in usb to can bridge using your fork. I could not get it to see anything on the can network. Since BTT has not published the code for the u2c 2.1 board, it makes it hard to see what they used / changed. I suspect that the U2C 2.1 board is using FDCAN which is causing the transfer issues that NAPCAL mentioned.

garrettwp avatar Dec 01 '22 16:12 garrettwp

I seem to be having the same issue with the U2C 2.1 and EBB42 v1.1. Was going to send back my EBB thinking it was bad (got it already opened from amazon) but if I'm reading the comments right it is a problem with the U2C, is that correct?

My PI4 recognizes everything all the way up to flashing Klipper then I get the following error. After I get 0 UUIDs found until I reinstall canboot.

`pi@fluiddpi:~/klipper $ python3 ~/CanBoot/scripts/flash_can.py -i can0 -f ~/klipper/out/klipper.bin -u 793da0714a5e Sending bootloader jump command... Resetting all bootloader node IDs... Checking for canboot nodes... Detected UUID: 793da0714a5e, 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'...

[####ERROR:root:Can Read Error Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/streams.py", line 632, in readuntil await self._wait_for_data('readuntil') File "/usr/lib/python3.9/asyncio/streams.py", line 517, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/pi/CanBoot/scripts/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/CanBoot/scripts/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/streams.py", line 632, in readuntil await self._wait_for_data('readuntil') File "/usr/lib/python3.9/asyncio/streams.py", line 517, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/pi/CanBoot/scripts/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/CanBoot/scripts/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/streams.py", line 632, in readuntil await self._wait_for_data('readuntil') File "/usr/lib/python3.9/asyncio/streams.py", line 517, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/pi/CanBoot/scripts/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/CanBoot/scripts/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/streams.py", line 632, in readuntil await self._wait_for_data('readuntil') File "/usr/lib/python3.9/asyncio/streams.py", line 517, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/pi/CanBoot/scripts/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/CanBoot/scripts/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/streams.py", line 632, in readuntil await self._wait_for_data('readuntil') File "/usr/lib/python3.9/asyncio/streams.py", line 517, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/pi/CanBoot/scripts/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/CanBoot/scripts/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/streams.py", line 632, in readuntil await self._wait_for_data('readuntil') File "/usr/lib/python3.9/asyncio/streams.py", line 517, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/pi/CanBoot/scripts/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/CanBoot/scripts/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/streams.py", line 632, in readuntil await self._wait_for_data('readuntil') File "/usr/lib/python3.9/asyncio/streams.py", line 517, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/pi/CanBoot/scripts/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/CanBoot/scripts/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/streams.py", line 632, in readuntil await self._wait_for_data('readuntil') File "/usr/lib/python3.9/asyncio/streams.py", line 517, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/pi/CanBoot/scripts/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/CanBoot/scripts/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError ERROR:root:Can Read Error Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/streams.py", line 632, in readuntil await self._wait_for_data('readuntil') File "/usr/lib/python3.9/asyncio/streams.py", line 517, in _wait_for_data await self._waiter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/asyncio/tasks.py", line 492, in wait_for fut.result() asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/pi/CanBoot/scripts/flash_can.py", line 137, in send_command ret = await self.node.readuntil() File "/home/pi/CanBoot/scripts/flash_can.py", line 287, in readuntil return await asyncio.wait_for(self._reader.readuntil(sep), timeout) File "/usr/lib/python3.9/asyncio/tasks.py", line 494, in wait_for raise exceptions.TimeoutError() from exc asyncio.exceptions.TimeoutError ERROR:root:Can Flash Error Traceback (most recent call last): File "/home/pi/CanBoot/scripts/flash_can.py", line 469, in run await flasher.send_file() File "/home/pi/CanBoot/scripts/flash_can.py", line 207, in send_file resp = await self.send_command('SEND_BLOCK', prefix + buf) File "/home/pi/CanBoot/scripts/flash_can.py", line 186, in send_command raise FlashCanError("Error sending command [%s] to Can Device" FlashCanError: Error sending command [SEND_BLOCK] to Can Device

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/CanBoot/scripts/flash_can.py", line 609, in main loop.run_until_complete(sock.run(intf, uuid, fpath)) File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/home/pi/CanBoot/scripts/flash_can.py", line 475, in run await flasher.finish() File "/home/pi/CanBoot/scripts/flash_can.py", line 265, in finish await self.send_command("COMPLETE") File "/home/pi/CanBoot/scripts/flash_can.py", line 186, in send_command raise FlashCanError("Error sending command [%s] to Can Device" FlashCanError: Error sending command [COMPLETE] to Can Device `

Rick88Stang avatar Dec 02 '22 17:12 Rick88Stang

Yes, it is an issue only with the U2C V2.x G0B1 and binary transfers.

NAPCAL avatar Dec 02 '22 17:12 NAPCAL