GPIO16 and setting RST line

geo.espressif
Posts: 28
Joined: Tue Mar 31, 2015 7:27 pm

GPIO16 and setting RST line

Postby geo.espressif » Mon Dec 14, 2015 5:11 pm

Could anyone help me with some code to set GPIO16 low, it appears to be interfering with our ability to reset the device (it's causing a fight over reset line being low/high). There don't seem to be any register definitions for it in eagle_soc.h

James

dkinzer
Posts: 52
Joined: Fri Jul 31, 2015 7:37 am

Re: GPIO16 and setting RST line

Postby dkinzer » Wed Dec 16, 2015 11:51 pm

geo.espressif wrote:Could anyone help me with some code to set GPIO16 low
For future reference, the Arduino-ESP8266 code is a good place to begin researching how to accomplish something on the ESP8266.

To use GPIO16, you must map it to be an I/O pin somewhere in your initialization:

Code: Select all

uint32_t val;

// map GPIO16 as an I/O pin
val = READ_PERI_REG(PAD_XPD_DCDC_CONF) & 0xffffffbc;
WRITE_PERI_REG(PAD_XPD_DCDC_CONF, val | 0x00000001);
val = READ_PERI_REG(RTC_GPIO_CONF) & 0xfffffffe;
WRITE_PERI_REG(RTC_GPIO_CONF, val | 0x00000000);

Then, to set GPIO16 high or low:

Code: Select all

// set the pin state first, then enable output
val = READ_PERI_REG(RTC_GPIO_OUT);
WRITE_PERI_REG(RTC_GPIO_OUT, pinHigh ? (val | 1) : (val & ~1));
val = READ_PERI_REG(RTC_GPIO_ENABLE);
WRITE_PERI_REG(RTC_GPIO_ENABLE, val | 1);

For completeness, this is how you read GPIO16 as an input:

Code: Select all

// set as an input
val = READ_PERI_REG(RTC_GPIO_ENABLE);
WRITE_PERI_REG(RTC_GPIO_ENABLE, val & ~1);

// read the input state
val = READ_PERI_REG(RTC_GPIO_IN_DATA) & 1);
Don Kinzer
Beaverton, OR, USA

geo.espressif
Posts: 28
Joined: Tue Mar 31, 2015 7:27 pm

Re: GPIO16 and setting RST line

Postby geo.espressif » Wed Feb 03, 2016 5:40 pm

Awesome, thanks!

fengwanjun
Posts: 1
Joined: Fri Mar 11, 2016 4:23 pm

Re: GPIO16 and setting RST line

Postby fengwanjun » Sat Mar 19, 2016 10:36 pm

I use your code .
But like the old ones. When gpio16_output_set(0),it goes like a system reset.
Why????

Who is online

Users browsing this forum: No registered users and 14 guests