Skip to main content
Associate II
March 20, 2024
Solved

Error in sending message with FDCAN on STM32H735G-DK

  • March 20, 2024
  • 2 replies
  • 3793 views

Dear all,

I've been following this video on YT on how to get the FDCAN on my discovery board (STM32H735G) to work: https://www.youtube.com/watch?v=sY1ie-CnOR0 . Note that this is the 2nd video of a series, if you want to watch it. Now, my problem is not with the video but with why the code doesn't work on my board. The full code you can find attached to this post.


The code compiles and runs without a problem, however, when I reach the 
if (HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan1, &TxHeader1, TxData1)!= HAL_OK)
line in the while(1) loop the second time around, it throws an error. I have been unable to identify what the error is or how to solve it, however, I had a look at the pins with an oscilloscope to confirm the existence of a signal or the lack thereof. I did not see a signal. What I find interesting is that it succeeds the first time but only gives an error the second time around.

Any insights and solutions are welcome!

Best answer by mƎALLEm

Hello,

After checking your .ioc file, you're configuring the wrong GPIO pins for FDCAN1 (PB8 & PD1):

SofLit_0-1711022716494.png

According to the board schematics, you need to set:

PH13 for FDCAN1_Tx and PH14 FDCAN1_Rx.

2 replies

Karl Yamashita
Lead III
March 20, 2024

If there is an error, you can check it in the error callback. 

void HAL_FDCAN_ErrorCallback(FDCAN_HandleTypeDef *hfdcan)
{
	uint32_t error;
	
	error = HAL_FDCAN_GetError(hfdcan);
	
}

 

KarlYamashita_0-1710975400974.png

 

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
Associate II
March 21, 2024

Thank you for the advice! I implemented your code and was able to see the error code: 512 (HAL_FDCAN_ERROR_FIFO_FULL). Any idea what could be the cause of it? How do I solve it?

mƎALLEm
Technical Moderator
March 21, 2024

Hello,

Could you please share your .ioc file?

How did you connect FDCAN1 to FDCAN2? 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
mƎALLEm
Technical Moderator
March 21, 2024

@Nick_Tesla please confirm if it was an issue of pin configuration.

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