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

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

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

Postby rudi ;-) » Tue Feb 14, 2017 10:19 pm

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 ;-)
Last edited by rudi ;-) on Tue Feb 14, 2017 11:01 pm, edited 1 time in total.
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

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

Postby rudi ;-) » Tue Feb 14, 2017 11:00 pm

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 ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

jimbob
Posts: 29
Joined: Fri Aug 05, 2016 10:47 pm

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

Postby jimbob » Wed Feb 15, 2017 3:10 pm

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;
}

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

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

Postby rudi ;-) » Wed Feb 15, 2017 10:00 pm

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 ;-)
Attachments
Buttons.jpg
Buttons.jpg (210.07 KiB) Viewed 19505 times
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: No registered users and 54 guests