How to Enable CAN Receiver Interrupt in CAN PAL Example code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Enable CAN Receiver Interrupt in CAN PAL Example code

382 Views
Dileep1441
Contributor I

Hi,

I'm using CAN PAL Example code in S32K144 EVB with S32DS.ARM.2018.R1 IDE.

I want to enable the CAN Receiver interrupt in CAN PAL Example code, i don't want to block my code with while loop like below

CAN_ConfigRxBuff(INST_CAN_PAL1, RX_MAILBOX, &buffCfg, Rx_Id);
/* Start receiving data in RX_MAILBOX. */
CAN_Receive(INST_CAN_PAL1, RX_MAILBOX, &recvMsg);

while(1)
{
         /* Wait until the previous FlexCAN receive is completed */
         if(CAN_GetTransferStatus(INST_CAN_PAL1, RX_MAILBOX) == STATUS_SUCCESS)
         {
             CAN_Rx_test_ID = recvMsg.id;
             CAN_Receive(INST_CAN_PAL1, RX_MAILBOX, &recvMsg);

         }
}

Here my requirement is when ever the CAN Message is received on CAN Bus, CAN Receiver Interrupt need to Trigger so that without blocking of my code with while loop, i can handle the received CAN Messages

 

Hope you understand my requirement, please share your suggestion or code with required config settings to fulfill my requirement.

 

Thanks in Advance.

0 Kudos
1 Reply

362 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Dileep1441,

Please refer to the examples in S32K1xx SDK FlexCAN sample projects to demonstrate its basic and advanced features
You will find the CAN_TX_RX_Callback in ...\S32K144_CAN_PAL_SamplePrj_Basic_TxRx_ID_FiltersConfig_SDKRTM3P0\Sources\can_api.c

Hope it helps.


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos