AnsweredAssumed Answered

STM32F407: Cascade 16 Bit timer in encoder mode to increase count range

Question asked by Markus Rudolf on Jan 26, 2017
Latest reply on Jan 26, 2017 by Markus Rudolf


I have two freshly created projects with the STM32F407 in 100 Pin LQFP housing. I admit I didn't read the datasheet properly and found out afterwards that not all timers are 32 bit timers (which I would expect in a 32 bit micro..., lesson learned...).


In both projects I use a 16 bit timer in encoder mode. I need higher count range, overflow occurs now at 65535, I would need more like 24 bit or better the full 32bit.


For one project it's feasible to rewire the two encoder phases to one of the 32bit timers (TIM2 orTIM5) which are unused, so that would be an option, though I would prefer a software fix.


In the other project I use Ethernet in RMII mode which stupidly blocks both 32bit timers for use in encoder mode as there are not enough pin remapping options (at least CubeMX says so). So this would require a complete redesign using a TQFP144 package at least (which needs more board space and has supply chain issues).


I read about the possibility of daisy chaining two 16bit timers to get a 32bit count range, but unfortunately I don't understand if and how that would work in encoder mode. The timers are pretty complex in the datasheet and I could find an example for daisy chain in encoder mode.


If someone could give me a hint how this can be accomplished I would really appreciate it.