Timer in cascade mode for PWM
I would like to control RC servos with PWM. Problem is that "Normal" PWM would waste most of the precision on the PPM period (20ms) leaving 5% of 16 or 32 bit timer for duty cycle. (1-2ms)
I was reading about cascading timers and that is probably the way to solve my problem, but I cant wrap my head around how exactly will slave timer reload and start each PPM period.
My idea was to use Timer1 for PPM period. Set the prescale and limit to make 50Hz signal. Set it as a repeated counter with up-count. Assign TRGO for Timer1.
User Timer2 as a slave in one pulse mode. Enable TRGI and set prescale and limit that will suit the precision of the duty cycle.
And this is where I dont understand how to set Timer2 to re-load limit on the reset of the Timer1 and start.
In the datasheet it says that slave can be reset, triggered .. But can it be both ? I need slave to reset and trigger on the limit reset of the master.
Also, if I want to use few PWM channels from Timer2 to control multiple servos, would procedure be the same ? All of the channels will of course have same upper limit and different CCRx values for their duty cycle ?
