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