owennewo / SimpleCAN

A CAN Bus library for Arduino and other platforms
9 stars 2 forks source link

CanBus error with STM32G0B1CBT6 #8

Open Developer310301 opened 1 month ago

Developer310301 commented 1 month ago

Hi! I'm writing a simple program that every time that i send a canbus message i blink a led using the STM32G0B1CBT6 microcontroller with the Big Tree Tech EBB42 V1.2 board (that's supported by PlatformIO). When i send the message every 2 second it gives me the error in the following screenshot. image

Do you have any suggestion for this problem? Because i've used the same firmware in the Big Tree Tecj Kraken (that has a STM32H723ZGT6) and it works well

owennewo commented 1 month ago

The 'w' in ERROR(w) in your error message tells me that it has problems with calling HAL_FDCAN_AddMessageToTxFifoQ here: https://github.com/owennewo/SimpleCAN/blob/1abb7f97978592e77db0f42ea0816a0b589cc002/src/stm/fdcan/CAN.cpp#L216

Is this happening on the first write or after about 5 writes? If it's happening after 5 writes it perhaps indicates that the TX FIFO queue is filling up and getting too full. This can happen if no other device on canbus acknowledges the messages - the messages get stuck in FIFO until acknowleged. You can see a bit more about the error message and what its printing here: https://github.com/owennewo/SimpleCAN/blob/1abb7f97978592e77db0f42ea0816a0b589cc002/src/stm/fdcan/CAN.cpp#L383 So we have

It can take me hours/days getting can working and it is often something really small. Good luck!