2019-10-17 05:50 AM
Greetings,
I am developing a large input / output system where I need several (alsmot all) features of a STM32H743 working at once.
It is possible to use Timer 1,2,3,4 and 5 Channels 3 & 4 for PWM Output and Channels 1 & 2 for Quadrature Encoder input at same time?
I am using STM32Cube, and this strange configuration appears to be "selectable" but I have some doubts, due to the encoder value is stored at TIMx -> CNT but the Channels 3 & 4 uses its own .Pulse value direclty related to timer period value...
If this configuration is possible to be used, how can I read the encoder values? Are these stored at capture compare channel registers or anything similar?
Thanks in advance,
2019-10-17 06:56 AM
No - listen to your doubts. Unless the H743's timers are radically different than the rest of the STM32 family. Each timer has 1 COUNT (CNT) register. If the timer is configured as an encoder interface, the CNT register maintains the encoder position and the ARR determines the max count. If the timer is configured as a PWM generator, the CNT register is clocked from your desired clock source and serves as the time base from which the output transitions are derived and the ARR determines the PWM period. So you can have one or the other, but not both.
That said, CubeMX does appear to allow you to configure (for example, on the L433) TIM1 with ch 1 and 2 as an encoder, and ch4 as PWM output. I suspect what will happen is that the PWM output will be based off of the encoder position in the CNT register, whose value depends on what the encoder is doing, not a normal clock signal. Probably not what you want.