Need help to download firmware into ESP32

Ritesh
Posts: 1170
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Need help to download firmware into ESP32

Postby Ritesh » Mon Oct 24, 2016 7:28 am

Hi,

I have one ESP32 Demo Development Kit and I want to download my firmware into that board without using DIP Switch 4 or other firmware download switch.

As per ESP32 Datasheet, GPIO0 and GPIO2 should be low to enter module into download mode.

So, can anyone confirm that GPIO0 and GPIO2 should be low to enter module into download mnode or any other configurations are required for that?

Regards,
Ritesh Prajapati
Regards,
Ritesh Prajapati

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Need help to download firmware into ESP32

Postby kolban » Mon Oct 24, 2016 2:57 pm

My experience is that when GPIO0 is explicitly low at boot time then the device starts in flash mode (ready to receive a new program) and when floating or explicitly brought high at boot, it enters normal run mode. I have so far not needed to hold GPIO2 at either 0 or 1 to achieve the two modes of interest to me (flash mode and run mode). Pulsing the EN pin is what I use to reboot.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Ritesh
Posts: 1170
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need help to download firmware into ESP32

Postby Ritesh » Tue Oct 25, 2016 3:57 am

Hi,

I was able to download firmware into ESP32_Demo V2 Development board using DIP Switch 4 But I have created one board based on ESP32 chip and i was trying download firmware using same method like GPIO0 and GPIO2 should be low as per ESP32 Datasheet.

Download Boot Settings mentioned into ESP32 Data-sheet
---------------------------------------------------------------------------
GPIO0 should be 0
GPIO2 should be 0

I have tried with above settings but not able to connect with ESP32 chip while downloading firmware into it.

I am getting following error while loading firmware into it
Flashing binaries to serial port /dev/ttyUSB0 (app at offset 0x10000)...
esptool.py v2.0-dev
Connecting...

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
make: *** [flash] Error 2
So, Please let me know if you have idea or clue for this type issue.
Regards,
Ritesh Prajapati

WiFive
Posts: 2991
Joined: Tue Dec 01, 2015 7:35 am

Re: Need help to download firmware into ESP32

Postby WiFive » Tue Oct 25, 2016 4:14 am

On your custom board do you get any output from bootloader when connected to a terminal?

Ritesh
Posts: 1170
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need help to download firmware into ESP32

Postby Ritesh » Tue Oct 25, 2016 6:15 am

Hi,

Problem has been solved. It was some silly mistake of other hardware components which causes this issue.

Thanks for providing support for this.
Regards,
Ritesh Prajapati

RoundRobin
Posts: 7
Joined: Wed Nov 02, 2016 9:40 pm

Re: Need help to download firmware into ESP32

Postby RoundRobin » Tue Nov 22, 2016 2:42 pm

Hi Ritesh,

I struggle with the same output when flashing on an ESP-32S. Could you please explain a little more what you did to make it work?

When booting in normal mode, I get the below output. Not quite sure if this is expected at first boot. And when I reboot with IO0 to GND, I get the same timeout output as you.
(RTCWDTRTCRESET),bt:0x17 (SPIFASTFLASHBO_T)
flash read err, 1000
Falling back to built-in cmmand interpreter.
OK
>�

Ritesh
Posts: 1170
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need help to download firmware into ESP32

Postby Ritesh » Tue Nov 22, 2016 4:54 pm

Hi,

First of all, I want to know which board are you using for you development purpose? Means ESP32-Dev board V2 or any other ESP32 based custom board?

Also, which firmware you have flashed in your ESP32 based board?

Are you using any ESP32 bases module like ESP-WROOM-32 or directly using ESP32 chip?

Also, which RTOS SDK you are using for your ESP32 development purpose?

The error seem like that you are using ESP31 based SDK which was used on ESP31 bit board before releasing ESP32-idf SDK and board.

So, please first check SDK and board which you are uong so that I can help you ahead for your problem.

Let me know if you need any more help on this.
Regards,
Ritesh Prajapati

ESP_Sprite
Posts: 4123
Joined: Thu Nov 26, 2015 4:08 am

Re: Need help to download firmware into ESP32

Postby ESP_Sprite » Wed Nov 23, 2016 3:12 am

RoundRobin: Do you happen to have GPIO12 connected to something? Can you try disconnecting that pin?

RoundRobin
Posts: 7
Joined: Wed Nov 02, 2016 9:40 pm

