Problems using Gpio36 as gpio sensor_vp
Posted: Sat Aug 19, 2017 8:07 pm
I have 5 buttons declared, like i will describe in the code below, 4 of them work but the one declared on gpio_36.
i declare the gpio's, the mode, and interrupts mode, i also declare the xsempahore and finally the taker.
the problem is that the gpio_36, keeps triggering the xsemaphore/interrupts and i keep seeing on the monitor:
button 36 false
button 36 false
button 36 false
button 36 false
...
without even touching the button, as i said the other 4 gpio work properly as expected but this one.
i tried using: PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[36], PIN_FUNC_GPIO);
but the behavior is the same i keep seeing the interrupts triggered on its own.
anyone can shade some light with this issue?
Declarations:
xsemaphore:
the taker;
i declare the gpio's, the mode, and interrupts mode, i also declare the xsempahore and finally the taker.
the problem is that the gpio_36, keeps triggering the xsemaphore/interrupts and i keep seeing on the monitor:
button 36 false
button 36 false
button 36 false
button 36 false
...
without even touching the button, as i said the other 4 gpio work properly as expected but this one.
i tried using: PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[36], PIN_FUNC_GPIO);
but the behavior is the same i keep seeing the interrupts triggered on its own.
anyone can shade some light with this issue?
Declarations:
Code: Select all
#define GPIO_36 36
gpio_pad_select_gpio(GPIO_36 );
gpio_set_direction(GPIO_36 , GPIO_MODE_INPUT);
gpio_install_isr_service(0);
gpio_isr_handler_add(GPIO_36 , handler_botton_5, NULL);
gpio_set_intr_type(GPIO_36 , GPIO_INTR_ANYEDGE);
Code: Select all
void IRAM_ATTR handler_botton_5(void* arg) {
xSemaphoreGiveFromISR(xSemaphore_button_5, NULL);
}
Code: Select all
while(1){
if(xSemaphoreTake(xSemaphore_button_5,( TickType_t ) 2) == pdTRUE) {
//printf("Pulsador 2 presionado!\n");
vTaskDelay(5/portTICK_PERIOD_MS);
if(gpio_get_level(GPIO_36 ) ==0){
printf("button 36 true \n");
Button_bits[3]=true;
}else{
printf("button 36 false \n");
Button_bits[3]=false;
}
}
vTaskDelay(500/portTICK_PERIOD_MS);
}