New trouble flashing micropython onto ESP32 wroom-32

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
JDRBoston
Posts: 21
Joined: Mon Feb 19, 2018 9:43 pm

New trouble flashing micropython onto ESP32 wroom-32

Post by JDRBoston » Sat Jul 24, 2021 8:48 pm

I'm stumped and I'd really appreciate your help. Normally, I have no trouble flashing or re-flashing ESP32's with micropython binaries using esptool. But I have a new breakout board that I've soldered a ESP32 wroom-32 onto and I've run into trouble. I used a multimeter to confirm the pads are properly soldered and lack of bridges. I think that I can connect with the chip through the USB to UART converter, because I am able to get the chip ID and I'm able to erase the flash (example of output is below). But every time that I try to flash the chip with the binary, after 3% of the upload is sent, the processes is stalled. I get: "A fatal error occurred: Timed out waiting for packet header".

For troubleshooting, I've tried:
holding GPIO0 to ground during the process
making sure that the EN pin is grounded
lowering the baud rate for the flashing to 115200
changing the flash mode, by adding -fm dio
flashing the chip with an ESP-IDF v3.x version of the binary (e.g. v1.14)
confirmed that the binary is good by flashing it onto another ESP32

I'd appreciate any advice about how to troubleshoot this further. Thank you! - Jay

$ esptool.py --port /dev/cu.SLAB_USBtoUART chip_id
esptool.py v3.0
Serial port /dev/cu.SLAB_USBtoUART
Connecting.....
Detecting chip type... ESP32
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 9c:9c:1f:c5:ff:f4
Uploading stub...
Running stub...
Stub running...
Warning: ESP32 has no Chip ID. Reading MAC instead.
MAC: 9c:9c:1f:c5:ff:f4
Hard resetting via RTS pin...

$ esptool.py --chip esp32 --port /dev/cu.SLAB_USBtoUART erase_flash
esptool.py v3.0
Serial port /dev/cu.SLAB_USBtoUART
Connecting........_
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 9c:9c:1f:c5:ff:f4
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 15.1s
Hard resetting via RTS pin...


$ esptool.py --chip esp32 --port /dev/cu.SLAB_USBtoUART --baud 460800 write_flash -z 0x1000 esp32-20210618-v1.16.bin

esptool.py v3.0
Serial port /dev/cu.SLAB_USBtoUART
Connecting.......
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 9c:9c:1f:c5:ff:f4
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Compressed 1509472 bytes to 976502...
Writing at 0x00005000... (3 %)
A fatal error occurred: Timed out waiting for packet header

[/size]

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: New trouble flashing micropython onto ESP32 wroom-32

Post by davef » Sun Jul 25, 2021 12:23 am

Where did you get: esp32-20210618-v1.16.bin from? I see esp32-20210623-v1.16.bin on the downloads page.

JDRBoston
Posts: 21
Joined: Mon Feb 19, 2018 9:43 pm

Re: New trouble flashing micropython onto ESP32 wroom-32

Post by JDRBoston » Sun Jul 25, 2021 1:37 am

Thank you, davef. That's curious, I am not sure why its not there - I downloaded it from that source on June 22nd. But I just downloaded the 20210623 version and tried it. Unfortunately, also without success:

$ esptool.py --chip esp32 --port /dev/cu.SLAB_USBtoUART --baud 460800 write_flash -z 0x1000 esp32-20210623-v1.16.bin
esptool.py v3.0
Serial port /dev/cu.SLAB_USBtoUART
Connecting........_____....._
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 9c:9c:1f:c5:ff:f4
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Compressed 1510544 bytes to 976957...
Writing at 0x00005000... (3 %)
A fatal error occurred: Timed out waiting for packet header

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: New trouble flashing micropython onto ESP32 wroom-32

Post by davef » Sun Jul 25, 2021 2:30 am

Hmmm, thought I had added to the post. My ESP32_WROOM32U takes 8.7 seconds to erase. Are flashing via the UART of the ESP32 or the host?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: New trouble flashing micropython onto ESP32 wroom-32

Post by davef » Sun Jul 25, 2021 2:33 am

I was getting a similar at one stage but it always had a <bF> or other characters at the end of your error message. Maybe show your rsusb command.

JDRBoston
Posts: 21
Joined: Mon Feb 19, 2018 9:43 pm

Re: New trouble flashing micropython onto ESP32 wroom-32

Post by JDRBoston » Mon Jul 26, 2021 1:48 am

Thank you, davef. I'm using Terminal on the Mac OS and it doesn't recognize a rsusb command. I'm flashing a sparse ESP32 breakout using a USB-TTL converter board. I've read through the esptool documentation and am following some of the troubleshooting instructions. I've checked the voltages and they are a solid 3.3V during the attempt to flash. In case I can't detect a rapid drop, I'm going to put a cap across the power lines. I'm going to shorten the connecting wires between the converter board and the ESP32.

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: New trouble flashing micropython onto ESP32 wroom-32

Post by davef » Mon Jul 26, 2021 4:27 am

Even though I use little SMPSs that can supply 1.5 to 3A I put a 1000uF 16V low-ESR cap on the supply.

JDRBoston
Posts: 21
Joined: Mon Feb 19, 2018 9:43 pm

Re: New trouble flashing micropython onto ESP32 wroom-32

Post by JDRBoston » Wed Jul 28, 2021 12:37 am

davef - thank you very much. After I put an electrolytic cap across the power lines, I was able to flash the chip. Thank you again, Jay

Post Reply