Pauric, --- In lpc2000@yahoogroups.com, Pauric Doherty <pauric_doherty@y...> > I've tried to calculate my own bit timing values for the 14.745 MHz crystal > but they are a bit out on the actual baud rate. > > 125k baud: I got 0x001C001E (for the LPC's CANBTR register) that's a BRP of > 30 but that gives 122.875k baud. Is this tolerable? > > 250k baud: I got 0x001C000F (again for the LPC's CANBTR register) giving a > BRP of 15 that gives 245.750k baud. Again is this tolerable. > > I haven't tried it for any other baud rates. I'll try higher ones to see if > the level of error is reduced. Unfortunately this is a common problem with most CAN controllers. Typically the CAN bit time is divided into time quantas and the length of a time quanta is directly related to the CPU clock. So to achieve bit rates of 1Mbit, 500kbit, 250kbit or 125kbit you typically need "straight" frequencies like 8, 12, 24MHz. That is why several microcontrollers with CAN came up with different or additional clock generators for the other serial interfaces, or at least allow an external clock signal to be used for some of the other serial ports. In short: if you need typical CAN bit rates (for example those used by CANopen), you must choose an "even" frequency. Olaf Tutor at ESAcademy
Message
Re: CAN bit timing with 14.745 MHz crystal frequency
2004-07-21 by Tutors of ESAcademy
Attachments
- No local attachments were found for this message.