cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7A3ZI-Q FDCAN TxBufferMessagePending Error.

Shubh150
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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  )

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

9 REPLIES 9
SofLit
ST Employee

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

 

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.
Shubh150
Associate II

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.

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.

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?

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.
AScha.3
Principal III

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.

If you feel a post has answered your question, please click "Accept as Solution".
Karl Yamashita
Lead II

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

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  )

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.

Hello, 

Thank You for your code, but I am not able to see received values in RxData under Live Expressions. So I am unsure if the code actually worked or not for me.

If you could kindly elaborate what I am missing here.

Also, I noticed that you are trying to send 12 bytes of data through FDCAN in Classic mode. Doesn't it support a max data frame of only 8 bytes?

Hello,

Indeed it should be 8Bytes max. It was a mistake, replace 12 by 8.

I said I ported this example  https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/STM32H7B3I-EVAL/Examples/FDCAN/FDCAN_Loopback, So please read the readme file to understand how it works.

To launch the communication, press the user button. Put RxData in the live watch. There are Three messages to send and receive.

 

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.