Datasheet

UM10398 All information provided in this document is subject to legal disclaimers. © NXP B.V. 2014. All rights reserved.
User manual Rev. 12.3 — 10 June 2014 323 of 547
NXP Semiconductors
UM10398
Chapter 17: LPC11Cxx C_CAN on-chip drivers
Transmit message objects are automatically configured when used.
// control bits for CAN_MSG_OBJ.mode_id
#define CAN_MSGOBJ_STD 0x00000000UL // CAN 2.0a 11-bit ID
#define CAN_MSGOBJ_EXT 0x20000000UL // CAN 2.0b 29-bit ID
#define CAN_MSGOBJ_DAT 0x00000000UL // data frame
#define CAN_MSGOBJ_RTR 0x40000000UL // rtr frame
typedef struct _CAN_MSG_OBJ {
uint32_t mode_id;
uint32_t mask;
uint8_t data[8];
uint8_t dlc;
uint8_t msgobj;
} CAN_MSG_OBJ;
void config_rxmsgobj (CAN_MSG_OBJ * msg_obj)
Example call:
// Configure message object 1 to receive all 11-bit messages 0x000-0x00F
msg_obj.msgobj = 1;
msg_obj.mode_id = 0x000;
msg_obj.mask = 0x7F0;
(*rom)->pCAND-> config_rxmsgobj(&msg_obj);
17.4.5 CAN receive
The CAN receive function allows reading messages that have been received by an Rx
message object. A pointer to a message object structure is passed to the receive function.
Before calling, the number of the message object that is to be read has to be set in the
structure.
void config_rxmsgobj (CAN_MSG_OBJ * msg_obj)
Example call:
// Read out received message
msg_obj.msgobj = 5;
(*rom)->pCAND->can_receive(&msg_obj);
17.4.6 CAN transmit
The CAN transmit function allows setting up a message object and triggering the
transmission of a CAN message on the bus. 11-bit standard and 29-bit extended
messages are supported as well as both standard data and remote-transmit (RTR)
messages.
void config_txmsgobj (CAN_MSG_OBJ * msg_obj)
Example call:
msg_obj.msgobj = 3;
msg_obj.mode_id = 0x123UL;