1 year ago.

STM32F103C8T6 (Bluepill board) USB CDC


is it possible to connect the bluepill board via USB to the PC via CDC driver? I see the following codesnippet on the mbed website:


#include "mbed.h"

Serial pc(USBTX, USBRX); // tx, rx

int main() {
    pc.printf("Hello World!\n");

Here, a Serial object will be constructed with USBTX and USBRX as pins. But these pins are mapped to PA_2 and PA_3 on board which is effectively a UART on the STM32F103C8T6 controller. The SERIAL_TX, and SERIAL_RX are mapping to the same pins. Do I configure here a USB CDC connection (by using the onChip USBCore) or a standard UART connection?


Regards Tobias

1 Answer

1 year ago.

Hello Tobias,

Yes, you can connect a Blue Pill to your PC over a USB cable using mbed's CDC driver. For more deatails have look at this example.

Accepted Answer

Hi Zoltan, thank you for this sample, I did't know that the STM32F103C8T6 works with the CDC driver. However the STM32F103C8T6 has very limited flash sizes and can be used only for very little projects, the offline GNU compiler produced code will not fit into the flash.

Thank you for all your great support.

posted by Helmut Tschemernjak 13 Feb 2019