I am trying to understand the CAN1 BaudRate. Why can't I have a baud rate of exactly 1 Mbps?
I have a STM32F446 core and the Peripheral clock is 45 MHz.
I am looking at the RM0390 Rev 6 Section 30.7.7 Bit Timing
I am looking at the documentation Figure 395. Page 1063/1347
I want a bit rate of 1 million bits per second (Mbps)
In my calculation using the definitions in Figure 395, BRP = 14, TS1 = TS2 = 0 gives me exactly 1 Mbps.
But the Configuration Tool says the prescaler should be 16 (BRP = 15) which gives a Time Quantum of 355.555555555554 and with Time Quanta in Bit Segment 1 = 1 Time (TS1 = 0)
and Time Quanta in bit Segment 2 = 1 Time (TS2 = 0) The time for 1 bit is 1066.66 ns and the Baud Rate is 937500 bit/s
When I try to change the Prescaler (for Time quantum from 16 to 15 (BRP from 15 to 14) The Time Quantum is 333.3333333333...
the time for 1 bit is 999.99 ns (there is a truncation as opposed to rounding) and the Baud Rate is 1,000,000 bit/s
Am I getting hit with a floating point rounding error? And it thinks it is more than 1000000 bit/s as opposed to exactly 1000000 bit/s?
Can someone explain why it does not work with 15 (BRP 14) for the Prescaler (for the Time Quantum?
Is there more documentation on this in addition to RM0390?