Current Lua downloadable firmware will be posted here

User avatar
By Sille
#63126 Hey Vladimir,

unfortunatelly I wasn´t able to solve this problem with writing to the shown registers because I had no time to figure it out maybe I try this later. Í guess I have to program with the API and I´m not used to it until now but I will have a look to it later.

But as I said I solved the problem with a shift register and improved the setup by using a flip flop. the flip flop I'am using is more appropriate for my build. the flip flop saves the high state and keeps my sensor in the sleep mode during the esp sleeps as well. I work out an schematic and will load it up for you. It will take some time because I´m a bit busy at the moment.

best regards

Sille
User avatar
By grhhm
#82916 As stated earlier, IO state is possible to set with IO_MUX.
From: https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map
Code: Select alliomux Pin Registers (60000804h–60000843h)
31    24       16        8        0
-------- -ffff--- -------- ud--UDEe
          `- Function      ||  |||`- Output Enable
                           ||  ||`- Output Enable during sleep
                           ||  |`- Pull-down during sleep
                           ||  `- Pull-up during sleep
                           |`- Pull-down
                           `- Pull-up


Bit[2] definition thus differs between the link above and this one:
https://esp8266.ru/esp8266-pin-register ... s-register
That means, not sure if it's possible to pull IO down during the deep sleep, worth to try. I didn't tried that, not needed.
The Pin-register map is good to locate the register number for your required GPIO.

To set GPIO in pull up state during deep sleep, bits [0], [1], [3] and [7] should be asserted.
It's recommended by read-modify-write process. Example for GPIO14:
Code: Select alluint32_t val = READ_PERI_REG(PERIPHS_IO_MUX + 12);
uint32_t mask = 0x8b;  /bits[0,1,3,7] asserted. Same as value to be asserted.
WRITE_PERI_REG(PERIPHS_IO_MUX + 12, (!mask & val) | (mask & 0x8b));

The expression (mask & 0x8b) is universal approach to read-mod-write. It's practically needed only in case you want to set some bits to 0. That is not the case, so just 0x8b is enough here.

The GPIO configuration is reset by MCU boot. Run read-mod-write every boot.
User avatar
By Lademeister
#83613 I do not understand how +12 relates to GPIO 14, reading all the links you posted.
I am trying to set GPIO0 HIGH during deepsleep on ESP8266, pullup would be enough.

How would the code look like for GPIO0?

I would highly appreciate if someone could sort that out, because I am pretty sure that there are a lot of guys out there that encounter the same problem.

I think the most helpful way for all would be an example code for arduino IDE that includes the procedure for all GPIOs.

I did try to modify above example code to GPIO0 but I didn’t succeed- mainly because I do not understand how +12 corellates to the hex register adress of GPIO14 in the table.
User avatar
By Lademeister
#83634
grhhm wrote: Example for GPIO14:
Code: Select alluint32_t val = READ_PERI_REG(PERIPHS_IO_MUX + 12);
uint32_t mask = 0x8b;  /bits[0,1,3,7] asserted. Same as value to be asserted.
WRITE_PERI_REG(PERIPHS_IO_MUX + 12, (!mask & val) | (mask & 0x8b));



@grhhm: could you explain what you did here?