cancel
Showing results for 
Search instead for 
Did you mean: 

Problem receiving CAN message with Interrupt callback

AWack
Associate III

I´ve a problem receiving a CAN message with interrupt. When I poll with the same settings the message is received correctly.

I´m using STM32CubeIDE with a STM32F103RBT6.

When I poll:

if (HAL_CAN_GetRxFifoFillLevel (&hcan, CAN_RX_FIFO0) > 0)

{

     HAL_CAN_GetRxMessage (&hcan, CAN_RX_FIFO0, (CAN_RxHeaderTypeDef*) &rxHead, (uint8_t*) &canRxBuf);

}

everythink works.

When I call the same function in HAL_CAN_RxFifo0MsgPendingCallback the message is empty. When debugging the SFR registers everything is ok, but when debugging at this point into HAL_CAN_GetRxMessage if ((hcan->Instance->RF0R & CAN_RF0R_FMP0) == 0U) is true but CAN_RF0R is 0x01!

What could be the problem?

0 REPLIES 0