Can TIMx_CNT value for STM323DF4 be reloaded on the fly?
I have a custom board design using a STM32F407. Timer6 is running in interrupt mode with a 42 usec period. I also have Timer7 running in interrupt mode with a 3 second period (upcount mode).
Each time the Timer6 interrupt runs I reset the Timer7 TIM7_CNT register with this code:
HAL_TIM_Base_Stop_IT(&htim7);
TIM7->CNT = 0; // reset Timer7 count register
HAL_TIM_Base_Start_IT(&htim7);I tried to reset TIM7_CNT without stopping and restarting the timer but it doesn't work that way. Is there a way the count register can be reset without stopping and restarting the timer? I have worked with other processors that allow you to change the timer count registers on the fly.
The 407 is running at 168 MHz. Looking at the family reference manual the start and stop operations appear to only take one clock cycle. So there is no real delay caused by starting and stopping the timer. I am just curious if the count reset can be done with one instruction.
There is an asynchronous process that is triggered by external hardware. It may run 50 times a day or it may run 0 times per day. When the process starts, it starts Timer6 and Timer7. As long as the process continues to run, Timer7 is constantly reset. When the process stops and doesn't restart within 3 seconds, Timer7 times out and the interrupt fires. Timer6, Timer7, and other hardware is then shutdown.