Skip to main content
Explorer
June 14, 2024
Solved

STM32U5A9 FDCAN Help

  • June 14, 2024
  • 1 reply
  • 2854 views

I am using a Riverdi STM32 Embedded Display RVT50HQSNWC00-B and having issues with the FDCAN bus. I am capable of writing to the TxFifo and can communicate with an external device in external loop back mode and normal mode. In external and Internal Loop Back Mode, nothing is written to the RxFifo. I am trying to use the board as a receiver not a transmitter. Are there any examples of FDCAN Rx communication with an external device using the STM32U5A9NJH6Q chip. When using CubeMX, there isn't any options for setting RxFifo elements in FDCAN configuration. Does this mean this board cannot be used a reciever, and only can transmit.

    This topic has been closed for replies.
    Best answer by mƎALLEm

    Ok. Did you try the example from STM32U575I-EV\Examples\FDCAN\FDCAN_Loopback\ as it is? is it working well?

    1 reply

    Technical Moderator
    June 14, 2024

    Hello,

    Not sure I understood this statement:


    and can communicate with an external device in external loop back mode and normal mode. In external and Internal Loop Back Mode, nothing is written to the RxFifo. 

    You did succeed to communicate with an external device with a loopback mode? How? 

    You need Normal mode for that. Otherwise you need to clarify that point.

    Thank you.

     

    Explorer
    June 14, 2024

    Ill try to be more clear.

    • I have successfully used Normal Mode to communicate with an External Device. As in, I am capable of sending a CAN message from the STM32 Embedded Display to my Raspberry Pi v4 with a 2 Channel-CANFD hat.
    • I have not successfully used Restricted-Mode or Bus-Monitoring Mode to receive messages on the STM32 Embedded Display from my Raspberry Pi.
    • In Internal Loopback mode, TxData is not mirrored in RxData. 
     

     

    /* Check that the Rx FIFO 0 is not empty */
    
    if ((hfdcan->Instance->RXF0S & FDCAN_RXF0S_F0FL) == 0U)
    
    {
    
    /* Update error code */
    
    hfdcan->ErrorCode |= HAL_FDCAN_ERROR_FIFO_EMPTY;
    
    
    
    return HAL_ERROR

     

    • Returns as not empty so continues code
    • RxData value is not the same as TxData. RxData never changes.

    I am trying to understand why the RxData is not updating correctly.

    CubeMX doesn't allow me to edit any of Rx elements.

    msalgannik_0-1718383813975.png

     

    Technical Moderator
    June 14, 2024

    Hello,


    In Internal Loopback mode, TxData is not mirrored in RxData. 

    So if I understood well, even with Loopback mode you didn't succeed to receive messages? in that case drop Normal mode for the moment and let's focus on Loopback mode. Did you configure filters?

     


    CubeMX doesn't allow me to edit any of Rx elements.

    msalgannik_0-1718383813975.png

     


    I need to check internally why there is no Rx FIFO elements setting in the CubeMx. It's true that U5 doesn't have the same FDCAN implementation as H7 for example but anyway I need to check.