Hello,
We use can_pal.c moudle to implement CAN bus function.
System starts reception via CAN_Receive and install a callback function via CAN_InstallEventCallback.
Static void internalCallback(
U32 interface, /**< CAN interface */
can_event_t eventType, /**< The type of the event */
U32 box, /**< Message box */
void *state) /**< Internal driver state information */
When a CAN frame is received, the callback function is called correctly.
However, when we get message: ((flexcan_state_t*)state)->mbs->mb_message, it's not correct.
After investigation, I found that in function:
static inline void FLEXCAN_IRQHandlerRxFIFO(uint8_t instance, uint32_t mb_idx)
mb_message is cleared before calling the callback function by:
FLEXCAN_CompleteRxMessageFifoData(instance);
From my perspective, callback function SHOULD be called before completing receive data.
Please check it out.
BRs,
Matthew Xu