I get this error even though I have specified it in platformio.ini.
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd,
olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
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/<user>/<device name>)
*** [upload] Explicit exit, status 1
=============================== [FAILED] Took 8.69 seconds ===============================
It’s one of the USB port on the front of my PC. Device Manager shows COM1 and Silicon Labs CP210x and that is all right now. It has worked before with COM1. I connected the esp32 but it did not pop-up another Com port in DevMan. I tried with COM to no avail.
Maybe PlatformIO has special logic to detect COM1 as a motherboard COM, because that’s usually the case. You can use the Windows device manager to change the COM port number to something higher, say, COM6. After doing that, I would recommend removing the upload_port = .. directive and retrying without it.
Thanks maxgerhardt for your help
I’ve been experimenting a bit but finally I changed COM1 to COM6 but it doesn’t help. When I connect esp32 it picks up the Silicon Labs CP210x (COM4) which has a different driver (silabser.sys) than standard COM ports (serenum.sys, serial.sys) Could it still be correct? When I upload it asks for COM3. Where does it get COM3?
Serial port COM3
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
*** [upload] Error 2
I had the universal driver already installed. I put in COM and connected esp32 and the upload was successful. If it’s not connected the upload fails. I thought it would come out and say “… connect device within 60 seconds” or something to that effect but it needed to be connected.
No, that’s not implemented in PlatformIO or esptool.py. PlatformIO checks available serial devices at upload-button-press time (or uses the pre-provided one via upload_port) and forwards it as --port <device> to esptool.py. Neither of these programs have the capability to wait for a new serial port connection in the ESP32 case.
Correct, the digistump bootloader / upload tool has this “please plug in device” behavior. That’s also the only case I know of that has this behavior. But that’s then programmed in the uploader tool (micronucleus).