How to start and stop 2 Timers in synchronisation without using HAL library functions
Hello,
I am using STM32G4 series controller. I am using Timer 2 channel 2 as trigger source for Timer 4 and Timer 2 channel 3 for PWM generation. Also Timer4 channel 1 is used for PWM generation. First time both the timers Timer2 and Timer4 starts at exactly same time. I have observed that on DSO by checking position of the PWM pulse of both the timers which starts at exactly same position. When I stop the timer using HAL_TIM_OC_Stop(&htim2, TIM_CHANNEL_2) and HAL_TIM_PWM_Stop(&htim2, TIM_CHANNEL_3); function, Both the timers stops but timers are not starting at the same time again when I start it using HAL_TIM_OC_Start(&htim2, TIM_CHANNEL_2); and HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_3); function. The PWM pulse of both the timers getting shifted and not at the same position even though I have keep the same duty cycle for both the PWM channels.
Can anyone help me in this case, how can we stop an restart the timers without using HAL library functions. By just changing the registers values?
Any help would be appreciated.
Thanks in advance.
Kirti