Re: Need help to download firmware into ESP32

Postby RoundRobin » Wed Nov 23, 2016 10:54 am

>First of all, I want to know which board are you using for you development purpose? Means ESP32-Dev board V2 or any other ESP32 based custom board?
I am using the ESP-32S module from Ai-Thinker. It is pin equivalent with the ESP-WROOM-32. My setup is shown in the picture below, I have only wired up the module in a breadboard for now.

>Also, which firmware you have flashed in your ESP32 based board?
It is a fresh module, I haven't flashed anything yet. Should I?

>Also, which RTOS SDK you are using for your ESP32 development purpose?
>The error seem like that you are using ESP31 based SDK which was used on ESP31 bit board before releasing ESP32-idf SDK and board.
I have just followed the instructions in the getting started manual, and I have the most updated IDF from github.

>RoundRobin: Do you happen to have GPIO12 connected to something? Can you try disconnecting that pin?
No, nothing connected to that pin as of now

But after a lot of fiddling yesterday, I suddenly thought of using a common ground for the serial to USB converter and the ESP32. This actually helped me one step further, but I'm still having problems.

Flashing procedure:
1. Boot with the boot button pressed
The following is displayed:
rst:0x1 (POWERON_RESET),boot:0x0 (DOWNLOAD_BOOT(UART0/UART1/SDIO_FEI_FEO_V2))
waiting for download
2. Inside ~/workspace/01_hello_world/ I run

Code: Select all

make flash
:
Flashing binaries to serial port /dev/ttyUSB0 (app at offset 0x10000)...
esptool.py v2.0-dev
Connecting...
Uploading stub...
Running stub...
Stub running...
Attaching SPI flash...
Configuring flash size...
Compressed 9824 bytes to 5356...

A fatal error occurred: Timed out waiting for packet content
/home/.../esp-idf/components/esptool_py/Makefile.projbuild:47: recipe for target 'flash' failed
make: *** [flash] Error 2
I have also run

Code: Select all

make bootloader-flash
with the same result

After flashing fails, boot in normal mode continue to display the following output:
>How?
What?
>
>>
How?
>
>
How?
>
>How?
What?
>
>>
How?
>
>>What?
How?
>
It seems like it is stuck in this mode, now

Code: Select all

make flash
gives the following output:
Flashing binaries to serial port /dev/ttyUSB0 (app at offset 0x10000)...
esptool.py v2.0-dev
Connecting...
Uploading stub...

A fatal error occurred: Failed to write to target RAM (result was 0x1, 0x7, 0x0, 0x0)
/home/.../esp-idf/components/esptool_py/Makefile.projbuild:47: recipe for target 'flash' failed
make: *** [flash] Error 2
or sometimes
Flashing binaries to serial port /dev/ttyUSB0 (app at offset 0x10000)...
esptool.py v2.0-dev
Connecting...
Uploading stub...

A fatal error occurred: Response doesn't match request
/home/.../esp-idf/components/esptool_py/Makefile.projbuild:47: recipe for target 'flash' failed
make: *** [flash] Error 2
When I run

Code: Select all

./esptool.py --port /dev/ttyUSB0 read_flash_status
I get the following
esptool.py v2.0-dev
Connecting...
Detecting chip type... ESP32

A fatal error occurred: Timed out waiting for packet header
Seems a little bricked to me..
Attachments
esp32_conn.png
esp32_conn.png (227.04 KiB) Viewed 18376 times

ESP_Angus
Posts: 2227
Joined: Sun May 08, 2016 4:11 am

Re: Need help to download firmware into ESP32

Postby ESP_Angus » Wed Nov 23, 2016 9:01 pm

The output looks to me like a serial communications problem (noise/interference), or (more likely) that the chip is browning out. These are common problems using bare modules, both for ESP8266 and ESP32.

What's the 3.3V power source that you're powering the module from? It should have a high current rating (at least 250mA, once you enable WiFi you probably want to be closer to 500mA.) How thick/long are the wires providing power to the module? In addition to the current rating, are you able to add any capacitors on the 3.3V power rail, close to the ESPWROOM32 module?

EDIT: It's also possible some other program is accessing the serial port and interrupting communciations. If you have maybe modem-manager installed (it's part of a lot of default Linux distribution configurations), it can sometimes do this.

Who is online

Users browsing this forum: No registered users and 27 guests