Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Norbs12 opened this issue Oct 13, 2022 · 75 comments
Closed

Comments

@Norbs12
Copy link

Norbs12 commented Oct 13, 2022

EDIT: This turned out to be a issue with the BTT U2C v2.1, a new firmware was released which addresses this issue. I'm closing this out. Here is the link to the firmware which was posted by BTT below.

Firmware link:
https://github.com/Arksine/CanBoot/files/10410265/G0B1_U2C_V2.zip

Comment from BTT that solved this:
#44 (comment)

--------- Original post below ---------

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.

@rbrtwtrs
Copy link

rbrtwtrs commented Oct 13, 2022

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 $

@NAPCAL
Copy link

NAPCAL commented Oct 13, 2022

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.

@Norbs12
Copy link
Author

Norbs12 commented Oct 13, 2022

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

@ChipTheCat
Copy link

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.

@Norbs12
Copy link
Author

Norbs12 commented Oct 14, 2022

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.

@rbrtwtrs
Copy link

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

@rbrtwtrs
Copy link

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 $

@NAPCAL
Copy link

NAPCAL commented Oct 14, 2022

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.

@rbrtwtrs
Copy link

rbrtwtrs commented Oct 14, 2022 via email

@Norbs12
Copy link
Author

Norbs12 commented Oct 16, 2022

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

@NAPCAL
Copy link

NAPCAL commented Oct 16, 2022

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.

@Norbs12
Copy link
Author

Norbs12 commented Oct 16, 2022

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.

@Cova
Copy link

Cova commented Oct 27, 2022

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.

@akhamar
Copy link

akhamar commented Oct 28, 2022

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
Copy link

akhamar commented Oct 28, 2022

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
Copy link

akhamar commented Oct 28, 2022

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

@NAPCAL
Copy link

NAPCAL commented Oct 28, 2022

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.

@akhamar
Copy link

akhamar commented Oct 28, 2022

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.

@NAPCAL
Copy link

NAPCAL commented Oct 28, 2022

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
Copy link

NAPCAL commented Nov 5, 2022

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.

@Norbs12 Norbs12 changed the title Flashing over CAN not working with Big Tree Tech EBB36 v1.2 Flashing over CAN not working with Big Tree Tech EBB36 v1.2 from BTT U2C v2.1 Nov 8, 2022
@jmeier5261
Copy link

jmeier5261 commented Nov 20, 2022

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

@e2p2
Copy link

e2p2 commented Nov 27, 2022

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.

@Arksine
Copy link
Owner

Arksine commented Nov 27, 2022

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.

@jmeier5261
Copy link

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

@e2p2
Copy link

e2p2 commented Nov 27, 2022

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.

@Arksine
Copy link
Owner

Arksine commented Nov 27, 2022

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.

@NAPCAL
Copy link

NAPCAL commented Nov 27, 2022

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.

@garrettwp
Copy link

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.

