Recently i created code to generate and measure PWM signal using FTM module but i got one problem with it. I'm not sure what OSR i need to setup to measure signal precisely. The faster FTM clock the better i guess but timer might overflow faster than the PWM signal state changes and i would have to save how many times timer did overflow?
Let's say i got 100Hz PWM and running from 60Mhz clock, the timer will overflow in about 1 ms, when period of my signal is 10ms.
Now i'm "blindly" setting prescaler to 128 to slow down the clock and i can measure my PWM period just fine for the application but i'm wondering if there is any magic formula to calculate best PS or everyone is just using maximum.