FastPWM on the FRDM KL20Z

01 Sep 2016

Hi the following code always yields a 32kHz square wave. I'd be very grateful if somebody could point me to where I am going wrong.

I get the same output however I set the period or width (ms us or ticks). I'd like to be able to set both in 48MHz ticks.

"

  1. include "mbed.h"
  2. include "FastPWM.h"

Serial pc(USBTX, USBRX);

FastPWM pwm(PTA1);

int main() {

pwm.period_ms(10);

pwm.pulsewidth_ms(3);

while(1){};

} "

01 Sep 2016

Sorry, that was KL25Z of course