bigtreetech / U2C

115 stars 19 forks source link

Klipper USB to CAN not working with v2.1 #4

Open Eisbaeeer opened 1 year ago

Eisbaeeer commented 1 year ago

I waste 4 days to get 'not' running your usb-2-can adapter. CanBoot is not working (working with version 1.1 fine). CanBoot is also not working. Please provide working settings or CanBoot and Klipper.

gabber130779 commented 1 year ago

Me and a couple of friends tried to find out what the problem is. In our opinion, the CAN bus pins are incorrectly specified. According to bigtreetech, it's pins PB8/PB9. We think it's pins PB5/PB6. Someone should make a pull request for this.

johnlettman commented 1 year ago

I have a U2C attached to an SB2209. Unfortunately, like you, I have spent approximately 4-5 days attempting to understand the problem with CAN communication.

I got it working. Here's how I did it.

Part 1: Updating U2C firmware

  1. Install dfu-utils, e.g.
    sudo apt update
    sudo apt install -y dfu-utils
  2. Enter DFU mode on the U2C:
    • remove the USB-C connection from the U2C
    • press and hold the boot button
    • install the USB-C connection to the U2C while continuing to hold the boot button
    • release the boot button
  3. Inspect lsusb and dfu-util for the U2C device in DFU mode, and ensure it's the only one. Keep a hold of the serial (device serial ID) portion; in this example, it is 123456ABCDEF:
    
    lsusb
    # [...]
    # Bus 001 Device 006: ID 0483:df11 STMicroelectronics STM Device in DFU Mode

dfu-util -l

[...]

dfu-util: Cannot open DFU device 1d50:606f

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

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

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

