2024-07-12 02:44 AM
Dear all,
I'm struggeling to get FDCAN2 working on my board. I also use FDCAN1 - which is working pretty good.
For FDCAN1 I selected the RxFifo0 and for FDCAN2 I selected RxFifo1.
But for some reasons, I dont get the callback for HAL_FDCAN_RxFifo1Callback().
Thats part of my own code, where I used the _weak function HAL_FDCAN_RxFifo1Callback(
// CAN 2 receive interrupt callback
void HAL_FDCAN_RxFifo1Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo1ITs)
{
//....
// the incoming message will be used for further scenarios
//...
}
I can also see that the interrupt function will not be called for FDCAN2 if I put a breakpoint into this section (FDCAN1 is working as mentioned)
void FDCAN2_IT1_IRQHandler(void)
{
/* USER CODE BEGIN FDCAN2_IT1_IRQn 0 */
/* USER CODE END FDCAN2_IT1_IRQn 0 */
HAL_FDCAN_IRQHandler(&hfdcan2);
/* USER CODE BEGIN FDCAN2_IT1_IRQn 1 */
/* USER CODE END FDCAN2_IT1_IRQn 1 */
}
I also added my .ioc file - much appreciate if you can have a look into this, due I'm running out of ideas how to go ahead.
Solved! Go to Solution.
2024-07-22 04:04 AM
I just got the message from ST - Support.
It is now working after implementing the following function call:
HAL_FDCAN_ConfigGlobalFilter(&hfdcan2, FDCAN_ACCEPT_IN_RX_FIFO1, FDCAN_ACCEPT_IN_RX_FIFO1, FDCAN_FILTER_REMOTE, FDCAN_FILTER_REMOTE);
2024-07-12 03:52 AM
Hello,
It could be many reasons: interrupt not enabled, Filter not configured correctly, not the correct Rx pin used.. etc ..
I invite you to inspire from this example: https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/STM32H743I-EVAL/Examples/FDCAN/FDCAN_Com_IT
But first, try loopback mode: https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/STM32H743I-EVAL/Examples/FDCAN/FDCAN_Loopback
Hope it helps.
2024-07-12 04:03 AM
If I configure FDCAN on RxFifo0, then everything is working. So pinsetting etc. is fine.
I will check-out your posted links. Do you have time to investigate into attached ioc file?
2024-07-12 08:13 AM
According to your ioc file, I noticed that you didn't set any of Std/Ext filter numbers. I think you need to set at least one filter for each if you are receiving both types of frames:
hfdcan.Init.StdFiltersNbr = 1;
hfdcan.Init.ExtFiltersNbr = 1;
2024-07-12 12:33 PM
Hi All,
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Regards,
Jake
ST Support
2024-07-16 02:49 AM
Any updates so far?
2024-07-16 02:55 AM
Did you check my last comment?
2024-07-16 07:15 AM
The provided solution will not fix my problem.
To get a little bit more clarity:
My desired configuration:
CAN1 -> RxFifo0
CAN2 -> RxFiFo1
But in this config I will not get any messages for CAN2 in HAL_FDCAN_RxFifo1Callback.
But I will get messages for CAN1 in HAL_FDCAN_RxFifo0Callback
In this config I got IRQ on FDCAN1_IT0_IRQHandler, but no on FDCAN2_IT0_IRQHandler
I tested for both CAN busses the std and ext. filter configuration, which was not working.
I exchanged the configuration:
CAN1-> RxFifo1
CAN2->RxFifo0
I just got messages in RxFifo0. That means from HW side everything looks good, but this issue seems to be a software related one, since RxFifo1 is without any function.
Also in this config I got IRQ on FDCAN2_IT0_IRQHandler, but no on FDCAN1_IT0_IRQHandler
Since I'm running my code on a custom board with STMH753XI - I'm not able to test in an easy way the loopback or other provided examples. Any recommondation, hints are welcome.
2024-07-22 04:04 AM
I just got the message from ST - Support.
It is now working after implementing the following function call:
HAL_FDCAN_ConfigGlobalFilter(&hfdcan2, FDCAN_ACCEPT_IN_RX_FIFO1, FDCAN_ACCEPT_IN_RX_FIFO1, FDCAN_FILTER_REMOTE, FDCAN_FILTER_REMOTE);
2024-07-22 04:15 AM
But, previously, you said "If I configure FDCAN on RxFifo0, then everything is working"
Did you enable that line for FIFO0?