I'm trying to configure the CAN bit rate of an ATSAMC21 to 125ksps in a CAN2.0B configuration. However, after reading through the datasheet, the ASF documentation and the ATMEL start help I'm confused.
I got mainly 3 questions:
What is the difference between "Data bit timing" and "Nominal bit timing".<-- For this part of the question I already figured out the answer. Please see my own answer below.- How is the time quanta/bit rate calculated?
- How to set up the ATSAMC21 CAN module as CANV2.0B with 125ksps while using a 8Mhz CAN clock?
Background for question 1)
In ATMEL Start, these settings look like this and there is:
The datasheet does specify 2 different registers for this as well, but I don't find any clear explanation what's the difference and which one is used when. Also, a thorough google search and going through diverse www.avrfreaks.net threads did not bring any light into that matter.
This is page 706 of the datasheet showing the data bit timing.
This is page 713 of the datasheet showing the nominal bit timing:
Background for question 2)
On page 707 the datasheet shows
On page 706 the datasheet shows
However, this confuses me. With a 8Mhz clock and a Prescaler of 1, I would calculate the bitrate like Datarate = 8Mhz / Prescaler / (Phase_Seg1 + Phase_Seg2).
With the data shown in ATMEL start and also with the initial register value in the datasheet this results in 8M/(11+4)=5.333ksps. <- What am I missing here?
After digging around on the Microchip product page of the ATSAMC21 I found this APPNOTE which got me even more confused. On page 4 this document describes, how to calculate the bit rate and it even uses the Data resynchronization jump width into the calculation. If I calculate the above example with the Jump width the data bit rate results in 8M/(11+4+4)=4.21ksps.