Error in sending message with FDCAN on STM32H735G-DK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Labels:
-
STM32CubeIDE
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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);
}
If you find my solution useful, please click the Accept as Solution so others see the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-21 01:32 AM
Hello,
Could you please share your .ioc file?
How did you connect FDCAN1 to FDCAN2?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-21 01:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-21 02:17 AM
Yes, I do have the termination resistors connected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-03-21 05:53 AM
@Nick_Tesla please confirm if it was an issue of pin configuration.