10 years, 6 months ago.

Problem in PwmOut() in FRDM-KL25Z?

First time I try Blinky program

include the mbed library with this snippet

#include "mbed.h"

DigitalOut myled(LED1);

int main() {
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

Blue LED in FRDM-KL25Z blink normally. But when i add PwmOut() to Blinky program.

include the mbed library with this snippet

#include "mbed.h"

DigitalOut myled(LED1);
PwmOut PIN2(PTC9);

int main() {
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

When it was runing. Blue LED in FRDM-KL25Z blinking but LED that connected to PTA2 (or Serial Tx) was "ON" and voltage at this pin was 2.68V.

How to fix this problem.

Hello Opas Sirikunchittavorn,

there's not LED connected to PTA2. At least I can't find any in the KL25Z schematic. Please define the name of the LED you alleged that is on.

Regards,
0xc0170

posted by Martin Kojtal 25 Nov 2013

1 Answer

10 years, 5 months ago.

Sorry for my missing information. I soldered 8 pin female header to connector J1 of FRDM-KL25Z. And used protoboard to connect pin 4 of J1 that label PTA2 to external resistor and LED.

Regards, Opas Sirikunchittavorn