PwmOut example not working as expected

Hi,

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
}

Hello John,

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.

Thanks for the tip. Here is the error, which seems to confirm that PWM is not supported on PC_13.

++ MbedOS Error Info ++
Error Status: 0x80010130 Code: 304 Module: 1
Error Message: pinmap not found for peripheral
Location: 0x800042B
Error Value: 0x2D
Current Thread: main Id: 0x20000DDC Entry: 0x8001553 StackSize: 0x1000 StackMem: 0x200015B0 SP: 0x200024FC 
For more info, visit: https://mbed.com/s/error?error=0x80010130&tgt=BLUEPILL_F103C8
-- MbedOS Error Info --