AnsweredAssumed Answered

CAN network bit timing clarification

Question asked by Maciek on Mar 12, 2020
Latest reply on Mar 17, 2020 by dumitru-daniel.popa

I have problems with setting proper CAN baud rate for CAN network with baud rate approx. 65.83Kbit/s.

Please clarify the following points:


1. For default settings of S32K144 Devkit (XTAL freq. 8MHz, System Clock freq. 80MHz):
- setting "CAN Engine Clock Source" as 'Peripheral clock' -> gives CAN PE clock 80MHz
- setting "CAN Engine Clock Source" as 'Oscillator clock' -> gives CAN PE clock 8MHz
Is it true ?


2. Usually the 'nominal bit rate/nominal CAN baud rate' for CAN is calculated using the sum of 4 segments: Sync. segment, Propagation segment, Phase Segment 1 and Phase Segment 2.
Looking at the generated code for standard Bitrates like: 50Kbit/s, 100Kbit/s, 250Kbit/s - I've found that FCAN_Config block computes 'nominal bit time' as the sum of 5 segments: sync., propag., phase1, phase2 and RJW (resync. jump width). Why RJW is used in computing nominal bit time ? Or maybe I've misinterpreted something ?


3. Because calculated values for Prescaler Divider and Segments didn't work for me (there was no communication in 65.83Kbit/s network) - I've adjusted the bit length (nominal bit time) 'by hand' using oscilloscope.
I've set the following fields in the FCAN_Config block mask:
- clock source: 'Peripheral clock'
- Prescaler Divider: 75 (which gives Sclock = 80MHz/(75 + 1)
- Resync Jump Width: 2
- Phase Segment 1: 6
- Phase Segment 2: 5
- Propag. Segment: 1
(thus the full bit is 15TQ - including RJW into bit time)
And with these settings the S32K144-devkit successfully receives messages from the 65.83Kbit/s network. The problem is that from calculations the nominal bit length should be: (76 * 15)/80MHz = 14.25us.
But on the oscilloscope I see the actual bit length around 15.25us! This is a very big difference! Why do I see such length with these settings ? Maybe I don't understand the calculations behind the CAN baud rate ?
(I've checked all that on low-bandwidth Tektronix - but 1us difference is clearly visible; I will measure the difference with better oscilloscope/logic analyzer soon...)


Waiting for Your response