GPIO 27 Pullup not working

jubueche
Posts: 32
Joined: Sat Jan 19, 2019 4:03 pm

GPIO 27 Pullup not working

Postby jubueche » Tue Jan 22, 2019 10:15 am

I have selected the GPIO27 as input and pulled it up in the code. When I measure the voltage between GND and the pin, I am constantly reading 0V.

Here is my code:

Code: Select all

/*
	 * Add hardware interrupt handler.
	 */
	gpio_evt_queue = xQueueCreate(10, sizeof(gpio_num_t));
	xTaskCreate(gpio_task_example, "gpio_task_example", 2048, NULL, 10, NULL);
	gpio_config_t gpioConfig;
	gpioConfig.pin_bit_mask = GPIO_SEL_27;
	gpioConfig.mode = GPIO_MODE_INPUT;
	gpioConfig.pull_up_en = GPIO_PULLUP_ENABLE;
	gpioConfig.pull_down_en = GPIO_PULLDOWN_DISABLE;
	gpioConfig.intr_type = GPIO_INTR_NEGEDGE;
	gpio_config(&gpioConfig);
	gpio_install_isr_service(0);
	gpio_isr_handler_add(gpio_num_t_INT_PIN, gpio_isr_handler, NULL);
	/*
	 * Configure sensor interrupts.
	 */
	this->setIntEnable(interrupt_flags);
	uint16_t int_config = this->getIntEnable();
	printf("Int enable: %d\n", int_config);
And this is my handler and task that reads the queue:

Code: Select all

static void IRAM_ATTR gpio_isr_handler(void* arg)
{
    uint32_t gpio_num = (uint32_t) arg;
    xQueueSendFromISR(gpio_evt_queue, &gpio_num, NULL);
}

static void gpio_task_example(void* arg)
{
    uint32_t io_num;
    for(;;) {
        if(xQueueReceive(gpio_evt_queue, &io_num, portMAX_DELAY)) {
            printf("Interrupt!\n");
        }
    }
}
Maybe this is a duplicate, because I saw a post that said that there was a silicon bug and you could not pull up the GPIO27, but it was from 2016.
Q1: Was that silicon bug fixed (have the chips that are produced now a different layout?) ?
Q2: If GPIO27 does not work as a pull up, which does?

Thanks guys!

mikemoy
Posts: 604
Joined: Fri Jan 12, 2018 9:10 pm

Re: GPIO 27 Pullup not working

Postby mikemoy » Tue Jan 22, 2019 2:17 pm

I just tried the following, and confirmed with my logic probe, and it works fine for me. Tested both pull up and pull down.

Code: Select all

// Test Pulldown
gpio_set_direction(GPIO_NUM_27, GPIO_MODE_INPUT);
gpio_pulldown_en(GPIO_NUM_27);

// Test Pullup
gpio_set_direction(GPIO_NUM_27, GPIO_MODE_INPUT);
gpio_pullup_en(GPIO_NUM_27);

jubueche
Posts: 32
Joined: Sat Jan 19, 2019 4:03 pm

Re: GPIO 27 Pullup not working

Postby jubueche » Tue Jan 22, 2019 10:25 pm

Sorry I made a stupid mistake.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 113 guests