ESP8266 Developer Zone The Official ESP8266 Forum 2016-12-12T12:55:57+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=3174 2016-12-12T12:55:57+08:00 2016-12-12T12:55:57+08:00 https://bbs.espressif.com:443/viewtopic.php?t=3174&p=10877#p10877 <![CDATA[Re: Use of GPIO0 and GPIO2 on ESP-01]]> Please add your GPIO interrupt handler code.
Make sure its attribute is either IRAM_ATTR or no attribute at all. But interrupts must not be ICACHE_FLASH_ATTR!

Statistics: Posted by Guest — Mon Dec 12, 2016 12:55 pm


]]>
2016-12-06T10:55:18+08:00 2016-12-06T10:55:18+08:00 https://bbs.espressif.com:443/viewtopic.php?t=3174&p=10813#p10813 <![CDATA[Use of GPIO0 and GPIO2 on ESP-01]]> I've been working with the esp8266 module for a few days now, and I am honestly amazed.

Since the esp module I'm using only has two GPIOs, I have a microcontroller that will send analog data to the esp, which will again send that data to a tcp server. Almost all of the above are working quite fine, except I cant get any of the GPIO's to read anything, not even digital data.

Browsing this forum, I tried implementing the following suggestion, but without any success. I need your help.
Thanks for everyone reading this :)


Code:

void ICACHE_FLASH_ATTR
gpio_init(void)
{
    PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U,FUNC_GPIO0);                //GPIO Alternate Function
    GPIO_DIS_OUTPUT(GPIO_ID_PIN(0));                                  //Configure it in input mode.
    ETS_GPIO_INTR_DISABLE();                                           //Close the GPIO interrupt
    ETS_GPIO_INTR_ATTACH(GPIO_INTERRUPT,NULL);                         //Register the interrupt function
    gpio_pin_intr_state_set(GPIO_ID_PIN(0),GPIO_PIN_INTR_NEGEDGE);    //Falling edge trigger
    ETS_GPIO_INTR_ENABLE() ;                                           //Enable the GPIO interrupt
}


I then created the GPIO_INTERRUPT function that basically only printed a message. It does print when I set GPIO0 to 0, but then the device restarts. Sigh. It's the non-os version.
Any hints?

Statistics: Posted by glins — Tue Dec 06, 2016 10:55 am


]]>