Page 1 of 1

[solved] gpio_set_pull_mode(<GPIO>, GPIO_PULLUP_ONLY) not work?

Posted: Tue Feb 14, 2017 10:19 pm
by rudi ;-)
hi guys,

not sure but seems like we have a problem with Silicon Rev1 with set PULLUP intern ?
this simple code set the GPIO 34 and 35 as input, and i try to set the pullup,
the push button connector one is connected to GPIO,
the push button second connector is connected to GND,
but there is no high level if i try to get the level. what is wrong?

if i set up in hardware the pushbutton connector one with pullup resistor then i get the high level
if i push the button, then i get the low level. this work in HW , but not in SW

Code: Select all

#define BUTTON1 GPIO_NUM_34
#define BUTTON2 GPIO_NUM_35

/* Set the GPIO as a input */
     gpio_set_direction(BUTTON1, GPIO_MODE_INPUT);
     gpio_set_direction(BUTTON2, GPIO_MODE_INPUT);
    
     /* Set the GPIO pull */
     gpio_set_pull_mode(BUTTON1, GPIO_PULLUP_ONLY);
     gpio_set_pull_mode(BUTTON2, GPIO_PULLUP_ONLY);

sprintf(sendbuff, "BTN VAL: %d\n\r", gpio_get_level(BUTTON1) );
esp_at_port_write_data((uint8_t *)sendbuff,strlen(sendbuff));
i have created the issues on github too


best wishes
rudi ;-)

Re: gpio_set_pull_mode(<GPIO>, GPIO_PULLUP_ONLY) not work?

Posted: Tue Feb 14, 2017 11:00 pm
by rudi ;-)
RTFM rudi :lol:
Gpio 34-39 are input only no pullups/pulldowns
updated Note 2 ( pin list )
GPIO pins 34-39 are input-only. These pins do not feature an output driver or internal pull-up/pull-down circuitry.
solved.

best wishes
rudi ;-)

Re: [solved] gpio_set_pull_mode(<GPIO>, GPIO_PULLUP_ONLY) not work?

Posted: Wed Feb 15, 2017 3:10 pm
by jimbob
I've just had exactly the same issue, just seen the notes in the http://www.espressif.com/sites/default/ ... ist_en.pdf.

For clarity (since I'm going to have to redesign hardware as a result):

1) Is this not going to get fixed in the latest silicon revision?

2) Is PU/PD definitely not in the RTC_IO pads as well as not being available in the GPIO pads?


If so, how about putting a warning about setting the PU/PD

There's a warning if you try and set pins >=34 as output

Code: Select all

    if (gpio_num >= 34 && (mode & (GPIO_MODE_DEF_OUTPUT))) {
        ESP_LOGE(GPIO_TAG, "io_num=%d can only be input", gpio_num);
        return ESP_ERR_INVALID_ARG;
why not for Pull Ups?

Code: Select all

esp_err_t gpio_pullup_en(gpio_num_t gpio_num)
{
    GPIO_CHECK(GPIO_IS_VALID_GPIO(gpio_num), "GPIO number error", ESP_ERR_INVALID_ARG);
    if (RTC_GPIO_IS_VALID_GPIO(gpio_num)) {
        rtc_gpio_pullup_en(gpio_num);
    } else {
        REG_SET_BIT(GPIO_PIN_MUX_REG[gpio_num], FUN_PU);
    }
    return ESP_OK;
}

Re: [solved] gpio_set_pull_mode(<GPIO>, GPIO_PULLUP_ONLY) not work?

Posted: Wed Feb 15, 2017 10:00 pm
by rudi ;-)
helped me with mod on buttons
but i have mean ( input pins ) make sence to have pullup/pulldown in software, sade.
not sure that V2 have this - let me surprise.

best wishes
rudi ;-)