#Timer Calculations Because I felt like it only a single timer (TIM2) is used for timing the CAN messages. hopefuly this is ok.
Given a 48 MHz clock frequency, and the desired intervals of 48ms, 56ms, 104ms, and 152ms, we need to calculate the appropriate prescaler and compare values.
To start with, we need to configure the timer to overflow every 8ms, which will be our base interval.
Calculating the Prescaler and Overflow for 8ms:
Simplifying this, we get:
For the Prescaler:
Simplifying further:
I think this is correct?
Now, for the desired intervals, they translate to the following compare values:
48ms => 48ms/8ms = 6 counts.
56ms => 56ms/8ms = 7 counts.
104ms => 104ms/8ms = 13 counts.
152ms => 152ms/8ms = 19 counts.