Skip to main content
Visitor II
July 12, 2024
Solved

FDCAN2 Rx callback doesn't work STM32H753

  • July 12, 2024
  • 3 replies
  • 2562 views

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.

    This topic has been closed for replies.
    Best answer by julred

    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); 

    3 replies

    Technical Moderator
    July 12, 2024

    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.

    julredAuthor
    Visitor II
    July 12, 2024

    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?

    Technical Moderator
    July 12, 2024

    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;

     

    ST Employee
    July 12, 2024

    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

    julredAuthor
    Visitor II
    July 16, 2024

    Any updates so far?

    Technical Moderator
    July 16, 2024

    Did you check my last comment?

    julredAuthorAnswer
    Visitor II
    July 22, 2024

    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); 

    Technical Moderator
    July 22, 2024

    But, previously, you said "If I configure FDCAN on RxFifo0, then everything is working"

    Did you enable that line for FIFO0?