Page 1 of 2

GPIO16 WOES

Posted: Sat Jun 20, 2015 4:48 pm
by scargill
I just tried GPIO16 control as here. https://github.com/willemwouters/ESP826 ... r/gpio16.c

Using SDK 1.1.2

I called gpio_output_conf();

and

gpio_output_set(1);

and IMMEDIATELY the ESP-12 REBOOTED.

What's wrong? I notice there is no GPIO16 setup in the IOT Demo of the new SDK - has something changed?

Re: GPIO16 WOES

Posted: Sat Jun 20, 2015 9:25 pm
by YimingLi
Hi,

I wonder whether your GPIO16 has been connected to the nRESET pin.

If so, I am afraid you may have to call gpio16_output_set(1) "before" a call to gpio16_output_conf(), to make sure the corresponding bit in the output register is 1 upon you set the pin as output. Or it might output a low level from GPIO16 to nReset pin and reset the esp8266 just upon the call to gpio16_output_conf().

FYI I verified it on my platform in this point as well.

Hope it will be helpful.

Re: GPIO16 WOES

Posted: Mon Jun 22, 2015 8:02 am
by scargill
Looks like you're right - according to my scope - GPIO16 is in fact attached to reset - which means it is useless as an IO pin. Thanks whoever did that!

Re: GPIO16 WOES

Posted: Mon Jun 22, 2015 10:28 am
by tve
The reason it's connected is in order to be able to wake up from deep sleep. When the esp8266 is put into deep sleep everything but the RTC is powered off. You can set a timer in the RTC that toggles GPIO16 when it expires and that resets the esp8266 causing it to power up again. This is the only way the esp8266 can wake itself up from deep sleep, so it's quite a useful function to have.
On the esp-03 module there is a tiny jumper to connect GPIO16 to reset so one can connect/disconnect it. On the esp-12, since everything is under a shield that jumper is evidently not available, so they had to decide one way or the other...

Re: GPIO16 WOES

Posted: Mon Jun 22, 2015 4:08 pm
by scargill
IMHO the wrong way. Had they left it open, customers could have chosen to short the two together, this way we lose a pin. I have responses on the blog (http://tech.scargill.net) suggesting this varies from manufacturers as there are some ESP-12s which are NOT shorted. Still - at least now we know.

Re: GPIO16 WOES

Posted: Tue Jun 23, 2015 2:58 am
by tve
What were you hoping to use GPIO16 for? It's not really as general-purpose as the other ones. At some point if you need more inputs or outputs an i2c expander is probably the easiest way to go...

(You're right that leaving gpio16-reset disconnected would have been the right way to go given that the esp-12 has both brought out, I've not worked with that module so I hadn't realized.)

Re: GPIO16 WOES

Posted: Tue Jun 23, 2015 5:59 pm
by scargill
Hi

Well, I just wanted to be able to use GPIO16 as an additional output - I have a flashing indicator on the board which indicates "all is well" and it seems a waste of an otherwise useful output. However, things are as they are and it does seem that at least some ESP-12 and ESP-12e have GPIO16 attached to RESET so short of taking the cans off we're stuck with it. It was a nice thought.

IO expanders... yes, something using no more than 2 pins - and cheap. Suggestions?

tve wrote:What were you hoping to use GPIO16 for? It's not really as general-purpose as the other ones. At some point if you need more inputs or outputs an i2c expander is probably the easiest way to go...

(You're right that leaving gpio16-reset disconnected would have been the right way to go given that the esp-12 has both brought out, I've not worked with that module so I hadn't realized.)

Re: GPIO16 WOES

Posted: Tue Jun 23, 2015 6:47 pm
by zaxl
Hi,

For example search for :
PCF8574 IO Expansion Board Expander I2C-Bus Evaluation Development module

on your favorite modules supplier site.

Or get a PCF8574 chip on your board.


Regards,
zaxl

Re: GPIO16 WOES

Posted: Sat Jul 04, 2015 4:38 am
by YimingLi
scargill wrote:Hi

Well, I just wanted to be able to use GPIO16 as an additional output - I have a flashing indicator on the board which indicates "all is well" and it seems a waste of an otherwise useful output. However, things are as they are and it does seem that at least some ESP-12 and ESP-12e have GPIO16 attached to RESET so short of taking the cans off we're stuck with it. It was a nice thought.

IO expanders... yes, something using no more than 2 pins - and cheap. Suggestions?

tve wrote:What were you hoping to use GPIO16 for? It's not really as general-purpose as the other ones. At some point if you need more inputs or outputs an i2c expander is probably the easiest way to go...

(You're right that leaving gpio16-reset disconnected would have been the right way to go given that the esp-12 has both brought out, I've not worked with that module so I hadn't realized.)


If you don't need the feature of waking up from deep sleep(if you have a control on CHIP_EN pin, wakeup from deep sleep seems not much of de facto usage), you may cut the interconnect between the nReset pin of the chipset and Gpio16 with a knife but keep the connection between Gpio16 pin of the chipset and nRESET pin of the connector. Possiblly you may find a cutting point near the chipset nReset Pin. In this way, you will let the chipset nReset pin float (don't worry, it will be pulled up internally), and the nRESET pin of Connector will de facto be the GPIO16.

Not an expertised suggestion, but possible a practical one :)

Re: GPIO16 WOES

Posted: Sat Jul 04, 2015 3:03 pm
by scargill
Thought I'd closed this one off - turns out it was a link on our boards, now resolved. Hence GPIo16 can be used as an output - OR to recover from sleep.