3302 views|1 replies

2015

Posts

0

Resources
The OP
 

About CAN communication rate setting [Copy link]

one,

CAN clock cycle (Tq) = 2*crystal clock*BRP (baudrate prescaler)

A CAN time is called a time quantum Tq

1) Synchronization Segment: 1 Tq, tSS

2) Propagation Segment: The propagation segment duration is programmable (1 to 8 time quanta Tq), tPS

3) Phase Buffer Segment 1: Programmable length (1 to 8 time quanta Tq), tPBS1

4) Phase Buffer Segment 2: Programmable length (1 to 8 time quanta Tq), tPBS2

(Bit time) tBit = tSS + tPS + tPBS1 + tPBS2

2. In CAN communication, there are two synchronization mechanisms: hard synchronization and resynchronization

3. Synchronous jump width

During resynchronization, there is a concept called Synchro Jump Width (SJW), which indicates the maximum width allowed for jumps when PBS1 and PBS2 are resynchronized. The
Synchro Jump Width must meet the following conditions:

SJW must be less than the minimum value of PBS1 and PBS2.
The maximum value of SJW cannot exceed 4 (500kbps is usually 3)
(1) Bit rate: units are bps, Kbps, Mbps
1Mbps=1000Kbps=1000000bps
1Mbps=1000Kbps=1000000bps

(2) Bit time: tBit, the unit is generally nanosecond (ns)
tBit=1/bit rate

(3) Time quantum Tq:
Tq = 1/NBT (NBT represents the number of Tq contained in one bit time tBit, 500kbps is usually 16 or 20)

(4) Transmission delay time tPTS
When a CAN message is transmitted on the CAN bus, the physical delay consists of two parts:

Delays caused by transmission on CAN-BUS
Delays caused by transmission on nodes

According to the CAN communication protocol, the time length compensated for the propagation delay must be at least equal to twice the actual propagation delay length, that is:

tPTS ≥ 2 × tdel = 2 × (tdel + tBus)

(5) Message sending order

Byte order: LSB, bit order: MSb

4 Examples

The following example explains how to determine the bit timing parameters:
MCU crystal oscillator 16MHz, bit rate 500kbps, bus length 20m, unit bus delay 5ns/m, physical interface send and receive delay 150ns (general port delay minimum 300ns)

(1) Crystal oscillator clock period: T = 1s/16MHz = 62.5ns
(2) Bit time: tBit = 1/500kbps = 2000ns

Formula: tBit=NBT*(Tq), that is, tBit=NBT*(2*crystal oscillator clock period*BPR)


(3) BPR and NBT: Considering T = 62.5ns, tBit = 2000ns, BPR can only be 1 to satisfy NBT∈[8,25], so the pre-scaling factor BPR = 1;
(4) CAN clock period Tq = 2 × 62.5 × 1 = 125ns
(5) NBT = 16

(6) Transmission delay time tPTS ≥ 2 × tdel = 2 × (tdel + tBus), that is, tPTS ≥ 2 * (20 * 5 + 150) = 500ns, (bus length 20m, unit bus delay 5ns/m, physical interface send and receive delay 150ns). For diagnostic equipment, this time can be ignored because the bus length is very short.

tPTS_Tq=500/125=4

At this time, the synchronization segment is 1 Tq, the propagation segment is 4 Tq, and there are NBT-5=11 tq left. The sampling point meets 75%-80%, so the phase buffer segment 1 PBS1 is 6 tq, and the phase buffer segment 2 is 4 Tq; the synchronization jump width SJW=min{PBS1,4}=4

This post is from Microcontroller MCU

Latest reply

Very detailed write-up, thank you very much!   Details Published on 2020-3-18 00:18
 

1

Posts

0

Resources
2
 

Very detailed write-up, thank you very much!

This post is from Microcontroller MCU
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list