Postby YimingLi » Mon Jun 08, 2015 10:11 pm
Hi,
GPIO0 is the boot_sel1, together with MTDO/boot_sel2 and GPIO2/boot_sel0 to form a boot mode selection array boot_sel[2:0], From the name you might figure out that the chip samples these pins upon bootup (excluding a reset by wdt) to select the boot mode -- as we know, if boot_sel[2:0]=b001, i.e. MTDO=0, GPIO0=0, GPIO2=1, the chip will select "booting from uart0", the mode in which we use to burn the flash.
That is, per your topic, what is important is the level of GPIO0 sampled in by the chip "during" reset out. However the GPIO0 levels before reset, in reset, and after reset out, are not important. Or we could say that, either "pull down GPIO0 -> pull down nRESET -> release nRESET -> release GPIO0" or "pull down nRESET -> pull down GPIO0 -> release nRESET -> release GPIO0" would both work to bring the chip into a mode of booting from UART, only if that the GPIO0 gets release to high after the nRESET gets released high.
However, since GPIO0 might be in GPIO output mode and output a high level by the firmware inside the chip before your extern control to pulldown the GPIO and nRESET. That is, you might encounter a risk that you are to pulldown the GPIO0 externally when the the chip firmware is outputing the GPIO0 high, which would bring about a large excessive current consumption, even you might cause the module fail to work. Considering At Reset the GPIO0 will be in output disabled mode (oe=0, wpu), it will be safer to pull down the GPIO0 externally after you pull down the nRESET.
Therefore, a better way to bring the chip into a mode "boot from uart" might be the latter one of above two, that is, "pull down nRESET -> pull down GPIO0 -> release nRESET -> release GPIO0".
About how long an interval you should give between the pull-downs and releases, this is something like a question about setup and hold time margins, and reset timings. There is no data for them from the datasheet. However in my opinion, it should be a possitive value at least observed from the two pins. That is, you should count in your code delay, output and transmission delay, stability margins etc. In my customized toolkits (sofware) for my customized esp8622ex module, it seems that an interval(given in software) of several ms between GPIO0 and nRESET, and tens of ms for reset period would work. Anyhow, the intervals are just used to bring the module/chip into a mode of "boot mode from uart", compared with the time required to burn the flash, does a delay of 100ms or 10ms make quite a difference? Therefore, I would give adequate intervals here to ensure a stable and enough timing margin.
Hope it would be helpful.