Error `upload_port` for environment or use global `--upload-port` option

I use PlatformIO to compile Marlin.

When I try upload the firmware:

Unable to find destination disk (Autodetect Error)
Please select it in platformio.ini using the upload_port keyword (Redirecting...) or copy the firmware (.pio/build/LPC1769/firmware.bin) manually to the appropriate disk

Configuring upload protocol…
AVAILABLE: blackmagic, cmsis-dap, jlink, mbed
CURRENT: upload_protocol = mbed
Looking for upload disk…
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//)
*** [upload] Explicit exit, status 1
============================================================= [FAILED] Took 13.32 seconds =============================================================

Environment Status Duration

LPC1769 FAILED 00:00:13.320======================================================== 1 failed, 0 succeeded in 00:00:13.320 ========================================================

Usually a firmware upgrade is done through copying the file onto an SD card and putting it in the printer. What 3D printer do you have?

I have a Bigtreetech SKR 1.4 Turbo with TMC2209 and Marlin
Until recently, PlatformIO was able to upload me without having to extract the SD card every time and then reinsert it.

BTT SKR V1.4 Instruction Manual.pdf page 11 links to here which says

After the compilation is successful, a firmware.bin file will be generated in the .pioenvs\LPC1768 directory. We will copy this file to the TF card of the motherboard, and then reset the motherboard, so that the firmware is burned into the motherboard.

Marlin points at GitHub - p3p/pio-nxplpc-arduino-lpc176x for the LPC1769 implementation and the available upload methods are

So since your board doesn’t have any SWD / JTAG debugger probe on board per it’s schematics, the only sensible “upload” method is mbed, which looks for the first available USB diskdrive and copies the firmware.bin there. It’s not a direct upload in your case.

Until recently, PlatformIO was able to upload me without having to extract the SD card every time and then reinsert it.

So what did change since then?

uploading was possible without removing the SD card from the board

And that was for the same 3D printer, with the same Marlin version and PlatformIO version?

The same Printer, but Marlin e PlatformIO are changed

The available upload methods for the LPC1769 (and 8) haven’t changed since the creation of the file in 2018. I can’t see how a direct upload would be possible to the board since it’s not exposing a USB drive for uploading (like the STM32 nucleo boards do through their STLink) and it doesn’t have an on-board debug probe. So the best PlatformIO can do is copy the firmware.bin file to an external drive or the SD if it detects one (your error message indicates none was connected), but one still has to put the SD card in the printer afterwards.

I’m not crazy, I have no hallucinations

Marlin configuration 2.0.9 - Basic firmware installs - YouTube min 14:10

As I said, yes, PlatformIO can “upload” to an SD card. That means copying the file onto it. Not direct uploading to the microcontroller. That’s exactly what’s happnening in the video. It says “Use manually specified D:” and with the standard upload_protocol = mbed it uploads there. The difference to your setup is that somewhere upload_port = D:\ was specified in the LPC1769 environment of the platformio.ini to force “uploading” there.

Do you have an SD card inserted in your computer? What drive letter does it have?

In fact, when I connected my printer to the PC with Windows via USB cable, the SD Card appeared in the File Explorer, which now no longer appears.

Now it’s all OK. I found the problem. I deactivated


in Configuration_adv.h

1 Like

I haven’t tried this yet but i have the same problem with my skr 1.3 it since i upgraded my x and y stepper drivers to Tmc2209. I don’t know what exactly happend but i installed the 2209 drivers and started to edit configuration.h and configuration_adv.h and hit upload and done it works fine but i can not make changes to my frimware anymore while Platform io somehow can not find my skr anymore. But my tft35 works just fine or i can connect to pronterface and send some commands again works fine even the tmc2209 are communicating and sending some data of steppers even I can click on Platform io monitor and see that the Tmc2209 are still communicating but somehow they dont send the exact data of steppers but anyway the only thing that does not work is uploading process
And also i remembered having an error from windows which said usb port not recognized or something and i can not find the frimware file in the sc card of skr but it was there before

I copied the frimware.bin file into the micro sd card and reseted the skr and after that i tried the upload button in platformio and it workr just fine ( also i have defined the #define SDCARD_CONNECTION ONBOARD )