cancel
Showing results for 
Search instead for 
Did you mean: 

FDCAN is not sending messages in Normal Mode

AreuaMicro
Associate

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.

 

can send.png

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

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.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

5 REPLIES 5
SofLit
ST Employee

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.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

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.

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
wang_mo_mo
Associate II

Hello, can I ask you a question about FDCAN for G474?

Loopback mode can send and receive normally, but normal mode cannot

PranavGurav
Associate II

Hello, When am i trying to communicate with 2 Discovery boards am getting bit dominant error.