mmakaay / esphome-xiaomi_bslamp2

ESPHome integration for the Xiaomi Mijia Bedside Lamp v2.
Other
204 stars 49 forks source link

[HELP] Unexpected error: could not open port 'COM1': PermissionError(13, 'Access is denied.', None, 5) #102

Closed RcKVQhBWO closed 1 year ago

RcKVQhBWO commented 1 year ago

In esphome-flasher for windows, when I click show log and flash esp I get an error: "Using 'COM1' as serial port. Unexpected error: could not open port 'COM1': PermissionError(13, 'Access is denied.', None, 5)"

Same error on windows 10 and Debian sometimes when I turn power to lamp on log will show: rst:0x1 (POWERON_RESET),boot:0x2 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_FEO_V2)) waiting for download

however I cannot flash, if I press show log it will revert to permission Error.

I have various times tried:

If possible could you explain the exact order/ chain of events I should do in regards to connecting power and usb cables And any suggestions? Thanks for your time

mmakaay commented 1 year ago

I do get this error a lot myself when flashing from windows. This is not a problem with ESPHome or the lamp as such, but it happens before the flasher is even trying to send data. It looks like another process on the computer might be grabbing the comport and therefore locking it for other use. I never found what program or system component was the culprit.

My solution: When flashing, I connect GPIO0 to ground, then I plug in the lamp power, then I plug in the USB cable into the computer and right afterwards I start the flashing operation. When the permission denied occurs, I unplug and replug the USB and try to start the flashing again.

This procedure hasn't failed me yet. I hope you can get it to work this way too.

RcKVQhBWO commented 1 year ago

Hi thanks for that valuable information. Following your solution methodology has helped however now afew seconds after clicking flash ESP I get this error: "Unexpected error: ESP Chip Auto-Detection failed: Failed to connect to Espressif device: No serial data received. For troubleshooting steps visit: https://github.com/espressif/esptool#troubleshooting"

I have an unsettling feeling that my rx solder is not great so I will redo that and see if that helps

RcKVQhBWO commented 1 year ago

I was about to go re solder but decided to try one more time and flashing was successful! Thanks for your help

mmakaay commented 1 year ago

Bad RX/TX soldering or not grounding before turning on are the most likely issues in this situation. Great to hear that it worked out in the end, enjoy the firmware!