2019-01-18 08:07 AM
I have STM32F446RE which is 180 Mhz, APB1 is running at 90 Mhz which is the timer clock
for prescaler 7 it is 1.04 Mhz
6 is 1.19 Mhz
8 is 922 Khz
I would assume that I could divide 90 Mhz by 90 to get nice 1 Mhz but it does not seem to be the case. I wonder why
I use CubeMx to setup timers.
2019-01-18 09:23 AM
The values are programmed as N-1 values, the silicon does a compare, the logic's easy to implement.
For 1MHz output
Prescaler = 0; // DIV 1
Period = 90 - 1; // DIV 90
2019-01-18 09:25 AM
Interrupting a 1 MHz will be problematic, use the TIM to output to a pin, or toggle it.
If the clocks are still wrong, printf("%d\n", SystemCoreClock); and see what the processor thinks it is running at. For example off 8 MHz HSE , or 16 MHz HSI