cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_CAN_RxFifo1MsgPendingCallback has a problem.

Ukazu
Associate III

HI

If the CAN message ID set to FIFO0 is received, HAL_CAN_RxFifo0MsgPendingCallback will be called correctly.

but,
HAL_CAN_RxFifo1MsgPendingCallback is not called even if the CAN message ID set in FIFO1 is received.

The following is strange.

step1
Send CAN message set in FIFO1 from CANoe

step2
HAL_CAN_RxFifo1MsgPendingCallback is not called.

step3
Send CAN message set in FIFO0 from CANoe

step4
HAL_CAN_RxFifo0MsgPendingCallback is called.
After this, HAL_CAN_RxFifo1MsgPendingCallback is called! !
The data received in FIFO1 is from FIFO1 and is correct.

 

Below is the code.

Any help is welcome.

 

#define FILTER_ID(id)      ((id << 5) | (REMOTE_FRAME << 4))
 
HAL_CAN_DeactivateNotification( &hcan, CAN_IT_RX_FIFO0_MSG_PENDING );
HAL_CAN_DeactivateNotification( &hcan, CAN_IT_RX_FIFO1_MSG_PENDING );
 
HAL_CAN_Stop( &hcan );
 
/* FilterBank0 */
sFilterConfig.FilterBank           = 0; /* FilterBank0 */
sFilterConfig.FilterMode           = CAN_FILTERMODE_IDLIST; /* ID LIST */
sFilterConfig.FilterScale          = CAN_FILTERSCALE_16BIT; /* 16bit */
sFilterConfig.FilterIdLow          = FILTER_ID(0x000007E8UL); /* ID Filter Num 0 */
sFilterConfig.FilterMaskIdLow      = FILTER_ID(0x00000514UL); /* ID Filter Num 1 */
sFilterConfig.FilterIdHigh         = FILTER_ID(0x00000766UL); /* ID Filter Num 2 */
sFilterConfig.FilterMaskIdHigh     = FILTER_ID(0x00000766UL); /* ID Filter Num 3 (dummy) */
sFilterConfig.FilterFIFOAssignment = CAN_RX_FIFO0; /* FIFO0 */
sFilterConfig.FilterActivation     = CAN_FILTER_ENABLE;
sFilterConfig.SlaveStartFilterBank = 0; /*  */
(void)HAL_CAN_ConfigFilter( &hcan, &sFilterConfig );
 
/* FilterBank1 */
sFilterConfig.FilterBank           = 1; /* FilterBank1 */
sFilterConfig.FilterMode           = CAN_FILTERMODE_IDLIST; /* ID LIST */
sFilterConfig.FilterScale          = CAN_FILTERSCALE_16BIT; /* 16bit */
sFilterConfig.FilterIdLow          = FILTER_ID(0x00000511UL); /* ID Filter Num 0 */
sFilterConfig.FilterMaskIdLow      = FILTER_ID(0x00000762UL); /* ID Filter Num 1 */
sFilterConfig.FilterIdHigh         = FILTER_ID(0x00000511UL); /* ID Filter Num 2 (dummy) */
sFilterConfig.FilterMaskIdHigh     = FILTER_ID(0x00000511UL); /* ID Filter Num 3 (dummy) */
sFilterConfig.FilterFIFOAssignment = CAN_RX_FIFO1; /* FIFO1 */
sFilterConfig.FilterActivation     = CAN_FILTER_ENABLE;
sFilterConfig.SlaveStartFilterBank = 0; /*  */
(void)HAL_CAN_ConfigFilter( &hcan, &sFilterConfig );
 
/* FilterBank2~13 */
for ( i = 2; i < BXCAN_FILTERBANK_NUM; i++ ) {
sFilterConfig.FilterBank           = i; /* FilterBanki(i=2~13) */
sFilterConfig.FilterMode           = CAN_FILTERMODE_IDLIST; /* ID LIST */
sFilterConfig.FilterScale          = CAN_FILTERSCALE_32BIT; /* 32bit */
sFilterConfig.FilterIdHigh         = 0x00000000UL;
sFilterConfig.FilterIdLow          = 0x00000000UL;
sFilterConfig.FilterMaskIdHigh     = 0x00000000UL;
sFilterConfig.FilterMaskIdLow      = 0x00000000UL;
sFilterConfig.FilterFIFOAssignment = CAN_RX_FIFO0; /* FIFO0 */
sFilterConfig.FilterActivation     = CAN_FILTER_DISABLE;
sFilterConfig.SlaveStartFilterBank = 0; /*  */
(void)HAL_CAN_ConfigFilter( &hcan, &sFilterConfig );
}
 
HAL_CAN_ActivateNotification( &hcan, CAN_IT_RX_FIFO0_MSG_PENDING );
HAL_CAN_ActivateNotification( &hcan, CAN_IT_RX_FIFO1_MSG_PENDING );
 
HAL_CAN_Start( &hcan );
1 ACCEPTED SOLUTION

Accepted Solutions
Ukazu
Associate III

HI

 

The vector tables were different for FIFO0 and FIFO1.
I thought vectors were common.

View solution in original post

2 REPLIES 2
Ukazu
Associate III

Hi

Additional information.

I monitored FMP1[1:0] of the CAN_RF1R register.
After sending one CAN message from CANoe, FMP1[1:0] became 1. FIFO1 stores pending CAN messages.
FULL1 and FOVR1 were also working correctly.

At this time, FMPIE1 of the CAN_IER register was 1. That is, the FIFO1 message pending interrupt is enabled.

Even with this, HAL_CAN_RxFifo1MsgPendingCallback is not called. Is this a problem with the microcontroller?

 

Ukazu
Associate III

HI

 

The vector tables were different for FIFO0 and FIFO1.
I thought vectors were common.