Current Lua downloadable firmware will be posted here

User avatar
By Sille
#61994 Hey guys,

i was wondering if it is possible to keep a programmed gpio-state during the deep-sleep. i measured that some gpio's have high state during deep sleep for example when the rst-pin is connected to gpio16. My purpose is to control another device which is connected to my esp with setting a high state on a gpio. This device needs a high state to sleep and wakes when the state drops to a low. This my problem because the high state drops to low during the deep sleep on my esp dev kit. Is there any possibility by using the nodemcu modules without adding additional hardware? help would be appreciated. Thanks a lot.

best regards

Sille
User avatar
By Barnabybear
#62007 Hi, the sleep state of GPIOs can be set. The only way I have seen of doing it is directly addressing a register and I can't find the example at this moment (sorry I know thats not much help). You need to be looking for the register that sets the GPIO sleep state.
User avatar
By Sille
#62009 Hey Barnabybear,

thank you for your reply, that is a more than I expected and maybe now I can find some more information on the inet. It is realy important for me, my sensor is drawing round about 45mA I have to shut him down because I need to run my system as long as possible with a battery. My ESP devkit unfortunatelly draws still 18mA in sleep mode but maybe I can live with that but first I want to manage this issue with the sensor. I wasn´t looking for code examples in first order but if would find a snippet where you can show how to address a register on the ESP it would be very nice. I'am used to code with the nodemcu-modules and the esplorer I never saw this possibility to write to an register. Do I have to change my IDE or something to do something like this? Where do I find such informations are they given by espressif or nodemcu or did you find it out on your own? I saw in a datasheet from espressif that there is the possibility but it wasn´t written how to manage this. anyway thanks a lot :) maybe we can keep this talk going on.

best regards

sille
User avatar
By Barnabybear
#62103 Hi, I found this reference whilst looking for the GPIO16 register - it still doesn't help much but is a bit more infomation.
https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map

Right at the end - iomux Pin Registers (60000804h–60000843h)

I read this as:
Writing 0x00000002 to the register would enable output during sleep.
Writing 0x00000004 to the register would set a pull down during sleep, (0x00000006) with enable output during sleep.
Writing 0x00000008 to the register would set a pull up during sleep, (0x0000000A) with enable output during sleep.

But I can't tell you the address of the register to write to. Will post if I find it.

EDIT: it looks like the addresses are in the second table of this post.
https://esp8266.ru/esp8266-pin-register-strapping/

I doesn't quite match the bit layout of the other page but does give the register addresses. I guess you'll just have to write and see what happens ;)