I have question about encoder mode. Can I use encoder mode for counting pulses and also generates interrupt on every counting pulse ? I need to set some variable on every encoder edge.
But which interrupt I should use ? I use STM32CubeMx for configuration encoder mode (TIM1) and in TIM1 configuration -> NVIC settings I see following interrupt:
- TIM1 break interrupt and TIM9 global interrupt
- TIM1 update interrupt and TIM10 global interrupt
- TIM1 trigger and communication interrupts and TIM11 global interrupt
- TIM1 capture compare interrupt
or maybe I should connect encoder parallel to encoder mode channels and do different pins with input capture ?
Encoder mode is a feature of the slave-mode controller, ie. it controls the counter itself. This is independent from the capture process. In other words, you still can have enabled capture (and thus capture interrupt) on individual channels while counting in encoder mode.
Read the TIM chapter in RM, start with the timer's block diagram.
Whether it makes sense to do so, it's up to you - don't forget that you'll have an interrupt to handle upon every edge, whatever the input rate is, including bouncing on the edges if present.
Thanks for your help, it's helpful
Retrieving data ...