Implementation of CAN Driver on LPC1768
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am implementing a CAN driver for the LPC1768 microcontroller. During simulation there is no error, but while testing , I am encountering an ERRBIT : start of frame (SOF) in CAN interrupt and capture status register(CANxICR) and in CAN1GSR TXERR: 0x7F TCS:0.
My setup:
Software: keil u4
Microcontroller: LPC1768( ARM Cortex M3)
Baud rate: 500kbps
pin configuration: TD1(P0.1), RD1(P0.0)
CANxBTR register value: 0x00070004;
Init function:
void CAN_Init(uint8 CAN_Controller) {
volatile uint32 *powercontrol = (volatile uint32 *)PowerControl_Addr;
volatile uint32 *PCLKSEL0 = (volatile uint32 *)PCLKSEL0_Addr;
*PCLKSEL0 = 0x14000001;
if (CAN_Controller == 1) {
*powercontrol |= (0x01 << 13); // Power ON CAN1
} else if (CAN_Controller == 2) {
*powercontrol |= (0x01 << 14); // Power ON CAN2
}
}
baudrate snippet:
void CAN_Set_BaudRate(uint8 CAN_idx, uint32 baudrate_Kbps, uint32 PCLK_MHz, uint8 BRP, uint8 TSEG1, uint8 TSEG2) {
uint32 brp, btr_value;
btr_value = ((TSEG2 - 1) << 20) | ((TSEG1 - 1) << 16) | (0 << 14) | ((BRP-1)<<0);
if (CAN_idx == 1) {
CAN1->MOD = 1; // Enter Reset Mode
CAN1->BTR = btr_value; // Set BTR register
CAN1->MOD = 0; // ExIT
} else if (CAN_idx == 2) {
CAN2->MOD = 1; // Enter Reset Mode
CAN2->BTR = btr_value; // Set BTR register
CAN2->MOD = 0; // Exit Reset Mode
}
}
transmitter snippet:
I have verified my pin configuration and CAN settings but cannot identify why the error is persisting.
Request:
Could anyone suggest what might be causing the ERRBIT: Start of Frame, TXERR:0x0F and how to resolve it?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Laxmi_Gangal,
ERRBIT is when the CAN controller detects a bus error.
TXERR is the value of the Tx error counter, if a bus-off event occurs the TX error Counter is initialized to 127 (0x7F)
TCS: is the transmit complete status, when is on 0 it means that at least one requested transmission has not been successfully completed yet.
Could you help me checking the following?
What is the frame when reading it with a logic analyzer?
Are there other devices connected to the bus?
Also, you can take as reference the CAN demo based on lpc1769 under LPCopen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is the frame it is reading.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The main difference between LPC1768 and LPC1769 is the CPU frequency, however, you should be able to refer to LPC1769 in the CAN configuration.
Also, I recommend you to take a look to the following documentation regarding CAN
101: Controller Area Network (CAN) standard - NXP Community
If you connect the receiver do the frame stay the same?
