ST-Link V2 and STM32F401 Black Pill not recognized at all


PlatformIO doesn’t seem to recognize my STM32F401CCU6 Black Pill board at all. I have the model with the three on/off switches, and the correct switch (the one closest to the Reset pin) is set to bootloader mode. I’m getting the following error when attempting to upload:

Error: Please specify upload_port for environment or use global --upload-port option.
For some development platforms it can be a USB flash drive (i.e. /media//)

Here are the configurations from my platform.ini file:

platform = ststm32
board = blackpill_f401cc
board_build.mcu = stm32f401ccu6
framework = arduino
upload_protocol = stlink
debug_tool = stlink

I can read the device in the STM32Cube Programmer, and the board is legitimate. The factory blink sketch runs until put into bootloader mode.

Apart from this, I don’t know what else to do. I’ll take any suggestions as I am new to PlatformIO from Arduino. Thank you!

If you upload via an ST-Link then resetting to bootloader mode shouldn’t even be necessary.

Are you sure you have the correct project & environment select with the project environment switcher?

You don’t even have to add

Because stlink is already the default.

It was the project environment switcher that did it! Thank you!