AP29000
Connecting C166 and C500 Microcontroller to CAN
Ways of handling the SAE 81C90/91 and the CAN Module on the C167CR / C515C
Application Note
43
V 1.0, 2004-02
6.3
Configuration of the Bit Timing
Before initializing the CAN controllers, one has to think about the internal frequencies
of the devices as well as the baudrate of the CAN bus. The registers that are
responsible for the bit timing contain the parameters TSEG1, TSEG2, SJW and BRP
which have to be programmed accordingly.
In the following section, a way to determine these parameters for a special controller
frequency (e.g. 20 MHz) and a certain CAN baudrate (e.g. 125 kbit/s) shall be
presented. The calculations are based on the following (rough) structure of one bit time
(figure 17):
Figure 17
Rough Structure of one Bit Cell in the CAN Module
of the C167CR / C515C and in the SAE 81C90/91
The following equations apply to figure 17 :
t
BIT
=
t
SYNC
_
SEG
+ t
PHASE
_
SEG
1 + t
P
H
ASE
_
SEG
2 (1)
t
SYNC
_
SEG
= 1
*
tq
(2)
t
PHASE
_
SEG
1 =
(TSEG1 + 1) * tq
(3)
t
PHASE
_
SEG
2 =
(TSEG2 + 1) * tq
(4)
tq
=
(BRP + 1) * t
CAN
_
CLOCK
(5)
t
SJW
=
(SJW + 1) * tq
(6)
}
1 bit time t
BIT
Length:
(TSEG1+1)*tq
Length:
(TSEG2+1)*tq
1 time quantum
Length: tq
Sample-
point
SYNC_SEG
PHASE_SEG2
PHASE_SEG1
(+ PROP_SEG )