AnsweredAssumed Answered

S32K146 CAN receive problem

Question asked by 张 舜毅 on Jan 14, 2020
Latest reply on Feb 7, 2020 by Alexis Andalon
  • My CAN initializes:

CAN_Init(&can3_pal_instance, &can3_pal_Config);
CanSetRate(canNum, rate);
/* Configure Rx message buffer with index 1 to receive frames with ID 2 */
CAN_ConfigRxBuff(&can3_pal_instance, eCAN2_RX_BOX, &RcvInfo, RX_MSG_ID);//eCAN2_RX_BOX =5,RX_MSG_ID =2
//FLEXCAN_DRV_SetRxMaskType(2, FLEXCAN_RX_MASK_INDIVIDUAL);
FLEXCAN_DRV_SetRxIndividualMask(2, FLEXCAN_MSG_ID_EXT, eCAN2_RX_BOX, 1);
//CAN_Receive(&can3_pal_instance, eCAN2_RX_BOX, &canRxInfo);
/*初始化CAN3接收回调函数*/
CAN_InstallEventCallback(&can3_pal_instance, (can_callback_t)Can2_RxCallBack, NULL);

CAN_Receive(&can3_pal_instance, eCAN2_RX_BOX, &canRxInfo);

 

void Can2_RxCallBack(uint8_t instance, can_event_t eventType, uint32_t buffIdx, void *driverState)
{
switch(eventType)
{
   case CAN_EVENT_RX_COMPLETE://The program didn't go in here

 

         break;

   case CAN_EVENT_TX_COMPLETE:
         break;

     default:
         break;
}
}

 

  • The function is called in one period(2ms)

CAN_Receive(&can3_pal_instance, eCAN2_RX_BOX, &canRxMsg);

 

 

  • I want to configure my CAN to be an ID that CAN receive any extended frame data, but my CAN receive function has not received any data. Is there any problem with the initialization of CAN?How to improve it?

  • I have used all three CAN of S32K146, but until now I still don't know how to configure the MB of S32K146, could you explain it to me?Maybe my question has something to do with it.CAN receive and send mailboxes must be separate or CAN use the same.

Outcomes