Issues with CAN bus

first: CAN converter U2C

 [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32)  --->
    Processor model (STM32G0B1)  --->
    Bootloader offset (8KiB bootloader)  --->
    Clock Reference (8 MHz crystal)  --->
    Communication interface (CAN bus (on PA11/PA12))  --->
 (1000000) CAN bus speed
 (PF6) GPIO pins to set at micro-controller startup

now: [mcu] SKRat CAN bus

 [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32)  --->
    Processor model (STM32G0B1)  --->
    Bootloader offset (8KiB bootloader)  --->
    Clock Reference (8 MHz crystal)  --->
    Communication interface (USB to CAN bus bridge (USB on PA11/PA12))  --->
    CAN bus interface (CAN bus (on PD0/PD1))  --->
    USB ids  --->
 (1000000) CAN bus speed
 (PF6) GPIO pins to set at micro-controller startup

That looks like the menuconfig of your SKrat in your first setup but wat was running on your U2C during that? Stock flashed fw?

I don’t know, the U2C has firmware from the factory, I didn’t do anything with it, I just plugged it into the Raspberry

It seems to me that after rebooting the Raspberry, the U2C converter was not able to communicate.

That might be the problem.

Have a look here GitHub - bigtreetech/U2C

First, you may post what MCU on your U2C board is used? STM32F072 or STM32G0B1?

Ii is: STM32G0B1

Good, that’s the better MCU.

You might need to flash this firmware U2C/firmware/U2C_V2_STM32G0B1.bin at master ¡ bigtreetech/U2C ¡ GitHub

But, when you read the manual U2C/BIGTREETECH U2C V1.0&V1.1 User Manual.pdf at master ¡ bigtreetech/U2C ¡ GitHub

on page 10 ‘5.2 Firmware Update’ it tells you: You’ll need a STM32CubeProgrammer

I don’t own a U2C! Maybe here Bigtreetech U2C 1 & 3 | klipper_canbus you’ll find help to do it without programmer.

But I doubt it!

Good luck, hcet14

PS: Always use the “Search” function here. You may find some better information :wink:

Flashing the firmware @hcet14 linked could fix it cause there were bugs in the early factory ones - theoretically they should have foxed them but reflashing is worth a try.
You can just flash it with dfu-util stm32cubeprog not required but also works.

@DrumClock If you like you can try candlelight and also the usbcan bridge klipper fw on the U2C.

Depends on your opinion. F072 has upstream candlelight support - the G0B1 ist stuck on the version BTT ported and did not pushed an update since the port.

How to find out, which firmware is flashed?

Could you please explain that in more details, or post a link?

I absolutely don’t agree. I follow GitHub - candle-usb/candleLight_fw: gs_usb compatible firmware for candleLight, cantact and canable and particularly GitHub - marckleinebudde/candleLight_fw at multichannel constantly!

You can dump the flash and compare it to the .bin…

meteyou and my coop guide:
https://docs.meteyou.wtf/
I do not share a direct link to the device since I will hopefully push a big rework this month.

I do not follow candlelight that much since I test everything with a full klipper mcu fw setup since it is the “same” code on all nodes.

1 Like

Hi, thank you, I’ll try the flash in USB-CAN bridge mode and give info on how it works.

Hi, it’s the same with the new FW for U2C. After the first power on the Raspberry CAN bus works, if I reboot the raspberry it stops working.
The MCU is connected via the CAN_OUT (USB output) of the U2C converter.

settings [mcu]

 [*] Enable extra low-level configuration options
    Micro-controller Architecture (STMicroelectronics STM32)  --->
    Processor model (STM32G0B1)  --->
    Bootloader offset (8KiB bootloader)  --->
    Clock Reference (8 MHz crystal)  --->
    Communication interface (CAN bus (on PA11/PA12))  --->
 (1000000) CAN bus speed
 (PF6) GPIO pins to set at micro-controller startup

klippylog:
klippy (18).log (1.9 MB)

Per the SKRat Manual page 43

Page 22:

Page 9 shows the USB is just USB, not CAN (The output USB of the U2C adapter is CAN, which is weird as hell… What were they thinking on that one???)

