cancel
Showing results for 
Search instead for 
Did you mean: 

Error in sending message with FDCAN on STM32H735G-DK

Nick_Tesla
Associate II

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!

1 ACCEPTED SOLUTION

Accepted Solutions

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.

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

8 REPLIES 8
Karl Yamashita
Lead III

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

 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

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?

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 on "Accept as Solution" on the reply which solved your issue or answered your question.

Yes, of course! You can find the .ioc file here. As for the connection between the buses, I followed the following schematic:

Nick_Tesla_0-1711010803119.png

For my main.c file, please check my original post.

Thanks for sharing these materials.

One more question: did you fit JP6 and JP7 in order to connect termination resistors of 120 ohm?

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.

Yes, I do have the termination resistors connected.

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.

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.
SofLit
ST Employee

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

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.