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 326 of 547
NXP Semiconductors
UM10398
Chapter 17: LPC11Cxx C_CAN on-chip drivers
17.4.8 CANopen handler
The CANopen handler processes the CANopen SDO messages to access the Object
Dictionary and calls the CANopen callback functions when initialized. It can either be
called by the interrupt handler automatically (isr_handled == TRUE in CANopen
initialization structure) or manually via the CANopen handler API function. If called
manually, the CANopen handler has to be called cyclically as often as needed for the
application.
In a typical CANopen application, SDO handling has the lowest priority and is done in the
foreground rather than through interrupt processing.
Example call:
// Call CANopen handler
(*rom)->pCAND->canopen_handler();
17.4.9 CAN/CANopen callback functions
The CAN API supports callback functions for various events. The callback functions are
published via an API function.
typedef struct _CAN_CALLBACKS {
void (*CAN_rx)(uint8_t msg_obj);
void (*CAN_tx)(uint8_t msg_obj);
void (*CAN_error)(uint32_t error_info);
uint32_t (*CANOPEN_sdo_read)(uint16_t index, uint8_t subindex);
uint32_t (*CANOPEN_sdo_write)(
uint16_t index, uint8_t subindex, uint8_t *dat_ptr);
uint32_t (*CANOPEN_sdo_seg_read)(
uint16_t index, uint8_t subindex, uint8_t openclose,
uint8_t *length, uint8_t *data, uint8_t *last);
uint32_t (*CANOPEN_sdo_seg_write)(
uint16_t index, uint8_t subindex, uint8_t openclose,
uint8_t length, uint8_t *data, uint8_t *fast_resp);
uint8_t (*CANOPEN_sdo_req)(
uint8_t length_req, uint8_t *req_ptr, uint8_t *length_resp,
uint8_t *resp_ptr);
} CAN_CALLBACKS;
Example callback table definition:
// List of callback function pointers
const CAN_CALLBACKS callbacks = {
CAN_rx,
CAN_tx,
CAN_error,
CANOPEN_sdo_exp_read,
CANOPEN_sdo_exp_write,
CANOPEN_sdo_seg_read,
CANOPEN_sdo_seg_write,
CANOPEN_sdo_req,
};