Can someone to explain me this behaviour?

dotatbg
Posts: 3
Joined: Fri Dec 29, 2023 10:13 am

Can someone to explain me this behaviour?

Postby dotatbg » Fri Dec 29, 2023 10:23 am

The code
  1. gpio_config_t io_conf = {};
  2.     gpio_num_t gpio_test_pin =  GPIO_NUM_5;
  3.     io_conf.intr_type = GPIO_INTR_DISABLE;
  4.     io_conf.mode = GPIO_MODE_INPUT_OUTPUT_OD;
  5.     io_conf.pin_bit_mask = BIT64(gpio_test_pin);
  6.     io_conf.pull_down_en = 1;
  7.     io_conf.pull_up_en = 1;
  8.     gpio_config(&io_conf);
  9.     gpio_dump_io_configuration(stdout, BIT64(gpio_test_pin));
  10.     ESP_LOGW("MUXREG", "%lX = %lx", GPIO_PIN_MUX_REG[gpio_test_pin], READ_PERI_REG(GPIO_PIN_MUX_REG[gpio_test_pin]));
  11.     gpio_pullup_en(gpio_test_pin);
  12.     gpio_pulldown_en(gpio_test_pin);
  13.     ESP_LOGW("MUXREG", "%lX = %lx", GPIO_PIN_MUX_REG[gpio_test_pin], READ_PERI_REG(GPIO_PIN_MUX_REG[gpio_test_pin]));
  14.     gpio_dump_io_configuration(stdout, BIT64(gpio_test_pin));
  15.     REG_SET_BIT(GPIO_PIN_MUX_REG[gpio_test_pin], FUN_PU);
  16.     gpio_dump_io_configuration(stdout, BIT64(gpio_test_pin));
Result GPIO_NUM_5
  1. I (400) gpio: GPIO[5]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 1| Intr:0
  2. ================IO DUMP Start================
  3. IO[5] -
  4.   Pullup: 1, Pulldown: 1, DriveCap: 2
  5.   InputEn: 1, OutputEn: 1, OpenDrain: 1
  6.   FuncSel: 2 (GPIO)
  7.   GPIO Matrix SigOut ID: 256 (simple GPIO output)
  8.   GPIO Matrix SigIn ID: (simple GPIO input)
  9.   SleepSelEn: 0
  10.  
  11. =================IO DUMP End==================
  12. W (430) MUXREG: 3FF4906C = 2b80
  13. W (440) MUXREG: 3FF4906C = 2b80
  14. ================IO DUMP Start================
  15. IO[5] -
  16.   Pullup: 1, Pulldown: 1, DriveCap: 2
  17.   InputEn: 1, OutputEn: 1, OpenDrain: 1
  18.   FuncSel: 2 (GPIO)
  19.   GPIO Matrix SigOut ID: 256 (simple GPIO output)
  20.   GPIO Matrix SigIn ID: (simple GPIO input)
  21.   SleepSelEn: 0
  22.  
  23. =================IO DUMP End==================
  24. ================IO DUMP Start================
  25. IO[5] -
  26.   Pullup: 1, Pulldown: 1, DriveCap: 2
  27.   InputEn: 1, OutputEn: 1, OpenDrain: 1
  28.   FuncSel: 2 (GPIO)
  29.   GPIO Matrix SigOut ID: 256 (simple GPIO output)
  30.   GPIO Matrix SigIn ID: (simple GPIO input)
  31.   SleepSelEn: 0
  32.  
  33. =================IO DUMP End==================
Result GPIO_NUM_2
  1. I (400) gpio: GPIO[2]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 1| Intr:0
  2. ================IO DUMP Start================
  3. IO[2] -
  4.   Pullup: 0, Pulldown: 1, DriveCap: 2
  5.   InputEn: 1, OutputEn: 1, OpenDrain: 1
  6.   FuncSel: 2 (GPIO)
  7.   GPIO Matrix SigOut ID: 256 (simple GPIO output)
  8.   GPIO Matrix SigIn ID: (simple GPIO input)
  9.   SleepSelEn: 0
  10.  
  11. =================IO DUMP End==================
  12. W (430) MUXREG: 3FF49040 = 2a80
  13. W (440) MUXREG: 3FF49040 = 2a80
  14. ================IO DUMP Start================
  15. IO[2] -
  16.   Pullup: 0, Pulldown: 1, DriveCap: 2
  17.   InputEn: 1, OutputEn: 1, OpenDrain: 1
  18.   FuncSel: 2 (GPIO)
  19.   GPIO Matrix SigOut ID: 256 (simple GPIO output)
  20.   GPIO Matrix SigIn ID: (simple GPIO input)
  21.   SleepSelEn: 0
  22.  
  23. =================IO DUMP End==================
  24. ================IO DUMP Start================
  25. IO[2] -
  26.   Pullup: 1, Pulldown: 1, DriveCap: 2
  27.   InputEn: 1, OutputEn: 1, OpenDrain: 1
  28.   FuncSel: 2 (GPIO)
  29.   GPIO Matrix SigOut ID: 256 (simple GPIO output)
  30.   GPIO Matrix SigIn ID: (simple GPIO input)
  31.   SleepSelEn: 0
  32.  
  33. =================IO DUMP End==================
Chip is ESP32-WROVER-B

MicroController
Posts: 1705
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Can someone to explain me this behaviour?

Postby MicroController » Fri Dec 29, 2023 10:42 am

Can you explain why you'd want to have both pull-up and pull-down enabled at the same time?

dotatbg
Posts: 3
Joined: Fri Dec 29, 2023 10:13 am

Re: Can someone to explain me this behaviour?

Postby dotatbg » Fri Dec 29, 2023 1:12 pm

For no reason... DC Bias for example. But you answer is not an explanation

MicroController
Posts: 1705
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Can someone to explain me this behaviour?

Postby MicroController » Sat Dec 30, 2023 1:45 am

I guess it's not. And stating that it's not a good idea to pull digital inputs to a voltage right between high and low is not an explanation either ;)

Who is online

Users browsing this forum: Bing [Bot] and 68 guests