I’m new to mbed OS and have tried adapting the PwmOut example to run on an STM32F103 Blue Pill board to flash its LED on PC_13. The LED does flash, but it does so in a pattern of 4 slow flashes and 4 fast flashes.
What might be going on?
Edit: PwmOut works fine if I use a pin with hardware PWM support. PC_13 is not such a pin.
Thanks!
// main.cpp
//
// mbed-os.lib:
// https://github.com/ARMmbed/mbed-os/#565ab149819481224ab43f878c3921b14b11d180
//
// mbed compile --target BLUEPILL_F103C8 --toolchain GCC_ARM
#include "mbed.h"
PwmOut led(PC_13);
int main() {
// specify period first, then everything else
led.period(4.0f); // 4 second period
led.write(0.50f); // 50% duty cycle
while(1); // led flashing
}
On Mbed the pattern of 4 slow flashes and 4 fast flashes indicate a hard fault. Connect a serial monitor to the board (PA_2, PA_3 pins) to see run time error messages reported by the system.