cancel
Showing results for 
Search instead for 
Did you mean: 

CAN bit timing parameters for 125Kbps @ PCLK=48MHz

enricol
Associate II
Posted on July 19, 2008 at 09:42

CAN bit timing parameters for 125Kbps @ PCLK=48MHz

2 REPLIES 2
enricol
Associate II
Posted on May 17, 2011 at 09:54

Hi all,

I believe the CAN Bit Timing parameters given by the ST FW Lib in the 91x_can.c file are set for PCLK of 8MHz.

Code:

/* array of pre-defined timing parameters for standard bitrates*/

u16 CanTimings[] = { /* value bitrate NTQ TSEG1 TSEG2 SJW BRP */

CAN_TIMING(11, 4, 4, 5), /* 0x3AC4 100 kbit/s 16 11 4 4 5 */

CAN_TIMING(11, 4, 4, 4), /* 0x3AC3 125 kbit/s 16 11 4 4 4 */

CAN_TIMING( 4, 3, 3, 4), /* 0x2383 250 kbit/s 8 4 3 3 4 */

CAN_TIMING(13, 2, 1, 1), /* 0x1C00 500 kbit/s 16 13 2 1 1 */

CAN_TIMING( 4, 3, 1, 1), /* 0x2300 1 Mbit/s 8 4 3 1 1 */

};

With the above configuration @ PCLK=8MHz with 125Kbps, I can transmit/receive CAN messages to/from another CAN node.

However, when I set the PLL to 96MHz and PCLK to 48MHz, I increase the baudrate prescalar CAN->BTR_BRP by 6 times and keeping the same bit timing parameters by doing the following:

Code:

CAN_EnterInitMode(CAN_CR_CCE);

CAN_SetTiming(11, 4, 4, 24);

CAN_LeaveInitMode();

After the above initialization, I could only transmit to another CAN node @ 125Kbps, but I couldn't receive anymore. I also checked the CAN messages using oscilloscope and verified that the baudrate was @ 125Kbps. Why can't I receive any CAN message @ PCLK=48MHz?

hans239955_st
Associate
Posted on May 17, 2011 at 09:54

Hi,

/* array of pre-defined timing parameters for standard bitrates*/

/* 48MHz APB Clock!!!! */

u16 CanTimings[] = { /* value bitrate NTQ TSEG1 TSEG2 SJW BRP */

CAN_TIMING(13, 2, 1,300),/* 0x???? 10 kbit/s 16 13 2 1 300 */

CAN_TIMING(13, 2, 1,150),/* 0x???? 20 kbit/s 16 13 2 1 150 */

CAN_TIMING(13, 2, 1,60), /* 0x???? 50 kbit/s 16 13 2 1 60 */

CAN_TIMING(13, 2, 1,30), /* 0x???? 100 kbit/s 16 13 2 1 30 */

CAN_TIMING(13, 2, 1,24), /* 0x???? 125 kbit/s 16 13 2 1 24 */

CAN_TIMING(13, 2, 1,12), /* 0x???? 250 kbit/s 16 13 2 1 12 */

CAN_TIMING(13, 2, 1, 6), /* 0x???? 500 kbit/s 16 13 2 1 6 */

CAN_TIMING( 7, 2, 1, 6), /* 0x???? 800 kbit/s 10 7 2 1 6 */

CAN_TIMING( 5, 2, 1, 6), /* 0x???? 1 Mbit/s 8 5 2 1 6 */

};

mfg