2023-10-03 02:55 AM
Good morning everyone,
I’m trying to get FDCAN working on a STM32G431 however with very limited success. I’m not able to get a valid output signal on the TX line (measured with an oscilloscope) however, if I put the FDCAN peripheral into External LoopBack Mode, then a valid message appears on the TX. Even though there are no other CAN devices connected to the CAN bus, I still expect a few (3?) valid TX messages to be registered on the oscilloscope before the buffer fills up and throws an error.
In order to exclude any hardware issues on the PCB (first rev. of the PCB), I switch over to the NUCLEO-G431RB Evaluation board instead. Unfortunately, the exact same issue appeared, no valid data in Normal Mode but when in External LoopBack Mode, I do get valid TX.
Right now I’m just trying to get valid TX data out on the NUCLEO in Normal Mode, so I’ve based my code on an example from the STMCubeIDE. In the main while loop, I’m simply calling AddMessageToTxFifoQ with a break point at the 1 ms HAL_Delay (in order to easily catch the TX data on the oscilloscope)
Please find attached, the code and pictures from the oscilloscope where Normal Mode transmission is depicted in orange and External LoopBack Mode transmission is depicted in green.
Any help regarding this issue would be greatly appreciated.
Solved! Go to Solution.
2023-10-03 04:48 AM - edited 2023-10-03 04:59 AM
Hello,
CAN is not UART or SPI so you can not use CAN in Normal mode when no other devices (at least two devices) connected to the bus. There is a mechanism of sending and listening to the bit sent at the same time for arbitration and error management purpose with an acknowledge bit sent by the receiver to the sender to complete the transaction. To use CAN in stand alone you have to use Loopback mode (as you did) as all these mechanisms are managed by the CAN cell during this mode.
2023-10-03 04:48 AM - edited 2023-10-03 04:59 AM
Hello,
CAN is not UART or SPI so you can not use CAN in Normal mode when no other devices (at least two devices) connected to the bus. There is a mechanism of sending and listening to the bit sent at the same time for arbitration and error management purpose with an acknowledge bit sent by the receiver to the sender to complete the transaction. To use CAN in stand alone you have to use Loopback mode (as you did) as all these mechanisms are managed by the CAN cell during this mode.
2023-10-03 05:10 AM
Thank you very much for your reply SofLit.
I see, the ACK from the receiving node does not only tell the transmitter that the message was received correctly, but it’s actually used during the transmission process to generate the actual message.
I’ll hook up a second CAN device (probably a PCAN module) to the bus and re-run my test, again appreciate the quick response.
2023-10-03 06:17 AM
You're welcome.
Indeed. Ack bit is recessive during the transmission and asserted to dominant by the receiver to tell the transmitter that the frame was OK.
2023-12-25 06:46 PM
Hello, can I ask you a question about FDCAN for G474?
Loopback mode can send and receive normally, but normal mode cannot
2023-12-25 09:45 PM
Hello, When am i trying to communicate with 2 Discovery boards am getting bit dominant error.