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 325 of 547
NXP Semiconductors
UM10398
Chapter 17: LPC11Cxx C_CAN on-chip drivers
Example OD tables and CANopen configuration structure:
// List of fixed, read-only Object Dictionary (OD) entries
// Expedited SDO only, length=1/2/4 bytes
const CAN_ODCONSTENTRY myConstOD [] = {
// index subindex length value
{ 0x1000, 0x00, 4, 0x54534554UL }, // "TEST"
{ 0x1018, 0x00, 1, 0x00000003UL },
{ 0x1018, 0x01, 4, 0x00000003UL },
{ 0x2000, 0x00, 1, (uint32_t)'M' },
};
// List of variable OD entries
// Expedited SDO with length=1/2/4 bytes
// Segmented SDO application-handled with length and value_pointer don't care
const CAN_ODENTRY myOD [] = {
// index subindex access_type|length value_pointer
{ 0x1001, 0x00, OD_EXP_RO | 1, (uint8_t *)&error_register },
{ 0x1018, 0x02, OD_EXP_RO | 4, (uint8_t *)&device_id },
{ 0x1018, 0x03, OD_EXP_RO | 4, (uint8_t *)&fw_ver },
{ 0x2001, 0x00, OD_EXP_RW | 2, (uint8_t *)&param },
{ 0x2200, 0x00, OD_SEG_RW, (uint8_t *)NULL },
};
// CANopen configuration structure
const CAN_CANOPENCFG myCANopen = {
20, // node_id
5, // msgobj_rx
6, // msgobj_tx
TRUE, // isr_handled
sizeof(myConstOD)/sizeof(myConstOD[0]), // od_const_num
(CAN_ODCONSTENTRY *)myConstOD, // od_const_table
sizeof(myOD)/sizeof(myOD[0]), // od_num
(CAN_ODENTRY *)myOD, // od_table
};
Example call:
// Initialize CANopen handler
(*rom)->pCAND->config_canopen((CAN_CANOPENCFG *)&myCANopen[0]);