GPIO_NUM_16 & GPIO_NUM_25 is not working with gpio_set_level

dkroboton
Posts: 1
Joined: Mon May 10, 2021 1:47 pm

GPIO_NUM_16 & GPIO_NUM_25 is not working with gpio_set_level

Postby dkroboton » Mon May 10, 2021 1:55 pm

In my project, i am using lots of module like Wi-Fi, Bluetooth, Mqtt and OTA ..etc..
All are working fine.
But when I tried to set gpio level for 16 & 25. it doesn't seems to change when measuring with multimeter.
But when I run the gpio_set_level in a loop it changes. I can measure it with the Multimeter.

Note. This behavior is only for GPIO 16 & 25. Rest of the IO are working as it should be. I tried with multiple dev Board along with my custom made. The results are the same.

I don't know why this is happening. Can Someone help me.

This is my test code.

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "driver/gpio.h"

#define GPIO_OUTPUT_IO_0 16
#define GPIO_OUTPUT_IO_1 25
#define GPIO_OUTPUT_PIN_SEL ((1ULL<<GPIO_OUTPUT_IO_0) | (1ULL<<GPIO_OUTPUT_IO_1))
#define GPIO_INPUT_IO_0 4
#define GPIO_INPUT_IO_1 5
#define GPIO_INPUT_PIN_SEL ((1ULL<<GPIO_INPUT_IO_0) | (1ULL<<GPIO_INPUT_IO_1))
#define ESP_INTR_FLAG_DEFAULT 0

#define HIGH 1
#define LOW 0

void app_main(void)
{
gpio_config_t io_conf;
//disable interrupt
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
//set as output mode
io_conf.mode = GPIO_MODE_OUTPUT;
//bit mask of the pins that you want to set,e.g.GPIO18/19
io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;
//disable pull-down mode
io_conf.pull_down_en = 0;
//disable pull-up mode
io_conf.pull_up_en = 0;
//configure GPIO with the given settings
gpio_config(&io_conf);

//interrupt of rising edge
io_conf.intr_type = GPIO_PIN_INTR_POSEDGE;
//bit mask of the pins, use GPIO4/5 here
io_conf.pin_bit_mask = GPIO_INPUT_PIN_SEL;
//set as input mode
io_conf.mode = GPIO_MODE_INPUT;
//enable pull-up mode
io_conf.pull_up_en = 1;
gpio_config(&io_conf);

//change gpio intrrupt type for one pin
// gpio_set_intr_type(GPIO_INPUT_IO_0, GPIO_INTR_ANYEDGE);

//create a queue to handle gpio event from isr
// gpio_evt_queue = xQueueCreate(10, sizeof(uint32_t));
// //start gpio task
// xTaskCreate(gpio_task_example, "gpio_task_example", 2048, NULL, 10, NULL);

//install gpio isr service
gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
//hook isr handler for specific gpio pin
// gpio_isr_handler_add(GPIO_INPUT_IO_0, gpio_isr_handler, (void*) GPIO_INPUT_IO_0);
// //hook isr handler for specific gpio pin
// gpio_isr_handler_add(GPIO_INPUT_IO_1, gpio_isr_handler, (void*) GPIO_INPUT_IO_1);

//remove isr handler for gpio number.
// gpio_isr_handler_remove(GPIO_INPUT_IO_0);
// //hook isr handler for specific gpio pin again
// gpio_isr_handler_add(GPIO_INPUT_IO_0, gpio_isr_handler, (void*) GPIO_INPUT_IO_0);

int cnt = 0;
gpio_set_level(BM_LITE_RST_N,HIGH);
gpio_set_level(BM_LITE_IRQ,HIGH);
// while(1) {
// printf("cnt: %d\n", cnt++);
// vTaskDelay(1000 / portTICK_RATE_MS);
// gpio_set_level(GPIO_OUTPUT_IO_0, cnt % 2);
// gpio_set_level(GPIO_OUTPUT_IO_1, cnt % 2);
// }
}

Who is online

Users browsing this forum: Google [Bot] and 135 guests