cancel
Showing results for 
Search instead for 
Did you mean: 

FDCAN - multiple frames sent from single send request

NElli.2
Associate

Hello,

I'm beginning to bring up a PCB which is based on the STM32G484QET. Initially, I'm getting the FDCAN set up (although I'll be using it as a CAN 2.0 node). I am using FDCAN1.

I'm at the stage that I can transmit CAN messages which are picked up correctly both on my logic analyzer and CAN box (PC). Using HAL_FDCAN_AddMessageToTxFifoQ (to initiate the send request), results in data being correctly transmitted on the CAN bus, but the message is sent a seemingly random number of times (although usually between 1-10).

Stepping through the code, it seems that these messages are produced every 100us (approx), and are all transmitted after the line "hfdcan->Instance->TXBAR = ((uint32_t)1 << PutIndex);" - this is the line that activates the transmission request (in stm32g4xx._hal_fdcan.c). For reference, this code was initially generated by STM32CubeMX.

Adding a short delay directly after this line seems to solve the problem (CAN frames are sent only once), but this has the potential to cause issues down the line so I'd rather rectify this "correctly". Any help here would be greatly appreciated.

Thank you,

Nick

0 REPLIES 0