A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header
*** [upload] Error 2
========================= [FAILED] Took 30.13 seconds =========================
The terminal process “C:\Users\Thici.platformio\penv\Scripts\platformio.exe ‘run’, ‘–target’, ‘upload’” terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
Just plug one esp at a time to be sure which one is being programmed if you have multiple,
and when programming esp, you need to press a button called “boot” if not wrong .
Do you use esp stand-alone module or on a dev board ?
I have exactly the same issue. The same program can be uploaded with arduino IDE and I have the same error on VScode/platformio. Did you manage to find a solution?
==============Terminal output after succesful complilation======================
Retrieving maximum program size .pio\build\esp01_1m\firmware.elf
Checking size .pio\build\esp01_1m\firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
RAM: [==== ] 41.0% (used 33608 bytes from 81920 bytes)
Flash: [==== ] 39.9% (used 303619 bytes from 761840 bytes)
Configuring upload protocol…
AVAILABLE: espota, esptool
CURRENT: upload_protocol = esptool
Looking for upload port…
Auto-detected: COM4
Uploading .pio\build\esp01_1m\firmware.bin
esptool.py v3.0
Serial port COM4
Connecting…………………_____
A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header
*** [upload] Error 2
======================================================================= [FAILED] Took 13.65 seconds =======================================================================