AnsweredAssumed Answered

s32k144 can interrupt recieve

Question asked by Victor Song on Mar 18, 2019
Latest reply on Mar 19, 2019 by Constantin Razvan Chivu

I want to use can interrupt to recieve data. when send can data ,it can enter interrupt,but when recieve can data via USB-CAN ,it not work and can not enter interrupt. Code below:

 

 

void CAN_IRQ_Callback(uint8_t instance, flexcan_event_type_t eventType,flexcan_state_t *flexcanState)
{
if(eventType == FLEXCAN_EVENT_RXFIFO_COMPLETE)flag_rx_can = true;
else if(eventType == FLEXCAN_EVENT_TX_COMPLETE)flag_tx_can = true;
}

 

int main()

{

..........

INT_SYS_EnableIRQ(CAN0_ORed_0_15_MB_IRQn);
INT_SYS_SetPriority(CAN0_ORed_0_15_MB_IRQn,0U);

FLEXCAN_DRV_Init(INST_CANCOM1, &canCom1_State, &canCom1_InitConfig0);

FLEXCAN_DRV_ConfigRxFifo(INST_CANCOM1,FLEXCAN_RX_FIFO_ID_FORMAT_A,&can_id_table);

FLEXCAN_DRV_InstallEventCallback(INST_CANCOM1, CAN_IRQ_Callback, (void *)NULL);

FLEXCAN_DRV_Receive(INST_CANCOM1,0U,&can_rx_buff);

 

   while(1)

   {

      if(flag_rx_can ){......}

      else if(flag_tx_can ){......}

   }

}

Outcomes