Flashing ESP-01 - Permission Error 13

Windows 10 machine

Although discussed many times, I feel like there’s no definitive answer so far.

What I bought:

An ESP-01 based relay:
esp01_relay

USB 8266 Adapter:
8266_adapter

Goal and what I did:

Naturally, I wanted to implement this relay to Home Assistant. I already flashed some Sonoffs before, so I thought I had enough experience by now.

So I grabbed ESPHome Flasher and went to town. As always, I created a blank bin file in ESPHome integration in home assistant. Using Generic ESP8266 device type. (I suspected this to be a possible issue but maybe not)

I took out the ESP01 board from the relay and connected it to my PC using the adapter.
Then, I fired up the ESPhome flasher, selected the bin file, clicked Flash aaaand…

Unexpected error: could not open port ‘COM5’: PermissionError(13, ‘Access denied.’, None, 5)

Of course, I tried Googling multiple solutions so here’s what I did so far:

  1. Downloaded the latest USB to UART drivers (already had those from previous flashing)
  2. Used all the possible USB ports on the computer
  3. Tried compiling the BIN file with Esperiff ESP-01 512k module device type
  4. Tried using the FTDI adapter with the pins on the relay
  5. Ran the flasher in admin mode

All methods resulted in the very same error.
I would loved any inputs on the issue, thanks!

Did you make sure GPIO 0 is pulled low when you power on the ESP01?

For normal operation, GPIO 0 is high, but needs to be low if you want to program the ESP01.

Can you point me to how to do that? I assumed that all neccessary parts would be handled by the ESPHome bin file and the flasher.

Plus, the next assumption was that the USB adapter was designed for boards like this and therefore had all the down low loogic applied to it already.

Are you running the flasher program with administrator rights? Seems to me the issue is on the Windows side, not the hardware side. Also look here.

Yes I saw that specific site during my research. As the OP there, I tried using the flasher in standard and admin mode. Both gave the same results.

I thought it might be a Windows issue myself, but I tried pretty much everything.
Rebooting, updating the drivers, admin modes … nothing.

What’s even more interesting that I already flashed some NodeMCUs couple days ago using the exact same method. It all worked then (after some driver installs of course)

So why is this issue only ESP01 specific?

Did you also see the last comment? https://github.com/esphome/esphome-flasher/issues/14#issuecomment-706584561

I don’t know Windows well enough, but perhaps it can throw a Permission Denied error when in fact there is a hardware issue (for instance the USB-to-TTL stick not being able to detect the ESP01).

I assume that you put the ESP01 board on the adapter in the right orientation?

As @randytsuch suggests, you could try connecting GPIO0 to GND. Looking at this page, not all adapter modules actually do that.

1 Like

SOLVED

Thank you @robertklep for that. Although I saw the last comment on there, I feel like I hevn’t properly understood.

For anyone still having this issue, here’s my two cents:

As suggested in the previous reply by @robertklep, take a look at this page.

If you decided to use the same USB 8266 adapter as I did, you will need to jump the GND and GPIO0 pins during boot. As hinted in the link, you can solder a jumper or a button for easy access.

If you’re like me, you’ll hold a jumper wire at the pins as you insert the USB adapter. You need to hold it there only for the boot, not for the entire process.

Thank you again and I hope this will come in handy to anyone who might be struggling as I was!

1 Like