Hardware manual

RX600 Series CAN Application Programming Interface
R01AN0339EU0203 Rev. 2.03 Page 17 of 29
Mar 23, 2013
R_CAN_RxPoll
Checks if a mailbox has received a message
Format
uint32_t R_CAN_RxPoll( const uint32_t ch_nr,
const uint32_t mbox_nr );
Arguments
ch_nr 0,1,2,3 Which CAN bus to use. 1-4 channels may be available.
mbox_nr 0-32 Which CAN mailbox to check.
Return Values
R_CAN_OK There is a message waiting.
R_CAN_NOT_OK No message waiting or pending.
R_CAN_RXPOLL_TMO Message pending but timed out.
R_CAN_SW_BAD_MBX Bad mailbox number.
R_CAN_BAD_CH_NR The channel number does not exist.
Properties
Prototyped in r_can_api.h
Implemented in r_can_api.c
Comments
When a mailbox is set up to receive certain messages, it is important to determine when it has finished receiving
successfully. There are two methods for doing this:
1. Polling. Call the API regularly to check for new messages. USE_CAN_POLL must be defined in the CAN
configuration file. If there is a message use R_CAN_RxRead to fetch it.
2. Using the CAN receive interrupt (USE_CAN_POLL not defined): Use this API to check which mailbox
received. Then notify the application.
The function returns R_CAN_OK if new data was found in the mailbox.
Example
See example in R_CAN_RxRead.