@Rick88Stang
Copy link

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
`

@NAPCAL
Copy link

NAPCAL commented Jan 13, 2023

@garrettwp revise step 6 (see below); the U2C’s don’t have a reset button; it is a boot button.

image

Press and hold the boot button on the u2c and plug the usb cable back in, then release the boot button.

@garrettwp
Copy link

Thanks for the catch! I have updated it.

@EricZimmerman
Copy link

confirming this worked. flashed u2c with attached firmware per directions.
CANBOOT'ed ebb36 1.2
flashed klipper via CANBOOT to ebb

everything is up

@e2p2
Copy link

e2p2 commented Jan 13, 2023

@bigtreetech, can you supply any details about what was changed in the supplied firmware? Perhaps a link to the source?

@bigtreetech
Copy link

@bigtreetech, can you supply any details about what was changed in the supplied firmware? Perhaps a link to the source?

  1. The main frequency of mcu is set to 64Mhz
  2. disable USB bulk_doublebuffer_enable
    The source file is here.
    https://github.com/bigtreetech/candleLight_fw/commits/stm32g0_support

@lakai
Copy link

lakai commented Jan 15, 2023

G0B1_U2C_V2.zip

For users who encounter the canboot programming problem of U2C V2 version , please update the firmware of U2C V2 to this file for testing. This file is a compressed file. After decompression, there will be a .bin binary file, which can be directly programed to U2C V2 by DFU

@Rick88Stang Hello. can you test this?

@bigtreetech confirmed working and am able to flash two different ebb36 1.2 over can with a U2C2.1

Thank you!

@Norbs12 Norbs12 closed this as completed Jan 15, 2023
@fredkelly
Copy link

fredkelly commented Jan 15, 2023

Sorry to reopen this thread- this has been by far the most helpful on getting my U2C v2.1 working. I have tried the attached G0B1_U2C_V2.zip but get an error when using the suggested command to flash:

pi@fluiddpi-ender5:~ $ sudo dfu-util -D G0B1_U2C_V2.bin -d 0483:df11 -a 0 -s 0x08000000:leave
[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: File too short for DFU suffix
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 = dfuDNLOAD-IDLE, status = 0
aborting previous incomplete transfer
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   "
Downloading to address = 0x08000000, size = 0
dfu-util: Last page at 0x07ffffff is not writeable

I had previously flashed CanBoot using dfu-util without issue so I'm not sure if this is me or the file itself?

Edit: my device shows three alternatives when in dfu mode:

pi@fluiddpi-ender5:~ $ dfu-util -l
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/

Found DFU: [0483:df11] ver=0200, devnum=2, cfg=1, intf=0, path="1-1", alt=2, name="@Internal Flash   /0x08000000/64*02Kg", serial="2042394D5542"
Found DFU: [0483:df11] ver=0200, devnum=2, cfg=1, intf=0, path="1-1", alt=1, name="@Internal Flash   /0x08000000/64*02Kg", serial="2042394D5542"
Found DFU: [0483:df11] ver=0200, devnum=2, cfg=1, intf=0, path="1-1", alt=0, name="@Internal Flash   /0x08000000/64*02Kg", serial="2042394D5542"

@NAPCAL
Copy link

NAPCAL commented Jan 15, 2023

Try this command:

sudo dfu-util -a 0 -D G0B1_U2C_V2.bin --dfuse-address 0x08000000:force:mass-erase:leave -d 0483:df11

Also, if you want to upgrade your dfu-util from 0.9 to 0.11 do the following:

git clone git://git.code.sf.net/p/dfu-util/dfu-util
cd dfu-util
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install

@e2p2
Copy link

e2p2 commented Jan 15, 2023

Here are instructions that were adapted from some previously posted on discord to build and use make flash.
This is using the referenced github that BTT posted.

sudo apt-get install cmake gcc-arm-none-eabi git
cd ~
# if you have a previously downloaded a differet candlelight_fw repo you will need to first do "rm -r candleLight_fw"
git clone https://github.com/bigtreetech/candleLight_fw
cd candleLight_fw
git checkout stm32g0_support
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/gcc-arm-none-eabi-8-2019-q3-update.cmake
make G0B1_U2C_fw

after this, plug a usb-c cable to the rpi.
enter dfu mode: while pressing the BOOT button of the u2c connect the usb-c cable.

make flash-G0B1_U2C_fw

disconnect the usb cable from the u2c and reconnect. it should now be working.

@NAPCAL
Copy link

NAPCAL commented Jan 15, 2023

@bigtreetech, can you supply any details about what was changed in the supplied firmware? Perhaps a link to the source?

  1. The main frequency of mcu is set to 64Mhz

  2. disable USB bulk_doublebuffer_enable

The source file is here.

https://github.com/bigtreetech/candleLight_fw/commits/stm32g0_support

@e2p2 did you use this altered code provided by BigTreeTech? I only ask because the link you provided doesn't match BTT's.

@e2p2
Copy link

e2p2 commented Jan 15, 2023

I'll freely admit my knowledge of github is Google based. As I understand it to access a branch you have to connect to the primary repo then checkout the needed commit branch. So the git clone is for https://github.com/bigtreetech/candleLight_fw then the git checkout stm32g0_support switches to the appropriate branch.

@fredkelly
Copy link

fredkelly commented Jan 16, 2023

@e2p2 thanks for sharing the instructions. Broadly this is what I had already tried (checking out and building the stm32g0_support branch. I however ran make candleLight_fw and make flash-candleLight_fw. I tried using your instruction but found that wasn't recognised - am I missing something?

pi@fluiddpi-ender5:~/candleLight_fw/build $ make G0B1_U2C_fw
make: *** No rule to make target 'G0B1_U2C_fw'.  Stop.

Edit: just to confirm - I am in the branch and can't see either of those U2C build targets:

pi@fluiddpi-ender5:~/candleLight_fw/build $ git status
On branch stm32g0_support
Your branch is up to date with 'origin/stm32g0_support'.

nothing to commit, working tree clean
pi@fluiddpi-ender5:~/candleLight_fw/build $ make flash-G0B1_U2C_fw
make: *** No rule to make target 'flash-G0B1_U2C_fw'.  Stop.

@e2p2
Copy link

e2p2 commented Jan 16, 2023

This did work before BTT made their latest updates to the branch. I used these commands in December to build the G0B1 bin and the build process worked. My mistake for not testing it and assuming the previous commands would work. Digging through the code it appears the only target left that uses the G0B1 chip is called budgetcan_fw. @bigtreetech, can you please provide the correct process to build (and flash) G0B1_U2C_V2.bin using the referenced branch?

@NAPCAL
Copy link

NAPCAL commented Jan 16, 2023

@e2p2 BigTreeTech posted 3d ago

G0B1_U2C_V2.zip

For users who encounter the canboot programming problem of U2C V2 version , please update the firmware of U2C V2 to this file for testing. This file is a compressed file. After decompression, there will be a .bin binary file, which can be directly programed to U2C V2 by DFU

BigTreeTech commented 2d ago

  1. The main frequency of mcu is set to 64Mhz

  2. disable USB bulk_doublebuffer_enable

The source file is here.

https://github.com/bigtreetech/candleLight_fw/commits/stm32g0_support

@e2p2
Copy link

e2p2 commented Jan 16, 2023

@NAPCAL, That is just the commits page showing the change log. Until BTT provides the correct build process we have no choice but to use the provided BIN file.

@NAPCAL
Copy link

NAPCAL commented Jan 16, 2023

@e2p2 Try this
git clone -b stm32g0_support --single-branch https://github.com/bigtreetech/candleLight_fw.git

sudo apt-get install gcc-arm-none-eabi

mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/gcc-arm-none-eabi-8-2019-q3-update.cmake

make budgetcan_fw

budgetcan is the board type name that BTT has added for the G0B1.

@e2p2
Copy link

e2p2 commented Jan 16, 2023

My previous commands would work as well substituting "make budgetcan_fw" for "make G0B1_U2C_fw" and "make flash-budgetcan_fw" for "make flash-G0B1_U2C_fw". I am just not certain that budgetcan_fw is the U2C v2. Budgetcan_fw does use the G0B1 chip but it may not be the correct device.

@fredkelly
Copy link

Interestingly using the budgetcan_fw does seem to have improved things, I'm no longer getting errors running canbus_query.py and also dfu-util -l shows a device detected (not in DFU mode):

pi@fluiddpi-ender5:~ $ dfu-util -l
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: Cannot open DFU device 1d50:606f
pi@fluiddpi-ender5:~ $ ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
Total 0 uuids found

I need to test further but have to head out, will report back later. Incidentally, I didn't mention in my original post but my U2C has a blue light constantly illuminated. All the tutorials state that the blue light should only be on in DFU mode - is this a v2.1 thing or perhaps a sign of faulty hardware?

@e2p2
Copy link

e2p2 commented Jan 16, 2023

Using "make budgetcan_fw" and "make flash-budgetcan_fw" I was able to build working firmware for and flash firmware to the U2C v2.1. I was then able to run my firmware update script to update klipper for the controller board and then the EBB over canbus with no errors. I would still appreciate @bigtreetech chiming in to confirm this is correct. I will try some print jobs to make sure canbus communication is stable. Here is the update build commands so they are in one place...

sudo apt-get install cmake gcc-arm-none-eabi git
cd ~
# if you have a previously downloaded a differet candlelight_fw repo you will need to first do "rm -r candleLight_fw"
git clone https://github.com/bigtreetech/candleLight_fw
cd candleLight_fw
git checkout stm32g0_support
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/gcc-arm-none-eabi-8-2019-q3-update.cmake
make budgetcan_fw

after this, plug a usb-c cable to the rpi.
enter dfu mode: while pressing the BOOT button of the u2c connect the usb-c cable.

make flash-budgetcan_fw

disconnect the usb cable from the u2c and reconnect. it should now be working.

@e2p2
Copy link

e2p2 commented Jan 17, 2023

Two back to back prints with no issues. Seems very stable

@fredkelly
Copy link

Awesome. I managed to get my communication up and running using this (though flashing Klipper to the EBB via the U2C took a few attempts). Seems to be functioning okay now but I need to re-assemble the printer and run some test prints.

Many thanks for all the help here!

@sammcj
Copy link

sammcj commented Apr 21, 2023

FYI looks like @bigtreetech have broken their repo again:

build <stm32g0_support>:# make budgetcan_fw                                                                                                                                             
make: *** No rule to make target 'budgetcan_fw'.  Stop.

I have found this fork + branch combo that seems to work - though it does show up 2 can interfaces which is interesting:

https://github.com/marckleinebudde/candleLight_fw/tree/multichannel

[Fri Apr 21 19:16:39 2023] usb 1-1.1: new full-speed USB device number 21 using ehci-platform
[Fri Apr 21 19:16:40 2023] usb 1-1.1: New USB device found, idVendor=0483, idProduct=df11, bcdDevice= 2.00
[Fri Apr 21 19:16:40 2023] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Fri Apr 21 19:16:40 2023] usb 1-1.1: Product: DFU in FS Mode
[Fri Apr 21 19:16:40 2023] usb 1-1.1: Manufacturer: STMicroelectronics
[Fri Apr 21 19:16:40 2023] usb 1-1.1: SerialNumber: 207B32535841
[Fri Apr 21 19:16:47 2023] usb 1-1.1: reset full-speed USB device number 21 using ehci-platform
[Fri Apr 21 19:16:49 2023] usb 1-1.1: USB disconnect, device number 21
[Fri Apr 21 19:16:52 2023] usb 1-1.1: new full-speed USB device number 22 using ehci-platform
[Fri Apr 21 19:16:52 2023] usb 1-1.1: New USB device found, idVendor=1d50, idProduct=606f, bcdDevice= 0.00
[Fri Apr 21 19:16:52 2023] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Fri Apr 21 19:16:52 2023] usb 1-1.1: Product: budgetcan gs_usb
[Fri Apr 21 19:16:52 2023] usb 1-1.1: Manufacturer: budgetcan
[Fri Apr 21 19:16:52 2023] usb 1-1.1: SerialNumber: 004400205841500C20373233
[Fri Apr 21 19:16:52 2023] gs_usb 1-1.1:1.0: Configuring for 2 interfaces
[Fri Apr 21 19:16:53 2023] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready
8: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP group default qlen 1024
    link/can
9: can1: <NOARP,ECHO> mtu 16 qdisc noop state DOWN group default qlen 10
    link/can

@stahlfabrik
Copy link

Hmmm. Why is the bin in the zip file above from Bigtreetech 130kB in size. While on their GitHub there seems to be a firmware file that ist just 20kB in size.

https://github.com/bigtreetech/U2C/blob/master/firmware/U2C_V2_STM32G0B1.bin

The git history even says: "update U2C V2 G0B1 firmware, fix Canboot error" so it should be the correct file, right?

@bigtreetech What is the correct file to update the V2.1 today?

@NAPCAL
Copy link

NAPCAL commented Aug 16, 2023

Yes, that is the correct one for U2C with a G0B1 STM, don't use if yours is a F072 STM.

@stahlfabrik
Copy link

Thank you - update went through - I still have yet to connect the SB2209 though...:-)

@FlySpot
Copy link

FlySpot commented Apr 20, 2024

Does anybody get the error dfu-util: Last page at 0x0806c5d1 is not writeable with flashing last BTT firmware to the BTT U2C board? I have board on the STM32G0B1 and the file https://github.com/bigtreetech/U2C/blob/master/firmware/U2C_V2_STM32G0B1.bin is over 407kB size. Oposit of it the firmware from the https://github.com/Esoterical/voron_canbus/tree/main/can_adapter/BigTreeTech%20U2C%20v2.1 has only 127kB and it can be successfully uploaded but in result it gives me 'bytes_invalid' during homing.
Can somebody suggest how to flash the firmware from BTT to the U2C? Thanks a lot in advance.

` sudo dfu-util -a 0 -D U2C_V2_STM32G0B1.bin --dfuse-address 0x08000000:force:mass-erase:leave -d 0483:df11
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 = dfuDNLOAD-IDLE, status = 0
aborting previous incomplete transfer
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 = 443858
dfu-util: Last page at 0x0806c5d1 is not writeable`

@NAPCAL
Copy link

NAPCAL commented Apr 20, 2024

The last firmware that I know that worked is this one. G0B1_U2C_V2
Extract the .bin file and transfer it to your home directory on the RPi or clone.

To get the U2C into DFU mode.

  • Unplug the U2C from all connections, including the USBC.
  • Ensure the USBA of the USBC cable is plugged into your RPi or clone.
  • While holding down the boot button, plug in the USBC cable.
  • Release the boot button.
  • Check if your RPi or clone sees the U2C in DFU mode by entering the command lsusb
  • Look for STM and DFU in the output on the same line; if not, try again putting the U2C in DFU mode.
  • copy this command and paste it into your ssh terminal

sudo dfu-util -a 0 -D ~/G0B1_U2C_V2.bin --dfuse-address 0x08000000:force:mass-erase -d 0483:df11

If successful, disconnect the USBC cable from the U2C, then reconnect it.

Note: the U2C is not a Klipper device, so it will not appear as a serial device. It will only show via the lsusb command as 'OpenMoko, Inc. Geschwister Schneider CAN adapter'

If you see that in the output, it is connected and operational.

Check with network command to see if can0 is up and running; if not, you need to make sure to follow one of my CAN guides.

@FlySpot
Copy link

FlySpot commented Apr 22, 2024

The last firmware that I know that worked is this one. G0B1_U2C_V2 Extract the .bin file and transfer it to your home directory on the RPi or clone.

To get the U2C into DFU mode.

  • Unplug the U2C from all connections, including the USBC.
  • Ensure the USBA of the USBC cable is plugged into your RPi or clone.
  • While holding down the boot button, plug in the USBC cable.
  • Release the boot button.
  • Check if your RPi or clone sees the U2C in DFU mode by entering the command lsusb
  • Look for STM and DFU in the output on the same line; if not, try again putting the U2C in DFU mode.
  • copy this command and paste it into your ssh terminal

sudo dfu-util -a 0 -D ~/G0B1_U2C_V2.bin --dfuse-address 0x08000000:force:mass-erase -d 0483:df11

If successful, disconnect the USBC cable from the U2C, then reconnect it.

Note: the U2C is not a Klipper device, so it will not appear as a serial device. It will only show via the lsusb command as 'OpenMoko, Inc. Geschwister Schneider CAN adapter'

If you see that in the output, it is connected and operational.

Check with network command to see if can0 is up and running; if not, you need to make sure to follow one of my CAN guides.

Thanks NAPCAL it successfully flashed but still have issue Communication timeout during homing x it works for Y axis but not for the X.

UPD: Change the TRSYNC_TIMEOUT = 0.05 in the klippy/mcu.py helped to fix the timeout during homing.

@NAPCAL
Copy link

NAPCAL commented Apr 22, 2024

Check the 24V power at the EBB connector with a meter to see if it stays stable during homing, and string some wires just temporarily for the meter.

Also, with the power off check the CAN bus wiring during movement like it was homing.

Use this table to check for each failure condition.

CAN-bus-phyical-layer-debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests