How to setup KW36 FlexCAN multiple mailbox?

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

How to setup KW36 FlexCAN multiple mailbox?

851 Views
frankxu
Contributor I

Can any NXP engineer help me?

KW36 can set receive MASK to receive data by different mailbox by this funciton.

FLEXCAN_SetRxMbGlobalMask(HMI_CAN, FLEXCAN_RX_MB_STD_MASK(rxIdentifier, 0, 0));

by  this function, only setup one mailbox. I have two RX ID , how to initial/setup?

and how to get the data by flexcan_callback() function?

static void flexcan_callback(CAN_Type *base, flexcan_handle_t *handle, status_t status, uint32_t result, void *userData)
{
    switch (status)
   {
       case kStatus_FLEXCAN_RxIdle:
          if (RX_MESSAGE_BUFFER_NUM == result)
          {
             rxComplete = true;
          }
       break;

       case kStatus_FLEXCAN_TxIdle:
       if (TX_MESSAGE_BUFFER_NUM == result) 
       {
          txComplete = true;
       }
      break;

      default:
      break;
   }
}

Could you please give me one demo code to show how to work?

Labels (1)
0 Kudos
1 Reply

674 Views
FelipeGarcia
NXP Employee
NXP Employee

Hello Frank,

 

Please check my answers below:

 

1. Please check the following links as reference. I believe they could be useful.

 

https://community.nxp.com/thread/484816

https://community.nxp.com/thread/475008

https://community.nxp.com/thread/453975

 

2. In SDK examples flexcan_callback is only used to set flags such as rxComplete or txComplete. If you want to get the received or transmitted data I recommend you to use rxXfer.framefd and txXfer.framefd if you are using CAN FD or rxXfer.frame and txXfer.frame if you are using CAN.

 

Also, I recommend you to check chapter 37.3.2.5 of the reference manual.

 

I hope this helps!

Have a great day,
Felipe

-------------------------------------------------------------------------------
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