TIM2 and TIM3 Behaivoural Differences
Hello,
I am trying to write some non-blocking motor driver code for a STM32F401Re board. Currently, I am setting the timers to PWM mode and adjusting the ARR to change the PWM frequency using an IRQ handler. This approach is working for TIM3 output, but TIM2 seems to stop outputting after one iteration of the while loop. I've been through the registers and it looks like the CC1IF isn't always being set for TIM2 and I'm not sure why. By adjusting the ARR, shouldn't both timers roll-over after hitting their new max value?
I've attached the main file and the A4988 driver file I'm writing. For the A4988 file, the methods in question are A4988_run() and A4988_IRQ_Handler().
Thanks!
