cancel
Showing results for 
Search instead for 
Did you mean: 

FDCAN2 Rx callback doesn't work STM32H753

julred
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions
julred
Associate II

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

View solution in original post

9 REPLIES 9
SofLit
ST Employee

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.

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.

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?

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;

 

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.
Jacob WOODRUFF
ST Employee

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

Any updates so far?

Did you check my last comment?

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.

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.

julred
Associate II

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

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

Did you enable that line for FIFO0?

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.