Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By zdewitt
#70597 Hey all, I'm wondering if there's any documentation on what the GPIO pins do during startup and following a hardware/software reset. I've been experimenting with GPIO0 and GPIO15 (simply because my design already has pullup/down resistors on them) on the scope and it seems that they are driven high/low at some point before it gets to my code in the start() function. Are there any GPIO pins that are guaranteed to stay in input mode until my code tells them otherwise?

Why I want to know: I'm driving a relay off one of the IO pins and I'd like to design a circuit with a holding cap that can store the last state of the pin for at least the 100ms or so that the ESP takes to boot to my start() function, so I can read it and not cycle the relay in case of a crash and reset. I want to do this without writing the EEPROM to avoid thousands of cycles wearing it out. Any help is greatly appreciated!

Thanks
User avatar
By RFZ
#70685 Hey,
GPIOs 4 and 5 are the only ones that are always high impedance. All others do have internal pull-ups or are even driven low/high during boot.

GPIOs 3, 12, 13 and 14 pulled HIGH during boot. Their actual state does not influence the boot process.

GPIOs 0, 1, 2 and 15 are pulled HIGH during boot and also driven LOW for short periods.
The device will not boot if 0, 1 or 2 is driven LOW during start-up.

GPIO 16 is driven HIGH during boot, don't short to GND.
User avatar
By rudy
#70687
I'd like to design a circuit with a holding cap that can store the last state of the pin for at least the 100ms or so that the ESP takes to boot to my start() function, so I can read it and not cycle the relay in case of a crash and reset. I want to do this without writing the EEPROM to avoid thousands of cycles wearing it out.


Have a look at RTC memory. It is maintained as long as power is still on. The contents are not changed when the CPU gets reset.

https://github.com/esp8266/Arduino/blob ... Memory.ino

https://www.bakke.online/index.php/2017 ... work-scan/
User avatar
By zdewitt
#70702
RFZ wrote:GPIOs 4 and 5 are the only ones that are always high impedance.

Awesome, thanks. I'll make sure and use one of these pins for the relay then. I figured that the level changes I saw on 15 and 0 were probably due to boot functions, so that makes sense

rudy wrote:Have a look at RTC memory. It is maintained as long as power is still on. The contents are not changed when the CPU gets reset.

Had no idea that RTC exists, and it sounds interesting for this. Doing a little digging on the links you sent me it looks as though it is maybe not always reliable? (The examples always had a CRC in them) I could just write a whole byte with ones and hopefully at least five of them survive.

I'll definitely give it a shot and see how it goes. Probably a holding cap would still be necessary to hold the relay on while the chip reboots, but not having to do a read on the pin could make things simpler

Thanks you guys