Hi
for relatively low frequency you could use the capture function.
It is very precise.
There is a counter. running with selectable clock freqency.
The capture function just freezes the counter value at the selected edge of the input signal (PWM)
Read at least three edges:
* rising1
* falling
* rising2
* calculate "rising2 - rising1" to get the period_time of the PWM signal
* calculate "falling - rising1" to get the high_time of the PWM signal
* calculate "high_time / period_time" to get the duty_cycle
(You don´t need to restart the counter. Nor you need to take care about overflow, as long as "PWM_period_time < counter_overflow_time)
The error should be +/- 1 counter tick.
The resolution depends on PWM frequency and counter_clock_frequency
Klaus