2024-03-20 07:09 AM - last edited on 2024-03-21 05:08 AM by SofLit
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!
Solved! Go to Solution.
2024-03-21 05:06 AM - edited 2024-03-21 05:25 AM
Hello,
After checking your .ioc file, you're configuring the wrong GPIO pins for FDCAN1 (PB8 & PD1):
According to the board schematics, you need to set:
PH13 for FDCAN1_Tx and PH14 FDCAN1_Rx.
2024-03-20 04:04 PM
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);
}
2024-03-21 01:20 AM
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?
2024-03-21 01:32 AM
Hello,
Could you please share your .ioc file?
How did you connect FDCAN1 to FDCAN2?
2024-03-21 01:47 AM
2024-03-21 02:04 AM
Thanks for sharing these materials.
One more question: did you fit JP6 and JP7 in order to connect termination resistors of 120 ohm?
2024-03-21 02:17 AM
Yes, I do have the termination resistors connected.
2024-03-21 05:06 AM - edited 2024-03-21 05:25 AM
Hello,
After checking your .ioc file, you're configuring the wrong GPIO pins for FDCAN1 (PB8 & PD1):
According to the board schematics, you need to set:
PH13 for FDCAN1_Tx and PH14 FDCAN1_Rx.
2024-03-21 05:53 AM
@Nick_Tesla please confirm if it was an issue of pin configuration.