Purpose of GPIO2 and GPIO15 during boot and flashing

User avatar
kolban
Posts: 131
Joined: Tue Jun 16, 2015 1:09 pm
Location: Fort Worth, Texas, USA

Purpose of GPIO2 and GPIO15 during boot and flashing

Postby kolban » Sat Jul 18, 2015 10:44 pm

Howdy folks,
I understand that to place the ESP8266 into flashing mode, I need to bring GPIO0 low during boot. I am pretty solid on that notion. However, there appears to be a lot of chatter on the signal values needed on GPIO2 and GPIO15 during boot.

My best guesses are:

GPIO2 - This is also UART1 TX which is used during debugging. During flash, it is also outputting the flash progress. As such, it should be left dangling as it is outputing a signal and there is no way to stop it doing that and we do not wish to apply that signal to other components or the power rails.

GPIO15 - This is UART0_RTS which, if I believe is the control pin that is used to signal to a UART that it is allowed to transmit.

What are the signals that are recommended by Espressif to be on these pins during boot in order to allow us to flash new firmware?

Neil

YimingLi
Posts: 30
Joined: Sun May 03, 2015 5:36 pm

Re: Purpose of GPIO2 and GPIO15 during boot and flashing

Postby YimingLi » Mon Jul 20, 2015 2:25 am

kolban wrote:Howdy folks,
I understand that to place the ESP8266 into flashing mode, I need to bring GPIO0 low during boot. I am pretty solid on that notion. However, there appears to be a lot of chatter on the signal values needed on GPIO2 and GPIO15 during boot.

My best guesses are:

GPIO2 - This is also UART1 TX which is used during debugging. During flash, it is also outputting the flash progress. As such, it should be left dangling as it is outputing a signal and there is no way to stop it doing that and we do not wish to apply that signal to other components or the power rails.

GPIO15 - This is UART0_RTS which, if I believe is the control pin that is used to signal to a UART that it is allowed to transmit.

What are the signals that are recommended by Espressif to be on these pins during boot in order to allow us to flash new firmware?

Neil



Hi Neil,

The reason that GPIO2 and GPIO15 should be considered with GPIO0 during programming flash, is that:

- GPIO15, GPIO0, GPIO2 forms boot_sel(2:0) to be sampled in during reset and to determin the boot mode

- Programing flash using uart0 requires a boot mode of "boot from uart0" with boot_sel=b001, that is,
we need make sure GPIO15=0, GPIO0=0, and GPIO2=1 during reset

- Since GPIO15, GPIO0, and GPIO2 all have internal weak pullups, you could leave GPIO2 dangling to get GPIO2=1,
however, you should provide external pulldowns to GPIO15 and GPIO0, so as to get "0"s for these two signals.

In a customized module, the GPIO15 is pulled down, GPIO2 is left floating, and control GPIO0 during reboot to switch between automatic flash downloading and normal boot up. http://www.ebay.com/itm/282162857143 and http://www.ebay.com/itm/282162896341

Hope it will be helpful.
Last edited by YimingLi on Tue Sep 20, 2016 1:20 pm, edited 1 time in total.

User avatar
kolban
Posts: 131
Joined: Tue Jun 16, 2015 1:09 pm
Location: Fort Worth, Texas, USA

Re: Purpose of GPIO2 and GPIO15 during boot and flashing

Postby kolban » Mon Jul 20, 2015 2:48 am

That was a great post and cleared things up considerably for me. Thank you so much.

I now realize that the pins GPIO0, GPIO2 and GPIO15 when taken together form a 3 bit number, I am guessing that it is GPIO15 - GPIO0 - GPIO2. So a value of GPIO15=0, GPIO0=0 and GPIO2=1 gives us the binary number 001 (or 1 in decimal). The value of this 3 bit number is used to determine how the ESP8266 boots. If the value is 1, then the device boots from UART ... and hence allows us to flash it.

I had wrongly been assuming that it was only GPIO0 that was being used ... 1 = normal, 0 = flash ... but now I fully understand it is the combination of the three bits.

Since three bits gives us 8 permutations 000 - 111, I am assuming that a boot of 000 means a normal boot from flash memory. I am now wonder what (if anything) the other 6 permutations are defined to mean. But that is another story ...

Later ... AHA!!! I found document 0D and that explains ALL the permutations. AWESOME!!!

Again ... THANK you for the response.

Who is online

Users browsing this forum: Google [Bot] and 3 guests