PlatformIO Community

Terminal Upload Sketch


#1

Hello,
I use the PlatformIO for programming the Arduino and ESP8266.
When I upload a sketch to the controller (for example ESP8266) it works fine. When I change the code and I want upload the new code I get the error:

AVAILABLE: espota, esptool
CURRENT: upload_protocol = esptool
Looking for upload port…
Auto-detected: COM3
Uploading .pioenvs\nodemcuv2\firmware.bin
error: Failed to open COM3
error: espcomm_open failed
error: espcomm_upload_mem failed
*** [upload] Error 2
======================================================================== [ERROR] Took 1.76 seconds ========================================================================
The terminal process terminated with exit code: 1

And so I have to connect the controller and reconnect them and than it works when upload the code.
For example when I use the Arduino IDE it works without reconnect.
It is possible possible to resolve the problem.
Thank you!


#2

My guess you have a console connected, when you try to upload. It would have to close the port first.


#3

Thank you for the answer.
For example the arduino IDE what I know it do automatically - close and open the port when I upload the code. So I had the opinion that it is possible in the platformio too.
How can I close the port in platformio?


#4

In VSCode, is the serial monitor (miniterm.py) even open? If yes, click into the terminal window and press Ctrl+5 to stop it.


#5

I prefer the “dumber” approach. I click on the terminal window and then click on the trash cans (to close that window) until all the windows are closed. I prefer the no thinking approach… :slight_smile:


#6

Thank you verry much for the help!:wink: