SPRUIE9D May 2017 – May 2024 DRA74P , DRA75P , DRA76P , DRA77P
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 CAN clock period.
The bit time may consist of 8 to 25 time quanta. The length of the time quantum tq is defined by the baud rate prescaler with tq = (Baud Rate Prescaler) / FCLK. 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 times measured in the system. 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 = Phase_Seg1 + 1.
The minimum nominal length of Phase_Seg2 has to be regarded as well. Phase_Seg2 may not be shorter than any CAN controller’s Information Processing Time in the network, which is device dependent and can be 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 four (4) and Phase_Seg1.
The oscillator tolerance range necessary for the resulting configuration is calculated by the formulas given in Table 26-745.
If more than one configurations are possible to reach a certain Bit rate, it is recommended to choose the configuration which allows the highest oscillator tolerance range.
CAN nodes with different 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 times, is done once for the whole network.
The CAN system’s oscillator tolerance range is limited by the node with the lowest tolerance range.
The calculation may show that bus length or bit rate have to be decreased or that the oscillator frequencies’ stability 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 (DCAN_BTR):
[14:12] TSEG2 = Phase_Seg2 - 1
[11:8] TSEG1 = Phase_Seg1+ Prop_Seg - 1
[7:6] SJW = SynchronizationJumpWidth - 1
[5:0] BRP = Prescaler - 1