K60 Flexcan maximum mailboxes available

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

K60 Flexcan maximum mailboxes available

916 Views
juanandujar
Contributor I

Hello,

I would like to know the mailboxes available in the K60FX512. I set up the register CAN1_MCR |= CAN_MCR_MAXMB(31) and also the interrupt bits into the register CAN_IMASK1 for the 31 mailboxes . However, when the bit 16 of this register is enabled, it remains in 0. I have tried to find out the maximum of mailboxes available on this microcontroller but I have not been able to find out it.

If 16 (from 0 to 15) mailboxes are enabled, everything works properly, getting the interrupt flags.

Best Regards.


0 Kudos
Reply
1 Reply

754 Views
soledad
NXP Employee
NXP Employee

Hello Juan,

Unfortunately there is not an api in order to know the mailboxes available, however you can use the below functions:

the FLEXCAN_Int_status() function. This function returns the interrupt status of the specified FlexCAN module based on the value of ERRSTAT register.

Return Value

• FLEXCAN_OK (success)

• FLEXCAN_INVALID_ADDRESS (wrong device number)

• FLEXCAN_TX_RX_INT (any message buffer interrupt pending)

• FLEXCAN_ERROR_INT (error interrupt pending)

• FLEXCAN_BUSOFF_INT (bus off interrupt pending)

• FLEXCAN_WAKEUP_INT (wake up interrupt pending)

Example

/* get interrupt status */

uint32_t result = FLEXCAN_Int_status(0);

The FLEXCAN_Tx_mailbox() function.This function transmits message once. The mailbox must already be set up. The length of the input data buffer must correspond to the mailbox data length.

Return Value

• FLEXCAN_OK (success)

• FLEXCAN_INVALID_ADDRESS (wrong device number)

• FLEXCAN_INVALID_MAILBOX (wrong message buffer number)

Example

/* send data using message buffer 15 */

uint32_t result = FLEXCAN_Tx_mailbox(0,15,data_ptr);

The FLEXCAN_Rx_mailbox() function. This function receives data from a given message buffer. User should check the error codes for appropriate

handling. The mailbox is again activated and prepared for further receiving.

Return Value

• FLEXCAN_OK (data received, success)

• FLEXCAN_MESSAGE_BUSY (data received, but the state was busy)

• FLEXCAN_MESSAGE_LOST (data received, but one or more messages were lost)

• FLEXCAN_INVALID_ADDRESS (wrong device number)

• FLEXCAN_INVALID_MAILBOX (wrong message buffer number)

• FLEXCAN_NO_MESSAGE (mailbox is empty)

Example

/* receive data from message buffer 15 */

uint32_t result = FLEXCAN_Rx_mailbox(0,15,data_ptr);

Please find more information in the Freescale MQX™ I/O Drivers – User Guide (chapter 17) that you can find at the next path: C:\Freescale\Freescale_MQX_4_1\doc\mqx


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------