GD32VF103 User Manual
438
but may also be automatically shortened to compensate for negative phase drifts.
The bit time is shown as in the
Figure 20-11. The bit time
Sync
segment
Propagation
delay
segment
Phase buffer
segment 1
Phase buffer
segment2
Normal Bit Time
CAN
protocol
SYNG_SEG
BIT SEGMENT 1(BS1)
BIT SEGMENT 2(BS2)
CAN
The resynchronization Jump Width (SJW) defines an upper bound to the amount of
lengthening or shortening of the bit segments. It is programmable between 1 and 4 time
quanta.
A valid edge is defined as the first transition in a bit time from dominant to recessive bus level
provided the controller itself does not send a recessive bit.
If a valid edge is detected in BS1 instead of SYNC_SEG, BS1 is extended by up to SJW so
that the sample point is delayed.
Conversely, if a valid edge is detected in BS2 instead of SYNC_SEG, BS2 is shortened by
up to SJW so that the transmit point is moved earlier.
Baud rate
The CAN
’s clock derives from the APB1 bus. The CAN calculates its baud rate as follow:
𝐵𝑎𝑢𝑑𝑅𝑎𝑡𝑒 =
1
𝑁𝑜𝑟𝑚𝑎𝑙 𝐵𝑖𝑡 𝑇𝑖𝑚𝑒
(21-1)
𝑁𝑜𝑟𝑚𝑎𝑙 𝐵𝑖𝑡 𝑇𝑖𝑚𝑒 = 𝑡
𝑆𝑌𝑁𝐶_𝑆𝐸𝐺
+ 𝑡
𝐵𝑆1
+ 𝑡
𝐵𝑆2
(21-2)
with:
𝑡
𝑆𝑌𝑁𝐶_𝑆𝐸𝐺
= 1 × 𝑡
𝐶𝐴𝑁
(21-3)
𝑡
𝐵𝑆1
= (1 + 𝐵𝑇. 𝐵𝑆1) × 𝑡
𝐶𝐴𝑁
(21-4)
𝑡
𝐵𝑆2
= (1 + 𝐵𝑇. 𝐵𝑆2) × 𝑡
𝐶𝐴𝑁
(21-5)
𝑡
𝐶𝐴𝑁
= (1 + 𝐵𝑇. 𝐵𝑅𝑃) × 𝑡
𝑃𝐶𝐿𝐾1
(21-6)
20.3.8.
Error flags
The error management as described in the CAN protocol is handled entirely by hardware
using a Transmit Error Counter (TECNT value, in CAN_ERR register) and a Receive Error
Counter (RECNT value, in the CAN_ERR register), which get incremented or decremented