Difficulty with getting USB serial [USB CDC] working

SOLUTION FOR CS32F103 (So that this MCU can upload sketcks and activate the serial monitor by USB):

[env:bluepill_f103c8_128k]
platform = ststm32
framework = arduino
board = bluepill_f103c8_128k
upload_protocol = stlink
upload_flags = -c set CPUTAPID 0x2ba01477
build_flags =
   -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
   -D USBCON
   -D USBD_VID=0x0483
   -D USBD_PID=0x5740
   -D USB_MANUFACTURER="Unknown"
   -D USB_PRODUCT="\"BLUEPILL_F103C8\""
   -D HAL_PCD_MODULE_ENABLED
3 Likes