Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

marcmerlin
Posts: 30
Joined: Mon Apr 17, 2017 12:50 am

Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby marcmerlin » Fri Mar 24, 2023 10:24 pm

I have now 5 of those that got their USB damaged in a way that it will power from USB, but the usb-serial chip is dead, so I can't flash them the normal way anymore. This seems to be done by some board I have, once I plug a new working one into it, the USB serial chip seems to get destroyed. I have to figure out why.

They otherwise work fine, I can get output on the serial pins via an ftdi serial adapter, and I can also send input, my code receives it and it works.
So I should still be able to flash them via those serial pins, no?
I do see the normal messages from the ESP32 bootloader on serial but when running the arduino flasher, I get

Connecting........_____....._____....._____....._____....._____....._____....._____....._____....._____....._____
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

I tried to push the reset button during this time, and it didn't help.
I also tried to short GPIO0 to GND or connect it via a 10k resistor before or after pushing the reset button and during this time arduino is trying to connect, but again, no luck.

Is there still a way I can flash them?

mgsecord62
Posts: 20
Joined: Thu Nov 02, 2017 12:40 am

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby mgsecord62 » Sat Mar 25, 2023 5:49 pm

A couple of thoughts. Have you removed the USB to serial chip? The damaged USB to Serial chip could be driving the pins on the ESP. Maybe the pins on the ESP were also damaged and you will not be able to program the ESP.

marcmerlin
Posts: 30
Joined: Mon Apr 17, 2017 12:50 am

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby marcmerlin » Sat Mar 25, 2023 9:52 pm

mgsecord62 wrote:
Sat Mar 25, 2023 5:49 pm
A couple of thoughts. Have you removed the USB to serial chip? The damaged USB to Serial chip could be driving the pins on the ESP. Maybe the pins on the ESP were also damaged and you will not be able to program the ESP.
Thanks for the thought. no, I have not, it's beyond my chip surgery skills
If this is supposed to work, what is the exact sequence I need to do between pushing the reset button on the board, and grounding GPIO0 via a resistor, or simply via a wire?

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby MicroController » Mon Mar 27, 2023 11:23 pm

1. pull GPIO0 low
2. reset chip by pulling EN low (or removing power)
3. start chip by releasing/pulling up EN (or supplying power)
4. wait a few ms, then you can release GPIO0
5. the ESP should now be in "upload" mode waiting for firmware over serial

marcmerlin
Posts: 30
Joined: Mon Apr 17, 2017 12:50 am

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby marcmerlin » Wed Mar 29, 2023 5:18 am

MicroController wrote:
Mon Mar 27, 2023 11:23 pm
1. pull GPIO0 low
2. reset chip by pulling EN low (or removing power)
3. start chip by releasing/pulling up EN (or supplying power)
4. wait a few ms, then you can release GPIO0
5. the ESP should now be in "upload" mode waiting for firmware over serial
With RST, I was getting:
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

