Hardware manual
RX600 Series CAN Application Programming Interface
R01AN0339EU0203 Rev. 2.03 Page 16 of 29
Mar 23, 2013
R_CAN_RxSet and R_CAN_RxSetXid
Set up a mailbox to receive
R_CAN_RxSet The API sets up a given mailbox to receive data frames with the given CAN ID. Incoming data frames
with the same ID will be stored in the mailbox.
R_CAN_RxSetXid does the same thing, except if this function is used, the ID will be a 29-bit ID.
Format
uint32_t R_CAN_RxSet( const uint32_t ch_nr,
const uint32_t mbox_nr,
const uint32_t id,
const uint32_t frame_type );
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 use.
sid 0-7FF
h
The standard CAN ID which the mailbox should receive.
frame_type DATA_FRAME Send a normal data frame.
REMOTE_FRAME Send a remote data frame request.
Return Values
R_CAN_OK Action completed successfully.
R_CAN_SW_BAD_MBX Bad mailbox number.
R_CAN_BAD_CH_NR The channel number does not exist.
R_CAN_SW_SET_TX_TMO Waiting for previous transmission to finish timed out.
R_CAN_SW_SET_RX_TMO Waiting for previous reception to complete timed out.
Properties
Prototyped in r_can_api.h
Implemented in r_can_api.c
Comments
The function will first wait for any previous transmission/reception to complete, then temporarily interrupt disable
the mailbox. It sets the mailbox to the given standard ID value, and whether to receive normal CAN dataframes or
remote frame requests.
Example
#define MY_RX_SLOT 8
#define SID_FAN_SPEED 0x10
R_CAN_RxSet(0, MY_RX_SLOT, SID_FAN_SPEED, DATA_FRAME);