Can I set a timer in encoder mode and gated mode simultaneously with the STM32F76ZI?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-03-09 1:06 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-03-11 1:59 PM
Is there any reason I can't set Master Mode in STM32Cube?
Cube - as any other library - usually provides support for standard usage scenarios. It's quite unusual to do anything on update in encoder mode - and I'd say, if you want to do that, you are probably mistaken in your problem analysis.
Otherwise I don't see any problem setting TRGO to Update in encoder mode (and then whatever slave mode in the target timer).
However, if my timer IS set to Encoder Mode, I cannot set the Slave Mode.
Encoder mode *is* one of the slave modes. Read the TIM chapter of RM, concentrate on the description of TIMx_SMCR.
Also, Encoder mode *does* work only on externally supplied signals, why would you want to start it in any particular way?
You may want to tell us what do you want to accomplish.
JW
