EmbeddedRelated.com
Forums

LPC2129 CAN Bus Values for Keil uVision

Started by codinglikeits1999 July 27, 2009
I'm new to ARM development. I'm using the Keil uVision3 IDE and the Keil MCP2100 Dev Board with LPC 2129.

I need to know the values to set in order to make the CAN bus work at 500k. Below are the values for 125k and 250k as provided in the Keil demo example. I'm not sure for what tSEG and SJW these values were calculated.
// Keil Demo Common CAN bit rates
#define CANBitrate125k_12MHz 0x001C001D
#define CANBitrate250k_12MHz 0x001C000E
#define CANBitrate500k_12MHz ??

I see alot of posts describing how to caluculate the baud rate and all the factors involved but never can come up with the sample values provided by Keil so I'm sure that I'm doing something wrong. Additionally, I'm a bit overwhellmed by the whole ARM architecure so it sure would help in my debugging if I knew that I had the correct values for the CAN bus.

For my application I want to have the following values. Can someone calculate for me the values for CANBitrate250k_12MHz and CANBitrate500k_12MHz for the following criteria. Also, are there any other setting I need to change for the 500k bus as this may be considered "high speed"?

Oscillator = 12Mhz
Time Quanta = 12
HSCAN (500k): tSEG 1 = 9, tSEG2 = 2, SJW = 2
MSCAN (250K): tSEG1 = 7, tSEG2 = 4, SJW = 4

Thanks!

An Engineer's Guide to the LPC2100 Series

I could still use some help with this.

Can someone tell me the value for CANBitrate500k_12MHz under the following conditions:

Oscillator = 12Mhz
Time Quanta = 12
HSCAN (500k): tSEG 1 = 9, tSEG2 = 2, SJW = 2
MSCAN (250K): tSEG1 = 7, tSEG2 = 4, SJW = 4

// Keil Demo Common CAN bit rates
#define CANBitrate125k_12MHz 0x001C001D
#define CANBitrate250k_12MHz 0x001C000E
#define CANBitrate500k_12MHz ?????

Thanks.