4. Download the latest firmware for the U2C V2.1, [U2C_V2_STM32G0B1.bin](https://github.com/bigtreetech/U2C/blob/master/firmware/U2C_V2_STM32G0B1.bin), e.g.
```bash
wget https://github.com/bigtreetech/U2C/raw/master/firmware/U2C_V2_STM32G0B1.bin
  1. Flash the latest firmware for the U2C V2.1, e.g.
    dfu-util -D ./U2C_V2_STM32G0B1.bin -s"123456ABCDEF", -a 0 -s 0x08000000:leave

Part 2: Installing the U2C jumper

The 120R jumper is vitally important for a singular 1-to-1 U2C-to-print head connection.

  1. Shutdown all power input to the U2C to be safe, e.g. unplug the printer.
  2. Install a jumper on the 120R header. In the image below, it is labeled MCU-CAN-12R: U2C pinout
  3. Restore power to the U2C.
gabber130779 commented 1 year ago

Can you now use CanBoot?

johnlettman commented 1 year ago

@gabber130779 Yes, provided CanBoot is installed on the target CAN device.

You will need to build CanBoot for the target device (e.g., the SB2209). Afterwards, using my OP, do Steps 3 and 5 in Part 1 to flash CanBoot on the device . Change the -D ./U2C_V2_STM32G0B1.bin argument given to dfu-util to point to the newly built CanBoot binary.

Eisbaeeer commented 1 year ago

This not solved the problem of updating firmware on CAN-bus. After getting Canboot flashed on U2C device (this was also working on my setup) you are not able to push the firmware to other devices with Canboot on the bus. All other devices on CANbus should given his unique ID. But after flashing the U2C device via CANBoot, the U2C does not show any ID on the bus. Im sure that the other CPU in v2.1 is the issue. I given it up and flashed candlelight. This works well.

gabber130779 commented 1 year ago

hey guys, now i can say we found a solution for the CanBoot problem with the U2C. There will be soon a Pull Request on Klipper GitHub.

gabber130779 commented 1 year ago

@Eisbaeeer @johnlettman if you want, you can try it with the attached firmware. U2C Klipper Firmware CanBoot.zip

eXrshock commented 1 year ago

Hello folks, the U2C now works with CanBoot. The documentation should be adapted accordingly.

In version 2.1, the CAN pins are on PB5/PB6.

Here is my CanBoot config: image

Here is my Klipper config: image

This is extremely poorly documented, the BIQU support doesn't understand the problem either, so you don't get any help.

Creo2005 commented 1 year ago

Hello folks, the U2C now works with CanBoot. The documentation should be adapted accordingly.

In version 2.1, the CAN pins are on PB5/PB6.

Here is my CanBoot config: image

Here is my Klipper config: image

This is extremely poorly documented, the BIQU support doesn't understand the problem either, so you don't get any help.

Good afternoon Your settings didn't work for me After make firmware canboot I flash with sudo dfu-util -a 0 -D ~/CanBoot/out/canboot.bin -s 0x08000000:mass-erase:force:leave after this make klipper and flash with sudo dfu-util -a 0 -D ~/klipper/out/klipper.bin -s 0x08008000:mass-erase:force:leave but now U2C connect to host only in DFU Please write how to properly flash the canboot and then klipper. Thank you in advance.

Creo2005 commented 1 year ago

Hello folks, the U2C now works with CanBoot. The documentation should be adapted accordingly. In version 2.1, the CAN pins are on PB5/PB6. Here is my CanBoot config: image Here is my Klipper config: image This is extremely poorly documented, the BIQU support doesn't understand the problem either, so you don't get any help.

Good afternoon Your settings didn't work for me After make firmware canboot I flash with sudo dfu-util -a 0 -D ~/CanBoot/out/canboot.bin -s 0x08000000:mass-erase:force:leave after this make klipper and flash with sudo dfu-util -a 0 -D ~/klipper/out/klipper.bin -s 0x08008000:mass-erase:force:leave but now U2C connect to host only in DFU Please write how to properly flash the canboot and then klipper. Thank you in advance.

Снимок экрана 2023-07-08 в 15 47 00 And the question why enable this option? if there is no reset button on u2с :) And how to enter the bootloader without a reset button? Thanks.

gabber130779 commented 1 year ago

https://github.com/docgalaxyblock/KlipperMisc/blob/main/CAN/BigTreeTech-U2C/README.md

Creo2005 commented 1 year ago

https://github.com/docgalaxyblock/KlipperMisc/blob/main/CAN/BigTreeTech-U2C/README.md

I wanted to know how @eXrshock did

eXrshock commented 1 year ago

Hello folks, the U2C now works with CanBoot. The documentation should be adapted accordingly. In version 2.1, the CAN pins are on PB5/PB6. Here is my CanBoot config: image Here is my Klipper config: image This is extremely poorly documented, the BIQU support doesn't understand the problem either, so you don't get any help.

Good afternoon Your settings didn't work for me After make firmware canboot I flash with sudo dfu-util -a 0 -D ~/CanBoot/out/canboot.bin -s 0x08000000:mass-erase:force:leave after this make klipper and flash with sudo dfu-util -a 0 -D ~/klipper/out/klipper.bin -s 0x08008000:mass-erase:force:leave but now U2C connect to host only in DFU Please write how to properly flash the canboot and then klipper. Thank you in advance.

Снимок экрана 2023-07-08 в 15 47 00 And the question why enable this option? if there is no reset button on u2с :) And how to enter the bootloader without a reset button? Thanks.

Hi @Creo2005 ,

I had apparently accidentally left this option active.

To activate the boot mode, you have to hold down the boot button and establish the USB connection.

Regards

Creo2005 commented 1 year ago

Hi @Creo2005 ,

I had apparently accidentally left this option active.

To activate the boot mode, you have to hold down the boot button and establish the USB connection.

Regards

If hold the BOOT button and establish a usb connection, the board will connect in DFU mode.

Creo2005 commented 1 year ago

Hello folks, the U2C now works with CanBoot. The documentation should be adapted accordingly. In version 2.1, the CAN pins are on PB5/PB6. Here is my CanBoot config: image Here is my Klipper config: image This is extremely poorly documented, the BIQU support doesn't understand the problem either, so you don't get any help.

Good afternoon Your settings didn't work for me After make firmware canboot I flash with sudo dfu-util -a 0 -D ~/CanBoot/out/canboot.bin -s 0x08000000:mass-erase:force:leave after this make klipper and flash with sudo dfu-util -a 0 -D ~/klipper/out/klipper.bin -s 0x08008000:mass-erase:force:leave but now U2C connect to host only in DFU Please write how to properly flash the canboot and then klipper. Thank you in advance.

@eXrshock What am I doing wrong here?

eXrshock commented 1 year ago

https://github.com/docgalaxyblock/KlipperMisc/blob/main/CAN/BigTreeTech-U2C/README.md

@Creo2005 The easiest way is to follow the instructions that Gabber posted.

Scroll up to "Klipper USB-to-CAN adapter (advanced way)"

That's exactly how I did it.

eXrshock commented 1 year ago

https://github.com/docgalaxyblock/KlipperMisc/blob/main/CAN/BigTreeTech-U2C/README.md

@Creo2005 The easiest way is to follow the instructions that Gabber posted.

Scroll up to "Klipper USB-to-CAN adapter (advanced way)"

That's exactly how I did it.

gusevargas commented 5 months ago

Just purchased a U2C V2.1 from Amazon and I'm experiencing the same issues, the unit does not show up on the list after the lsusb command, nor shows up on the list on the dfu-util -l command. Yet the green and blue LED stay on. Are these defective units? All these posts telling me to upgrade the firmware, but none addresses the actual issue, it is NOT possible to upgrade the firmware, if the device does not go into DFU mode, and worse than that, it does not even show up as a USB device...