Hello,
I'd like to know how to discover what received message called the interrupt handler.
For example:
FLEXCAN_DRV_Init(INST_CAN0_GPSCAN, &can0_GPSCAN_State, &can0_GPSCAN_InitConfig0);
FLEXCAN_DRV_InstallEventCallback(INST_CAN0_GPSCAN, can1_GPSCAN_Interrupt, NULL);
const flexcan_data_info_t dataInfo_GPSCAN =
{
.data_length = 0x8, /* 1 byte in length */
.msg_id_type = FLEXCAN_MSG_ID_STD, /* Standard message EXT */
.enable_brs = false, /* Bit rate switch disabled */
.fd_enable = false, /* Flexible data rate disabled */
.fd_padding = 0U /* Use zeros for FD padding */
};
FLEXCAN_DRV_ConfigRxMb(INST_CAN0_GPSCAN, accel_MB, &accel_Buff, accel_MSG_ID);
FLEXCAN_DRV_ConfigRxMb(INST_CAN0_GPSCAN, magn_MB, &magn_Buff, magn_MSG_ID);
FLEXCAN_DRV_Receive(INST_CAN0_GPSCAN, accel_MB, &accel_Buff);
FLEXCAN_DRV_Receive(INST_CAN0_GPSCAN, magn_MB, &magn_Buff);
void can1_GPSCAN_Interrupt(uint32_t buffIdx, flexcan_event_type_t eventType)
{
if (eventType == FLEXCAN_EVENT_RX_COMPLETE)
{
HOW DO I KNOW WHAT RECEIVED MESSAGE CALLED THE INTERRUPT ROUTINE???
}
}
Thanks in advance!
Regards
João
Solved! Go to Solution.
Hi,
a driver gives you MB number in callback directly, use below callback function
void can1_GPSCAN_Interrupt(uint8_t instance, flexcan_event_type_t eventType, uint32_t buffIdx,
flexcan_state_t *flexcanState)
{
(void)flexcanState;
(void)instance;
switch(eventType)
{
case FLEXCAN_EVENT_RX_COMPLETE:
{
}
break;
case FLEXCAN_EVENT_RXFIFO_COMPLETE:
{
}
break;
case FLEXCAN_EVENT_TX_COMPLETE:
{
}
break;
default:
break;
}
}
BR, Petr
Hi,
a driver gives you MB number in callback directly, use below callback function
void can1_GPSCAN_Interrupt(uint8_t instance, flexcan_event_type_t eventType, uint32_t buffIdx,
flexcan_state_t *flexcanState)
{
(void)flexcanState;
(void)instance;
switch(eventType)
{
case FLEXCAN_EVENT_RX_COMPLETE:
{
}
break;
case FLEXCAN_EVENT_RXFIFO_COMPLETE:
{
}
break;
case FLEXCAN_EVENT_TX_COMPLETE:
{
}
break;
default:
break;
}
}
BR, Petr