Getting an interrupt at specific encoder value
Beginner working with STM32L452:
I have TIM2 set up as encoder-based timer. Works perfect.
Now I want an interrupt whenever the TIM2 reaches a certain value (position).
I tried to enable timer interrupt through HAL_TIM_Encoder_Start_IT, and hoped to be able to get an interrupt when the encoder passed value 0. But I only managed to get an interrupt on every single encoder tick.
Reading a bit more on timers, i wonder if setting up another timer as slave to TIM2 would be the way forward ?
If yes, then how should the master/slave output/input be configured to have the slave follow TIM2 ? I have read the timer overview in 'en.DM00042534.pdf' but I don't understand all of it.
if no, what are my options then?
If a solution can be achieved through CubeMX configurator, i I would very much appreciate that, but it is not a must.
Thanks.
#interrupt #timer #hal_tim_encoder_start_it #interrupts #encoder