Pro I: Signal Conditioning and Interface Modules
Pro-CAN-x Rev. A
ADwin
174
ADwin-Pro
Hardware, manual version 2.9, June 2006
Setting the bus frequency
The
CAN bus frequency
depends on the configuration of the controller.
The initialization with
INIT_CAN
configures the controller automatically to a
CAN bus frequency of 1 MHz. If the CAN bus is to operate with a different fre-
quency, the values in the "Bit Timing Register 0" (BTR0, address 3Fh) and in
the "Bit Timing Register 1" (BTR1, address 4Fh) have to be changed. Just use
the instruction
SET_CAN_BAUDRATE
for setting a large quantity of bus fre-
quencies.
With low speed CAN the maximum bus frequency is 125kBit/s.
Bus frequency for
special cases
In some special cases it may be better to select configurations other than those
set with the instruction mentioned above. For this purpose specified registers
have to be set with the instruction
POKE
. The structure of the register is
described below.
The following table shows the admitted values and the meaning of the individ-
ual ranges:
The default setting of the ranges SJW and SPL is 0 and should only be
changed if necessary. Select the sample point (specified by TSEG1 and
TSEG2) in such a way that it is between 50% and 80% of the total bit length.
The CAN bus frequency is calculated as follows:
The following table illustrates all common settings for the Baud rates.
Access to the two timing registers is only possible, when the access has been
enabled before. This is done by the CCE-bit in the control register. The bit has
to be reset afterwards.
Bit Timing Register 0
(BTR0)
Bit Timing Register 1
(BTR1)
Bits
7…6
5…0
7
6…4
3…0
Sub-Reg.
SJW
BRP
SPL
TSEG2 TSEG1
Range
Admitted
values
Meaning
SJW
0 … 3
Max. pulse elongation during bus synchronization
BRP
0 … 63
Pre-scaler
SPL
0 … 1
Sampling mode
TSEG1
2 … 15
Time segments before sampling
TSEG2
1 … 7
Time segments after sampling
Baud rate [kBit/s]
125
250
500
1.000
BRP
3
1
0
0
TSEG1
6
6
6
2
TSEG2
7
7
7
3
BTR0
03h
01h
00h
00h
BTR1
76h
76h
76h
32h
Sample point[%]
54
54
54
60
Fig. 306 – CAN: Setting the Baud rates
f
CAN
8MHz
BRP 1
+
(
)
TSEG1 TSEG2 3
+
+
(
)
----------------------------------------------------------------------------------------
=