By pulling power while GPIO is pulled down, I get the correct thing instead:
rst:0x3 (SW_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
waiting for download

I also checked that I don't need a 10k resistor for GPIO0 to ground and that just a wire is good enough and that I do not need to release GPIO0 fo the flash to work
Last, but not least, I checked that it works both if I power 5V from the USB header, or 3.3V directly into the 3.3V pin.

Now it works if I use the RST switch on the board (which indeed seems the same as pulling EN to GND).
I have no idea why it wasn't working earlier, but it is now.

Thanks for the sanity check

marcmerlin
Posts: 30
Joined: Mon Apr 17, 2017 12:50 am

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby marcmerlin » Thu Mar 30, 2023 2:07 am

MicroController wrote:
Mon Mar 27, 2023 11:23 pm
1. pull GPIO0 low
2. reset chip by pulling EN low (or removing power)
3. start chip by releasing/pulling up EN (or supplying power)
4. wait a few ms, then you can release GPIO0
5. the ESP should now be in "upload" mode waiting for firmware over serial
Now that i've figured out how to flash around a broken USB chip I need to figure out why I'm burning those chips.

I'm not connected the USB header to anything other than my laptop, and I do power the chip from an external 5V source directly on its USB pin, and it should be about 5V. Is there a way to fry the USB chip without frying the ESP32 voltage regulator?

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby MicroController » Sat Apr 01, 2023 9:49 pm

You have connected two 5V power supplies to the board (power supply + laptop USB) at the same time?

Craige Hales
Posts: 94
Joined: Tue Sep 07, 2021 12:07 pm

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby Craige Hales » Sun Apr 02, 2023 12:19 pm

I don't know about wemos/lolin, but the dev kit c shows a blocking diode between the laptop/usb supply and the EXT_5V pin. The usb 5V supply is frequently not enough amps to support wifi without an external 5V supply, so I've been using both supplies with the random devices I get from amazon. I'd be concerned if
and I do power the chip from an external 5V source directly on its USB pin
is avoiding the blocking diode...concerned for the laptop if 5V is pushed into the usb.

capture.png
capture.png (64.42 KiB) Viewed 6254 times
Craige

marcmerlin
Posts: 30
Joined: Mon Apr 17, 2017 12:50 am

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby marcmerlin » Fri Apr 07, 2023 1:28 am

MicroController wrote:
Sat Apr 01, 2023 9:49 pm
You have connected two 5V power supplies to the board (power supply + laptop USB) at the same time?
Yes, I have. 5V from battery and voltage regulator, and sometimes I connect the USB to my laptop which indeed supplies 5V also. And yes, the 2 5V are not exactly the same so it could cause a small current flow from 5V rail to USB 5V pin.
Would that be enough to damage the USB chip on the board?

Generally is there a safe/accepted way to power via 5V and reflash via USB outside of unplugging the chip and/or turning off the external 5V source?

marcmerlin
Posts: 30
Joined: Mon Apr 17, 2017 12:50 am

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby marcmerlin » Fri Apr 07, 2023 1:40 am

Craige Hales wrote:
Sun Apr 02, 2023 12:19 pm
I don't know about wemos/lolin, but the dev kit c shows a blocking diode between the laptop/usb supply and the EXT_5V pin. The usb 5V supply is frequently not enough amps to support wifi without an external 5V supply, so I've been using both supplies with the random devices I get from amazon. I'd be concerned if
and I do power the chip from an external 5V source directly on its USB pin
is avoiding the blocking diode...concerned for the laptop if 5V is pushed into the usb.
So let's be precise, this is what the lolin D32 looks like:
https://www.wemos.cc/en/latest/_static/ ... _16x16.jpg
The only pin that has 5V is the pin labelled USB.

This pin is labelled VBUS on the schematic and seems to be the same USB VBUS than pin VBUS on the board
There is a VIN label on the schematic, but I don't see where it goes, although it's behind a diode indeed
Schematic: https://www.wemos.cc/en/latest/_static/ ... v1.0.0.pdf

Either way, from what I can read, connecting both my battery on VBUS and the VBUS USB pin to my laptop does seem to connect to different power supplies together with 0 protection between them. My laptop is protected and the Vreg on my battery is also protected, so a tiny backflow would not bother it, but the resistance between them is almost 0, so this could create a hgh current that could burn a trace on the board maybe? (never saw or smelled magic smoke though).

Either way, it looks like dual powering this board during flashing, is a bad idea. Is that correct?
If so, I have a magic USB cable where the V+ line is cut, and I could use this to connect my laptop while it's battery powered.

As per the earlier comment, yes the entire system uses too much power from USB, so I cannot connect USB only if I want it to work, but I could unplug the chip to flash it, and then put it back. Using a USB cable with V+ cut off is likely simpler though.

Who is online

Users browsing this forum: Bing [Bot] and 97 guests