You should wire your mcu chained in with your EBB toolhead boards.

Also, Your U2C shouldn’t be showing up as an MCU. I think you’re trying to set it up like a CAN bridge and it doesn’t need to be. It’s a standalone device.

It should be connected to the Pi and the Pi should recognize it as a CAN adapter and when you setup your Can0 link it uses that, everything else should be handled through the CAN wiring off your U2C.

Hi, @TheFuzzyGiggler
The U2C is connected to the SKRat via a USB cable so the [mcu] must have CAN communication set to PA11/PA12 pins (at least that’s how I understood it from the U2C documentation).

I know that SKRat has its own USB-CAN bridge, but I want to test the U2C converter. It works, but you must not reboot the Raspberry!

I believe that there is an error in the CAN communication via the PA11/PA12 pins using the USB connection from the U2C converter.

Yes, Because PA11/PA12 on the SKRat isn’t CAN bus, PD0/PD1 is.
Per the SKRat documentation.

and I’m not saying use the SKRat as the bridge, I’m saying you have your U2C set up as a CAN Bridge but it’s NOT. It’s a CAN Adapter.

It should NOT be showing up in your MCUs.

For example, Every MCU (except the host and base mcu which is just the Pi) is on a CAN Bus in the pic below.

I’m using the Mellow fly version of the UtoC connected to my Pi as a CAN Adapter board. You don’t have to set that up in Klipper at all.

Note specifically, and this is true for the BTT version.
It’s a CAN ADAPTER not a CAN Bridge

my new FW for U2C
https://docs.meteyou.wtf/btt-u2c-v2.x/klipper-usb-to-can/

info from U2C

So why does the CAN bus only work after turning on the Raspberry and not after rebooting?

That’s what it’s all about.

STM32G0B1xxx

Wait, Are you trying to flash the U2C?

You need to be flashing the SKRat, the U2C doesn’t run Klipper.

Per your link:

In the case of the BigTreeTech U2C, this solution has no advantages over the candlelight firmware, since no freely usable pins are available on the board.

I have zero clue why BTT would want you to flash the U2C as a bridge. That makes zero sense honestly. You use a CAN bridge when you already have a board that’s doing something else (like the SKRat) and you don’t want to buy a U2C adapter to handle the CAN bus.

Here’s what you need to do and I promise it will work 100%.

Flash Candlelight back onto the U2C.

Flash your SKRat like this…

Chain your EBB boards to the SKRat using this connector

and setup your Pi to use the U2C as a CAN Adapter as described here:

https://www.klipper3d.org/CANBUS.html

under Host hardware (not the CAN Bridge part, the Candlelight part), but honestly the Pi should recognize it immediately when you flash Candlelight on it then you just do the…

allow-hotplug can0
iface can0 can static
    bitrate 1000000
    up ifconfig $IFACE txqueuelen 128

portion.

BTT is notorious for poor documentation.

sorry @TheFuzzyGiggler but we don’t understand each other.

I know that I don’t need a U2C converter for SKRat, I’m just trying the possibility of connecting CAN using the USB-C connector on the board and not the CAN connector.
Apparently it should work, but it doesn’t.

The only thing I found out is that if the CAN bus stops working after a raspberry reboot, it helps to press the reset button on the SKRat board and restart the klipper. After that, the CAN bus starts again.

Let’s leave it at that. I don’t need a U2C converter from the SKRat board and this discussion leads to nothing.

Thanks.

That’s what I’m telling you, You can’t use the SKRat USB connector because that’s not a CAN connection.

Look at the bottom of the pic “Type C D+ D-” those are USB data lines, not CAN bus.
The only CAN connector on the SKRat board is on the right hand side labeled “CAN bus”

image

Just because the U2C has a USB can connector (which again, is beyond stupid and weird) doesn’t mean the SKRat does. USB and CAN can’t coexist on one connector (at least I don’t see how that’s even possible, they have different termination and signaling requirements).

as @docgalaxyblock writes here:

BTT also claims this, and so does the STM32G0B1 datasheet
so why is it acting so weird?

*** by the way, if you look at the U2C diagram, there is an internal CAN bus and from it a converter to CAN-OUT (USB connector)