cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Bit timing Calculation

leesh
Associate II
Posted on May 17, 2009 at 15:50

CAN Bit timing Calculation

3 REPLIES 3
leesh
Associate II
Posted on May 17, 2011 at 13:08

(RM p510)

CAN BaudRate = 1 / NominalBitTime

- NominalBitTim = 1*tq + tBS1 + tBS2

- tBS1 = tq * (TS1 + 1), tBS2 = tq * (TS2 + 1)

- tq = (BRP + 1) * tPCLK

- then...

- NominalBitTim = 1*tq + tBS1 + tBS2

= 1*tq + tq * (TS1 + 1) + tq * (TS2 + 1)

= tq(1 + (TS1 + 1) + (TS2 + 1))

= tq(3 + TS1 + TS2)

- if BaudRate = 20K...

20K = 1 / (tq(3 + TS1 + TS2)

- TS1= 1, TS2 = 1

20K = 1 / (tq(3 + 1 + 1)

20K * 5 = 1 / tq

100K = 1 / ((BRP + 1) * tPCLK)

- tPCLK = APB1 = 1/36MHz = 27ns

1 / 100K = (BRP + 1) * 27ns

10us / 27ns = BRP + 1

BRP = 360 - 1

BRP = 359

is right calculation?

amin2
Associate II
Posted on May 17, 2011 at 13:08

your calculation is correct , but you have to respect the standard rule : 8=

I suggest you to use

BRP = 149

TS1 = 7

TS2 = 2

attached an xls file tio calculate the Baudrate

Amin

[ This message was edited by: amin.agina on 17-05-2009 19:24 ]

adamajames
Associate II
Posted on May 17, 2011 at 13:08

Dear Amin,

Can you reattach the xls file as I'm after the correct setting on the STM32F103 for 500kbps and 250kbps CAN.

I get a bit error every now an then. Do you?

Regards,

PB