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 328 of 547
NXP Semiconductors
UM10398
Chapter 17: LPC11Cxx C_CAN on-chip drivers
Remark: The callback is not called after the user CANopen handler has used a message
object to transmit an SDO response.
17.4.12 CAN error callback
The CAN error callback function is called on the interrupt level by the CAN interrupt
handler.
// error status bits
#define CAN_ERROR_NONE 0x00000000UL
#define CAN_ERROR_PASS 0x00000001UL
#define CAN_ERROR_WARN 0x00000002UL
#define CAN_ERROR_BOFF 0x00000004UL
#define CAN_ERROR_STUF 0x00000008UL
#define CAN_ERROR_FORM 0x00000010UL
#define CAN_ERROR_ACK 0x00000020UL
#define CAN_ERROR_BIT1 0x00000040UL
#define CAN_ERROR_BIT0 0x00000080UL
#define CAN_ERROR_CRC 0x00000100UL
Example call:
// CAN error handler
void CAN_error(uint32_t error_info)
// If we went into bus off state, tell the application to
// re-initialize the CAN controller
if (error_info & CAN_ERROR_BOFF)
reset_can = TRUE;
return;
}
17.4.13 CANopen SDO expedited read callback
The CANopen SDO expedited read callback function is called by the CANopen handler.
The callback function is called before the SDO response is generated, allowing to modify
or update the data.
Example call:
// CANopen callback for expedited read accesses
uint32_t CANOPEN_sdo_exp_read(uint16_t index, uint8_t subindex)
{
// Every read of [2001h,0] increases param by one
if ((index == 0x2001) && (subindex==0))
param++;
return 0;
}
Remark: If the flag isr_handled was set to TRUE when initializing CANopen, this callback
function will be called by the CAN API interrupt handler and therefore will execute on the
interrupt level.