Esptool could not open port, but serial monitor works

Hi, i created the hello world program. Uploaded it using the serialport (os X /dev/cu.usbserial-1401) . Then opened the serial monitor to see the hello world messages. After closing the serial monitor i cannot upload anymore. Serial monitor keeps working when i open it. Arduino IDE (which is closed now) can flash normal. Am i doing something wrong?

I grabbed the upload command from the arduino IDE and changed the binary file name. This works every time…

henrie@iMac % /…/python3 /…/esp8266/hardware/esp8266/2.7.4/tools/upload.py --chip esp8266 --port /dev/cu.usbserial-1410 --baud 921600 --before default_reset --after hard_reset write_flash 0x0 .pio/build/d1_mini/firmware.bin

If that is what PlatformIO is using but Arduino is using

Then there’s a problem. Or was that a typo?

there is no - after the port… it’s the prefix for the baud setting

No, one is 1401 the other 1410.

You nailed it.

:frowning: feeling realy stupid now

Well no, question is, are there really two different serial ports (which would be extremely weird) and PlatformIO is using one and the Arduino IDE the other?

Does explicitly setting upload_port = /dev/cu.usbserial-1410 in the platformio.ini help?

No, there are not two different ports. I had the port explicitly set in platformio, but i made a typo there myself when i added the baudrate for the monitor. I checked everything multiple times but didn’t spot this one… (I know this, because with multiple undo’s i can exactly reproduce it and see the chars swapped)