USBSerial on bluepill / STM32F103RB

Hello,
I’m using Mbed bare metal profile and trying to have a basic serial port working on the bluepill, but i can’t get it to compile and link.
Is USBSerial supported for this board / microcontroller?

Hello Simone,

Is USBSerial supported for this board / microcontroller?

Unfortunately, there is no USBDEVICE defined for those targets in Mbed OS 6 yet (neither for the bare-metal nor for the RTOS ). If you don’t mind to use Mbed OS 2 (aka Mbed Classic), which is still supported by the online compiler (but not with Mbed Studio), then have a look at:
https://os.mbed.com/users/hudakz/code/STM32F103C8T6_Hello/
https://os.mbed.com/users/hudakz/code/STM32F103C8T6_USBSerial/

Best regards, Zoltan

Thank you for the fast reply :slight_smile:
That’s unfortunate, i’ll go directly to phase 2 with wireless communication with a nRF24L01 i guess :wink:

Do you know if anything is planned in the future? I always wanted to understand the details of usb and maybe that could be a nice project for me :smile:

Hello Simone,

I’m sorry I’m just a user as you are and I don’t know what’s going on behind the scenes. But I guess USB drivers are developed by ARM partners. So in case of the STM32F103RB by STM’s Mbed support team. Perhaps Jerome Coutant can tell you more about the plans in this regard. But certainly it could be a nice project for you too.

Best regards, Zoltan

Hi
Please check https://github.com/ARMmbed/mbed-os/pull/13406
Regards

1 Like

Hello Simone,

To make USB work update the TARGET_BLUEPILL directory in your project and add the following mbed_app.json file to the root directory of your project:

{
    "requires": ["bare-metal","drivers-usb", "events"],
    "target_overrides":{
        "*": {
            "target.clock_source": "USE_PLL_HSE_XTAL",
            "target.clock_source_usb": "1",
            "target.device_has_add": ["USBDEVICE"]
        }
    }
}

Best regards, Zoltan