Having problems with ESP32

hi all,

i’m trying to get my first nodemcu ESP32s project into esphome and i’m hitting a problem at t he start that I hope someone out there can help me get past.

when using ESPhome-Flasher i connect the board with a usb cable to my laptop (windows 10) and comm 5 shows up, i select the comm and the file to flash, press flash and I get the following error…

Unexpected error: ESP Chip Auto-Detection failed: Failed to connect to Espressif device: Timed out waiting for packet header

any ideas how I can get around this ?

Why aren’t you plugging the esp32 into the machine running esphome?

Perhaps you have a charge only cable?

1 Like

I wasn’t aware that I could… I’ll give it a try.

the cable is power and data, i’ve used it to transfer files from my laptop to my phone and vise versa just to check, also the comm port shows as active only when i plug the NodeMCU ESP-32s into it.

Edit:

I just tried to plug it directly into my PI running HA with ESPhome installed and the only option I get for upload is OTA.

I disconnected the cable and plugged my tablet into my PC using it and was able to go through my files on the tablet from the PC without problem.

1 Like

Where are you running ESPHOME?

where is the compiled esphome binary file located?

Where are you running esphome-flasher?

1 Like

@finity Your first and last questions are answered in the thread.

I see that they are running the flasher from a laptop but I wasn’t clear that esphome was actually on a different machine.

And if it was maybe asking the questions in that way might have possibly sparked an “aha…” moment in the OP to realize that you can’t flash a device from a computer that doesn’t at least have the bin file available on it.

1 Like

@nickrout Thank you for the link to the FAQ i had gone thorough them (though i did forget to mention that i’d been there already sorry).

@finity let me run through everything a bit better please…

i have several nodeMCU ESP8266 devices up and running in ESPhome all with no problem this is my first NodeMCU ESP-32s that I am trying to configure and running into problems.

I am using a tried and tested USB cable that I know has no faults and can transmit data both ways.

my ESPhome is running on my Pi 3b+ which is running Hass.io .

ESPhome-Flasher is running on my Laptop where i have installed all the drivers for the ESP8266 and the drivers from the FAQ

the Binary file that I am trying to put onto the ESP-32s is currently located in my laptop where I have ESPhome_Flasher installed also.

The Binary file was compiled in the ESP component in HA and saved to the laptop.

when i connect the board to the laptop via the USB cable, the laptop makes a noise to indicate that the board has been found and if i look into the Device manager then Comm 5 suddenly appears as active.

but still I get the error when I try to flash it.

if I connect directly to the PI then i get nothing just the option for OTA transfer

1 Like

I don’t have any ESP-32s so I’m not sure if the issue could be that you chose the incorrect board type in your ESPHome yaml config?

1 Like

Yep, yaml file :slight_smile:

1 Like

Ahh… i never thought of that. let me check…

this is what I have in the Yaml for that.


esphome:
  name: testing
  platform: ESP32
  board: nodemcu-32s

maybe a play with other options might produce different results

Edit: forgot code formatting

Edit: just tried the following…

esphome:
  name: testing2
  platform: ESP32
  board: esp-wrover-kit

with the same errors

Connecting........Using 'COM5' as serial port.
Unexpected error: could not open port 'COM5': PermissionError(13, 'Access is denied.', None, 5)

tried a few others as well and the same result

Is there any way to know what setting to use from the board?

I’m not sure if you’re seeing something different than I am but those two errors aren’t anywhere near being close to “the same”.

1 Like

from the ESPHome docs it looks like your initial code was correct.

Maybe it’s a problem with the board?

Or as @nickrout said, maybe it’s a problem with the cable… just because it worked before doesn’t mean it won’t break at some point.

in device manager what is show along side the com5 port description

for mine i have
image

  1. Are you running windows on your laptop?

If so this utility is is handy for notifying you of new com ports without having to drill down into device manager: https://helmpcb.com/software/serial-port-monitor

  1. It can be tricky to get ESP32s into boot mode.
    i) Power on / connect the ESP
    ii) Start the flash tool connecting
    iii) Press and hold both buttons on the ESP board
    iv) Release the EN button while continuing to hold the IO0 button
    v) When the flash tool discovers the device you can release the IO0 button.
2 Likes

ESP32 NodeMCU’s have specific flash mode? I didn’t know that. Regular ESP8266 NodeMCU’s can be flashed without any special procedure as far as I remember. Just plug it in & flash it.

Permission denied - not sure about device permissions in windows. It seems important though.

thank you tom that has done the trick!

@finity i hadn’t noticed the differences in the error logs, a pretty big thing to miss… but thank you for pointing that out to me.

I returned the type to the generic and followed the instructions from @tom_l and everything is flashed ready for me to play with.

thank you to you all :slight_smile:

1 Like

Yep the ESP32 based boards have a different flash mode access method to the ESP8266s. Took me a while to work it out the first time, after only using lots of ESP8266s.

It’s the same procedure for the ESP8285. For example, the Sonoff minis may not go into flash mode if you just power on while holding IO0 low. You have to power on, reset while holding IO0 low then release IO0 once connected.

1 Like