Unable to flash esp32: first time setup

I am unable to upload the file to esp32. I must be doing something wrong.

I purchased a new ESP32. I am using the ESP32 add-on on HASSIO.

I plug in the ESP32 in the USB port where HASSIO is running.
Navigate to ESPHOME.
Select /dev/ttyACM0 from the dropdown (since it is a new esp32)
Click on upload.
Get this error.

INFO Reading configuration /config/esphome/shion_room_bed.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d /config/esphome/bed_sensor
Processing bed_sensor (board: nodemcu-32s; framework: arduino; platform: [email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif32 3.10004.200129 (1.0.4) 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - toolchain-xtensa32 2.50200.80 (5.2.0)
Dependency Graph
|-- <AsyncTCP-esphome> 1.1.1
|-- <ESPmDNS> 1.0
|   |-- <WiFi> 1.0
|-- <FS> 1.0
|-- <ESPAsyncWebServer-esphome> 1.2.6
|   |-- <AsyncTCP-esphome> 1.1.1
|   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|   |-- <ArduinoJson-esphomelib> 5.13.3
|-- <AsyncMqttClient-esphome> 0.8.4
|   |-- <AsyncTCP-esphome> 1.1.1
|-- <ArduinoJson-esphomelib> 5.13.3
|-- <DNSServer> 1.1.0
|   |-- <WiFi> 1.0
|-- <Update> 1.0
|-- <WiFi> 1.0
Compiling /data/bed_sensor/.pioenvs/bed_sensor/src/main.cpp.o
Linking /data/bed_sensor/.pioenvs/bed_sensor/firmware.elf
Building /data/bed_sensor/.pioenvs/bed_sensor/firmware.bin
Retrieving maximum program size /data/bed_sensor/.pioenvs/bed_sensor/firmware.elf
Checking size /data/bed_sensor/.pioenvs/bed_sensor/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  13.0% (used 42712 bytes from 327680 bytes)
Flash: [=====     ]  54.4% (used 891562 bytes from 1638400 bytes)
======================== [SUCCESS] Took 129.60 seconds ========================
INFO Successfully compiled program.
INFO Running:  platformio run -d /config/esphome/bed_sensor -t upload --upload-port /dev/ttyACM0
Processing bed_sensor (board: nodemcu-32s; framework: arduino; platform: [email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif32 3.10004.200129 (1.0.4) 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - tool-mkspiffs 2.230.0 (2.30) 
 - toolchain-xtensa32 2.50200.80 (5.2.0)
Dependency Graph
|-- <AsyncTCP-esphome> 1.1.1
|-- <ESPmDNS> 1.0
|   |-- <WiFi> 1.0
|-- <FS> 1.0
|-- <ESPAsyncWebServer-esphome> 1.2.6
|   |-- <AsyncTCP-esphome> 1.1.1
|   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|   |-- <ArduinoJson-esphomelib> 5.13.3
|-- <AsyncMqttClient-esphome> 0.8.4
|   |-- <AsyncTCP-esphome> 1.1.1
|-- <ArduinoJson-esphomelib> 5.13.3
|-- <DNSServer> 1.1.0
|   |-- <WiFi> 1.0
|-- <Update> 1.0
|-- <WiFi> 1.0
Retrieving maximum program size /data/bed_sensor/.pioenvs/bed_sensor/firmware.elf
Checking size /data/bed_sensor/.pioenvs/bed_sensor/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  13.0% (used 42712 bytes from 327680 bytes)
Flash: [=====     ]  54.4% (used 891562 bytes from 1638400 bytes)
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...
Use manually specified: /dev/ttyACM0
Uploading /data/bed_sensor/.pioenvs/bed_sensor/firmware.bin
Serial port /dev/ttyACM0
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
*** [upload] Error 2
========================= [FAILED] Took 98.96 seconds =========================

In the ESPHome config file. It is blank. Am I suppose to add a line since I am connecting via usb?

Do I have a bad chip? I got this note from esphome site.

Note
If you’re just seeing Connecting....____.... on the screen and the flashing fails, that might be a sign that the ESP is defect or cannot be programmed. Please double check the UART wires are connected correctly if flashing using a USB to UART bridge. For some devices you need to keep pressing the BOOT button until flashing has begun (ie. Geekcreit DOIT ESP32 DEVKIT V1).

Ok. I got it working. The ESPHome docs should be very specific. During uploading of a new ESPHome device, you need to hold down the Boot button on the chip as stated in this post.

Also, you need to reboot ESPHome add-on if you are inserting the usb to HA for initial flashing for HA to manually have the device discovered.

1 Like

Thanks for pointing this out. I’m running into a different error. When I try to upload I’m getting this:

PackageManager: Installing tool-mkspiffs @ ~2.230.0
Error: Detected unknown package ‘tool-mkspiffs’

Anyone have any idea what I’m doing wrong?

Nevermind… I needed to update ESPHOME. Once I did that, it worked perfectly!