PlatformIO Community

Can't upload code to esp8266 (nodemcu V3)

hello everyone

i have recently installed VSCode with platformio to program an esp2866 board.
Yesterday i had no problems uploading my code to the board but today i get an error when i try uploading the same code.

"A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header"
When i only comiple the code ther is no problem. I have also tried another board but got the same error.


Processing nodemcuv2 (platform: espressif8266; board: nodemcuv2; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 (2.6.2) > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
 - framework-arduinoespressif8266 3.20704.0 (2.7.4)
 - tool-esptool 1.413.0 (4.13)
 - tool-esptoolpy 1.20800.0 (2.8.0)
 - tool-mklittlefs 1.203.200522 (2.3)
 - tool-mkspiffs 1.200.0 (2.0)
 - toolchain-xtensa 2.40802.200502 (4.8.2)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 29 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Retrieving maximum program size .pio\build\nodemcuv2\firmware.elf
Checking size .pio\build\nodemcuv2\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  32.7% (used 26824 bytes from 81920 bytes)
Flash: [==        ]  24.6% (used 257440 bytes from 1044464 bytes)
Configuring upload protocol...
AVAILABLE: espota, esptool
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: COM3
Uploading .pio\build\nodemcuv2\firmware.bin
esptool.py v2.8
Serial port COM3
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header
*** [upload] Error 2
=================================================================== [FAILED] Took 27.68 seconds ===================================================================The terminal process "C:\Users\Dirk-\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1.

hopefully somone can help me.

First try setting a lower upload speed as some usb-to-serial chips can’t handle high baud rate very well:

upload_speed = 115200

in the platformio.ini.

If there’s still no dice, open a serial monitor program (like hterm) on the upload port (in your case COM3) at 74880 baud. Then, hold down the FLASH button (GPIO0) on the ESP board and press reset, then release the FLASH button.

Does text appear in the terminal from the bootloader?

If yes, disconnect from the serial monitor and retry uploading.

Thanks for your help
but when i restarted VScode the problem disappeared.