
M0A21/M0A23 Series
May 06, 2022
Page
625
of 746
Rev 1.02
M0
A21
/M
0
A
2
3
SE
RIES
TEC
H
NICAL
RE
FEREN
C
E
M
ANUAL
bit time; the Bit Timing Logic (configured by TSEG1, TSEG2 and SJW) defines the number of time
quanta in the bit time.
The processing of the bit time, the calculation of the position of the Sample Point, and occasional
synchronizations are controlled by the BTL (Bit Timing Logic) state machine, which is evaluated once
each time quantum. The rest of the CAN protocol controller, the BSP (Bit Stream Processor) state
machine is evaluated once each bit time, at the Sample Point.
The Shift Register sends the messages serially and parallelizes received messages. It’s loading and
shifting is controlled by the BSP.
The BSP translates messages into frames and vice versa. It generates and discards the enclosing fixed
format bits, inserts and extracts stuff bits, calculates and checks the CRC code, performs the error
management, and decides which type of synchronization is to be used. It is evaluated at the Sample
Point and processes the sampled bus input bit. The time that is needed to calculate the next bit to be
sent after the Sample point (e.g. data bit, CRC (Cyclic Redundancy Check) bit, stuff bit, error flag or
idle) is called the Information Processing Time (IPT).
The IPT is application specific but may not be longer than 2 tq; the IPT for the C_CAN is 0 tq. Its length
is the lower limit of the programmed length of Phase_Seg2. In case of a synchronization, Phase_Seg2
may be shortened to a value less than IPT, which does not affect bus timing.
Calculating Bit Timing Parameters
Usually, the calculation of the bit timing configuration starts with a desired bit rate or bit time. The
resulting bit time (1/bit rate) must be an integer multiple of the APB clock period.
The bit time may consist of 4 to 25 time quanta, the length of the time quantum tq is defined by the Baud
Rate Prescaler with tq = (Baud Rate Prescaler)/fapb_clk. Several combinations may lead to the desired
bit time, allowing iterations of the following steps.
First part of the bit time to be defined is the Prop_Seg. Its length depends on the delay time measured
in the APB clock. A maximum bus length as well as a maximum node delay has to be defined for
expandible CAN bus systems. The resulting time for Prop_Seg is converted into time quanta (rounded
up to the nearest integer multiple of tq).
The Sync_Seg is 1 tq long (fixed), leaving (bit time
– Prop_Seg – 1) tq for the two Phase Buffer
Segments. If the number of remaining tq is even, the Phase Buffer Segments have the same length,
Phase_Seg2 = Phase_Seg1, else Phase_Seg2 = Phas 1.
The minimum nominal length of Phase_Seg2 has to be regarded as well. Phase_Seg2 may not be
shorter than the IPT of the CAN controller, which, depending on the actual implementation, is in the
range of [0..2] tq.
The length of the Synchronization Jump Width is set to its maximum value, which is the minimum of 4
and Phase_Seg1.
The oscillator tolerance range necessary for the resulting configuration is calculated by the formulas
given in Section “Oscillator Tolerance Range”.
If more than one configuration is possible, that configuration allowing the highest oscillator tolerance
range should be chosen.
CAN nodes with different system clocks require different configurations to come to the same bit rate.
The calculation of the propagation time in the CAN network, based on the nodes with the longest delay
time, is done once for the whole network.
The oscillator tolerance range of the CAN systems is limited by that node with the lowest tolerance
range.
The calculation may shows that bus length or bit rate have to be decreased or that the stability of the
oscillator frequency has to be increased in order to find a protocol compliant configuration of the CAN
bit timing. The resulting configuration is written into the Bit Timing Register: (Phase_Seg2-1) &
(PhaProp_Seg-1) & (SynchronisationJumpWidth-1) & (Prescaler-1)