Question
Can I set a timer in encoder mode and gated mode simultaneously with the STM32F76ZI?
Posted on March 09, 2018 at 22:06
I am using STM32Cube to setup my timers. I would like to have TIM1 in Encoder Mode. I would like to do two things:
- When the counter overflows, I would like to enable TIM2. If I look through the reference documentation, is it correct to say I can do this by setting (in code) TIM1 to Master Mode: Update (The update event is selected as trigger output), and setting TIM2 to Slave Mode with Trigger Source ITR0? Is there any reason I can't set Master Mode in STM32Cube?
- I would like to enable TIM1 on the rising edge of an external input. I notice in STM32Cube, if my timer is NOT set to Encoder Mode, I can set TIM1 to Slave Mode: Gated with Trigger Source: ETR1. However, if my timer IS set to Encoder Mode, I cannot set the Slave Mode. Therefore, my question is, what's the best way to ensure that TIM1 starts only on an external trigger? Should I use the CPU to monitor a GPIO pin and then enable TIM1, or is there an alternative, more elegant solution?
Thanks for all of your help.
