Skip to main content
Explorer
December 28, 2023
Solved

STM32H7A3ZI-Q FDCAN TxBufferMessagePending Error.

  • December 28, 2023
  • 4 replies
  • 3069 views

I am trying to write code for a simple transmit and receive in FDCAN (Classic Mode) in external loopback mode, but I have been unsuccessful in doing so. I don't even know where I am going wrong and am looking for help as my last resort. 

I have tried using the MCP2551 CAN trasceiver and also without, as I am unsure whether the NUCLEO H7A3ZI-Q has an inbuilt transceiver or not. Whenever I try to run my code, the TxBufferMessagePending starts facing errors.

Also, I wanted to know, if a transceiver is required for CAN interface, is it possible on a CAN transceiver like the MCP2551 or do I require a seperate CANFD transceiver.

Please find attached .ioc file and main.c code for my STM Project.

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

    Hello,

    I've ported the example https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/STM32H7B3I-EVAL/Examples/FDCAN/FDCAN_Loopback  to STM32H7A3ZI-Q Nucleo board for you with some modifications mainly it's working with Classic format @500kB/s.

    See attached project.

    Hope it helps.

    EDIT: fixed the issue of data bytes number (12 -> 8  )

    4 replies

    Technical Moderator
    January 8, 2024

    Hello,

    Loopback mode doesn't need an external transceiver. Only normal mode does.

    Try to configure the Pull-up/Pull-down of the CAN_Rx pin (PB5 in you case) as Pull-up.

    SofLit_0-1704724827094.png

     

    Shubh150Author
    Explorer
    January 9, 2024

    Thank you for your reply.

    However after doing the required changes, I am still facing the same issue.

    I would like to know what exactly does changing the GPIO to Pull-Up mode will do.

    Technical Moderator
    January 9, 2024

    Hello,

    It was a tentative to help you as the pull-up resistor is needed in bxCAN.

    Now if it does not solve the issue it should be analyzed deeper..

    Did you try to port the example: https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/STM32H7B3I-EVAL/Examples/FDCAN/FDCAN_Loopback to your Nucleo board?

    Shubh150Author
    Explorer
    January 9, 2024

    Thank you for your reply.

    However after doing the required changes, I am still facing the same issue.

    I would like to know what exactly does changing the GPIO to Pull-Up mode will do.

    Super User
    January 9, 2024

    For CAN bus you always need a transceiver, maybe mcp2551.

    +

    For a first test, try internal loopback.

    AScha3_0-1704816791058.png

    If this is working, you can try external loopback, but maybe need set pullup on Tx pin,

    or have real transceiver connected, with termination.

    Graduate II
    January 9, 2024

    I don't see that you call HAL_FDCAN_ConfigGlobalFilter or HAL_FDCAN_ActivateNotification in your code?