Created Tue, 06 Mar 2012 08:22:23 +0000 by RonnyE
Tue, 06 Mar 2012 08:22:23 +0000
Hi, I am new in this forum and actually I program for the automotive industry. The mostly setted CAN baudrate are 125k, 250k or 500kBaud. But for e.g heading or in the industry area this value can be set to 20kBaud. And also the examples in this forum are for the higher baud rates.
I have a problem with the baud prescaler. On the max32 i have a CPU frequency of 80 Mhz. I need a baud rate on CAN of [color=#0000FF]20 kBaud[/color]. The formula to calculate the prescaler is
BRP = (FrequencyCPU/(number of t-quanta2 baudrate) ) -1
so in my case i have the following calculate:
BRP = (80.000.000/(25 * 2 * 20.000)) - 1 = 79 BRP = (80.000.000/(20 * 2 * 20.000)) - 1 = 99 BRP = (80.000.000/(16 * 2 * 20.000)) - 1 = 124 BRP = (80.000.000/(10 * 2 * 20.000)) - 1 = 199
The problem is the 6 bit BRP value in the CAN config register C1CFG. The biggest possible value is d63 ( 0x3F / b111111). But i need a value of 79,99,124 or 199.
How can i set the cpu frequency pre prescale to set reasonable BRP in the CAN config register
best regards RonnyE
Mon, 26 Mar 2012 14:11:21 +0000
Hi developer, the last working configuration is with set the CAN_BUS_SPEED to 33.3 kBaud. When i am try the Baudrate set to 20kBaud it does'nt work. I have also try some configuration with the propagation, phase segment 1 and phase segment 2 settings. Unfortunately, without success. I have also tried some bitconfigurators like ics2510BitTime.exe from kvaser or this online bittime configurator from port.de . The prescaler settings, see below, are wrong because i have take the controller oszillator not the CAN osczillator frequence. Is this right? I am think the library of CAN calculate the wrong Prescaler in the function "setspeed". When i am run the program on Chipkit max32 the baudrate scanner form CANoe (Vector Informatik) shows me the wrong values.
Has anyone an idea