9 years, 6 months ago.

PwmOut can not be initialized

I am pretty new to mbed platform, how can i initiliaze PWM on my STK3800? I can't not do with the default code examples

my code looks like this:

pwm try

#include "mbed.h"

PwmOut pwm(PA12);

int main()
{
    pwm.period_ms(20.0f);
    pwm.pulsewidth_ms(10.0f);

    while(1);

}

I do not receive compile errors. I cant read pwm output from pin PA12.

Question relating to:

Silicon Labs' EFM32™ Wonder Gecko ARM® Cortex®-M4 based 32-bit microcontrollers (MCUs) provide flash memory configurations up to 256 kB, 32 kB of RAM and CPU speeds up to 48 MHz, …

Please use code tags when posting code! You may get a better quality answer if you post all your code. Tell us what errors you are getting.

posted by David Fletcher 20 May 2015

I cannot help you any further, as i don't have this board, as a bit of help your program looks fine. I checked the schematics for the correct pin, i noticed that all 3 pwm pins are connected to the LCD not sure if that's a clue. May be some one else can help. Good Luck.

posted by David Fletcher 20 May 2015

Yes I saw it too ( three pwm pins are connected to LCD ), thank you for your help :)

posted by Cagatay Sari 20 May 2015

1 Answer

9 years, 6 months ago.

Hi Cagatay,

there is currently a bug in PwmOut for Silicon Labs targets that prevents it from functioning. This bug has already been fixed, and the fix should propagate to mbed-src by tomorrow.

Expect it to show up in mbed proper by the next release, which is due next week Tuesday.

Kind regards, Steven Cooreman

Accepted Answer

Thank you very much for your fast response :)

posted by Cagatay Sari 20 May 2015