Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 7 months ago.
What's wrong with PWM out?
I was going to port the EPD library on Nucleo F030R8 when I encountered problems with PWM output. My program didn't work but instead printed "pinmap not found for peripheral" on the terminal and halted. Then I tried the Nucleo_pwm example program:
#include "mbed.h"
PwmOut mypwm(PWM_OUT);
//PwmOut mypwm(PB_3);
DigitalOut myled(LED1);
int main() {
mypwm.period_ms(10);
mypwm.pulsewidth_ms(1);
printf("pwm set to %.2f %%\n", mypwm.read() * 100);
while(1) {
myled = !myled;
wait(1);
}
}
and got the excactly same result.
The Nucleo F030R8 documentation on mbed.org lists the PWM_OUT pin and I can find it from also from PinNames.h.
Question relating to:
2 Answers
11 years, 7 months ago.
Hello,
The list of the pwm outputs are in the pwmout_api.c file. Today only PA_7, PC_7 and PB_6 pins can output a pwm signal. More pins will be added. Concerning the PWM_OUT label defined in the pinnames.h file, it is an error. We will change it. Thanks for having notice that. Regards.
I tried PC_7 instread of PWM_OUT. The code worked and I was able to measure 100Hz from the pin.
posted by Pekka Ahmavuo 06 Apr 2014