Once BOOT0 is high and the board is reset, the microcontroller executes a very general bootloader that simultaneously opens some interfaces to accept a new firmware, over serial (=UART), USB, SPI, I2C, CAN-bus and more fancy stuff.
Please have alook at https://www.st.com/resource/en/application_note/cd00167594-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf chapter 33 “STM32F42xxx/43xxx devices bootloader” for your device.
Regarding USB:
When the microcontroller running in bootloader mode is connected via USB, the upload method is called “DFU” (Device Firmware Upgrade).
However… the weird thing is that PlatformIO doesn’t seem to support USB-DFU firmware uploads for some STM32F4 series chips? It’s not listed here but e.g. listed in the STM32F417VE board, as upload_protocol = dfu
as usual.
Can you confirm that when using e.g. STM32Cubeprog, upload via the “USB” method works?
If yes, that can be bug-fixed in the board manifest (I’ll instruct how) and at the source repo.
However, I don’t think the underlying USB-DFU program that PIO uses for upload can differentiate multiple boards connected to one computer.
Regarding Serial:
This really means, serial as in UART, not USB. To flash the device via upload_protocol = serial
, you need to have USB-UART converter attached, whereas the TX of the adapter goes to PA9 of the target chip and RX goes to PA10 (see aforementioned document). Multiple devices at once can be used that way, by stating seperate upload_port = COMx
serial-adapter ports for each device.
For the nucleo, it may be the case that the on-board ST-Link, which also acts as a USB-serial adapter, is already connected to these standard pins, so it can be used.
Still, the board has to be manually put into bootloader mode everytime a new firmware is uploaded, and then put out of bootloader mode to run it again after a reset. So really, either upload_protocol = stlink
(with modifications to discern multiple ST-Links) or mbed
is the most convenient one, since it does not require manual fiddling with the BOOT jumpers.