StefX wrote:
SA=BUS clk/2*PSCLA
BUS clk=8Mhz/128=62.5Khz
SA=62.5Khz/2*512=61Hz
This is the wrong way to calculate the PWM frequency. Also, the maximum prescale by the SA clock is 512 (256 * 2). Here is how the PWM frequency should be calculated.
A Clk = Bus Clk / Prescale A (Set by PWMPRCLK_PCLKA[2:0])
SA Clk = A Clk / Prescale SA (Set by PWMSCLA)
PWM Freq = SA Clk / PWM Period (Set by PWMPERx)