Difficulty Uploading Code via USB on BluePill Board in PlatformIO

Hello,

I’m currently facing an issue while trying to upload code to my BluePill board using PlatformIO. I have installed a bootloader on the board to enable USB programming, but I am encountering errors when attempting to upload firmware via the serial connection.

Setup Details:

  • Board: BluePill (STM32F103C8)
  • Bootloader: Installed (specify if it’s the Arduino bootloader or another one)
  • IDE: PlatformIO
  • Operating System: [e.g., Windows 10 / Linux / macOS]

PlatformIO Configuration:

Here’s what my platformio.ini file looks like:

ini

[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
upload_protocol = serial
upload_port = COM3 ; [or the appropriate port for your OS]

Error Message:

When I try to upload code, I receive the following error:

text

Error probing interface "serial_w32"
Cannot handle device "COM3"
Failed to open port: COM3
*** [upload] Error 1

Troubleshooting Attempts:

  • I have verified that COM3 is the correct port and that it appears in Device Manager.
  • I have checked that my USB-to-Serial drivers are installed correctly.
  • I’ve tried different USB cables and ports and closed any applications that might be using COM3.
  • I reset the BluePill board before the upload.

Questions:

  1. Is there a specific configuration I missed for USB bootloading on the BluePill?
  2. Could there be any conflicting issues I am not aware of?
  3. Is there a way to ensure that PlatformIO recognizes the USB programming setup correctly?

Any guidance or suggestions would be greatly appreciated.

Thank you!

BUt did you reset the board into bootloader mode? Otherwise it won’t react at all. BOOT0 and BOOT1 jumper settings are important.