ESP8266 Developer Zone The Official ESP8266 Forum 2017-09-11T11:00:55+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=2236 2017-09-11T11:00:55+08:00 2017-09-11T11:00:55+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2236&p=15703#p15703 <![CDATA[Re: RTOS-SDK GPIO interrupt is causing reset]]>
I was trying to use GPIO pins in interrupt mode to work as keys. Used the key.c provided in the sdk. But it worked weirdly.

When I am using 3 keys (GPIO 0,2,5): Interrupts and everything perfectly.
When I am using more than 3 keys (say GPIO 0,2,5,3): Except GPIO0, interrupts from all other keys are resetting the 8266 after few seconds.

My SDK Version is :SDK - RTOS SDK 1.3

Do you have a clue why this is happening? The code you have shared (key.c) is different to what I got in RTOS SDK 1.3.
Did not find a reference to gpio_config(pGPIOConfig) function. Can you please clarify?

Regards
Ashoke Sen

Statistics: Posted by ashoke11 — Mon Sep 11, 2017 11:00 am


]]>
2016-06-12T14:19:29+08:00 2016-06-12T14:19:29+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2236&p=7283#p7283 <![CDATA[Re: RTOS-SDK GPIO interrupt is causing reset]]>
The attachment is key.c and key.h, for your reference.

if the problem haven't been solved, please gave me the uart log and bin file.
key demo.rar

Statistics: Posted by ESP_Alfred — Sun Jun 12, 2016 2:19 pm


]]>
2016-05-31T16:09:02+08:00 2016-05-31T16:09:02+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2236&p=7149#p7149 <![CDATA[RTOS-SDK GPIO interrupt is causing reset]]> My goal is to set an interrupt on GPIO0 using the OS-SDK drivers and toggle GPIO4 value according to the GPIO0 button press. Right now, when I press the button, triggering the GPIO0 pin, nothing happens.

UPDATE: now the interrupt is fired. The problem was passing GPIO_ID_PIN(0) in key_init_single() instead of GPIO_Pin_0. But now, as soon as I press the GPIO0 switch, there are multiple system reset of the module. I already disabled the internal pull up in key.c because I put an external pull up on the PCB. Which could be the possible cause?

Thanks for your help.

Code:

#include "esp_common.h"
#include "esp8266/gpio_register.h"

#include "gpio.h"
#include "key.h"
#include "user_config.h"

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

LOCAL struct keys_param keys;
LOCAL struct single_key_param *single_key[KEY_NUM];
LOCAL int state=0;
xTaskHandle switch_set_point;

LOCAL void
key_shortPress(){
   state^=1;
   //GPIO_OUTPUT_SET(GPIO_ID_PIN(4), state);
   printf("Short_press %d\n",state);
   return;
}
LOCAL void
key_longPress(){
   printf("Long_press\n");
   return;
}
void switch_set (void *pvParameters){
   //output configuration----------------------------------------------------------------------
   GPIO_ConfigTypeDef gpio_out_cfg;                                       
       gpio_out_cfg.GPIO_Mode = GPIO_Mode_Output;
       gpio_out_cfg.GPIO_Pin  = GPIO_Pin_4;
       gpio_config(&gpio_out_cfg);                                       
   //input configuration----------------------------------------------------------------------
   //declaring the input key
   single_key[0]=key_init_single(GPIO_ID_PIN(0),PERIPHS_IO_MUX_GPIO0_U,FUNC_GPIO0,key_longPress,key_shortPress);
   keys.key_num = KEY_NUM;
   keys.single_key = single_key;
   key_init(&keys);
   printf("set_interrupt and closing task\n");
   vTaskDelete(switch_set_point);
}

void ICACHE_FLASH_ATTR
user_init(void)
{
    printf("SDK version:%s\n", system_get_sdk_version());

    /* need to set opmode before you set config */
    wifi_set_opmode(STATION_MODE);

    xTaskCreate(switch_set, "switch_set", 256, NULL, (1), &switch_set_point);
}


Statistics: Posted by meaepeppe — Tue May 31, 2016 4:09 pm


]]>