esp8266 / Arduino

ESP8266 core for Arduino
GNU Lesser General Public License v2.1
15.99k stars 13.33k forks source link

ESP.reset() / ESP.restart() #4057

Closed tonton81 closed 6 years ago

tonton81 commented 6 years ago

have a weird issue using latest GIT with arduino 1.8.3

After programming, the first call to ESP.reset() / ESP.restart() causes the esp8266 to completely lock up and throw the red light, using an adafruit breakout esp8266 board

to narrow things down, I put just ESP.reset() in the setup() function and started programming. After the programming, same issue, complete lockup with red light. however, pressing the reset button manually causes the code to work perfectly fine as its consistantly resetting the ESP fine every time it hits setup

does the bootloader set a flag that the first reset/restart doesnt like right after programming? has anyone seen this? manually resetting or pulling power and back make it run fine

everslick commented 6 years ago

thats not a bug. the EPS8266 reenters boot loader mode, if not reset via reset button or power circle. it's also documented this way.

tonton81 commented 6 years ago

how come after programming sketches run fine without needing the button reset? its only the first time AFTER programming when calling reset completely locks up. otherwsie code runs fine right after programming as long as i dont call reset/restart

tonton81 commented 6 years ago

where is this specific issue documented?

tonton81 commented 6 years ago

i find it hard to believe sketches can run in bootloader mode right after programming but the esp.reset/restart requires an initial hard reset in order to exit bootloader mode that programming reentered even though the sketch runs normal code fine? heh...

igrr commented 6 years ago

What happens is basically:

tonton81 commented 6 years ago

so everytime after programming we have to hard reset in order not to get stuck like this?

igrr commented 6 years ago

Yes. It is possible for esptool-ck to do a hard reset after uploading, but this needs some testing...

deskwizard commented 6 years ago

Hi Igrr, I have the same "issue" as tonton81. Could you please elaborate on the comment about esptool-ck doing an hardware reset instead of the software reset? You mentioned it's untested, any way I can test it myself?

Thank you

jeroenst commented 6 years ago

This brakes my functionality.... :-1:

d-a-v commented 6 years ago

Maybe you could open a feature request in https://github.com/igrr/esptool-ck ?

jeroenst commented 6 years ago

it seems like when the esp8266 is not connected to the computer the ESP.reset and ESP.restart work without problem. Possible the USB->RS232 ic is making a pin high which is low when not connected to a pc?

Same thing applies for the watchdog afaik.

Anyhow it works fine now. Also I don't need the reset anymore, I needed it because when changing the hostname it didn't become active afterwards. But when I stop wifi and start it again the hostname also becomes active and a reset isn't needed.