PlatformIO Community

"upload port" has no effect on linux


I have 4 STM32 on my PC. It seems that “upload-port” feature is broken on linux (Ubuntu). When I try to flash my MCUs on “MY_PORT”, my port is ignored. So my code is flashed to another MCU.

On windows, upload-port works perfectly.

Command :

platformio run -t upload --upload-port /dev/MY_PORT

I can resolve this problem by editing my files platformio.ini

upload_protocol = custom
upload_command = openocd -s $PROJECT_PACKAGES_DIR/tool-openocd/scripts -f interface/stlink.cfg -c "transport select hla_swd" $UPLOAD_FLAGS -c "program {$SOURCE} 0x08000000 verify reset; shutdown;
upload_flags =
    hla_serial MY_SERIAL

That was discussed in Add support for multiple ST-Link adapters · Issue #564 · platformio/platform-ststm32 · GitHub

If upload_protocol = stlink originally, it should equally fail.


Thank you for your advice.

It works now ! I had to change the udev rules on linux. So it was an environment configuration problem.
Somes MCUs have multiple products IDs, depending their modes (bootloader or not). It’s better whith the good id ^_^.

PlatformIO works fine :wink: