Syncronous Timers
Hi,
I'm running two timers on STM32F303 which do square wave output on two hardware pins. They are clocked by the 72MHz internal clock. They count down to 0 and reload from ARR register, which sets the output frequency. The two timers run perfectly syncronous, i.e the CNT registers of the timers have a constant offset.
Then I permanently have to switch the frequency for both timers by modifying the ARR registers. As a result the CNT registers of the two timers begin to slip, i.e. the offset is changing.
I suspect the following: I modify the two ARR registers consecutively. I check for CNT counters to be high enough so no reload takes place while modifying the ARR registers. Maybe an interrupt happens in between ARR update for the first counter and ARR update for the second counter. So one CNT register is updated from the old ARR value, the other from the new one. So the two counter values begin to slip.
I use the eval board for STM32F303 and initialize all to the default values with CubeIDE12. I hope and I'm quite sure I killed all interrupt sources, but there are hidden corners in CubeIDE. When I check the runtime of an arbitrary set of code I get changing numbers of systicks for that code. I'm running the board over the USB debug setup from the host, so the debug may kick in with interrupts.
How can I switch off all interrupt, especially with regard to CubeIDE and debug mode from host?
Thank you.
Cheers
Detlef
