I'm initializing an RMT peripheral as input. The moment I do that, the attached pin seems to pull up (as if it was configured as pull-up).
I haven't yet analyzed the exact value, but I can clearly see on my oscilloscope that the level of the pin is not 0 anymore.
What could be causing this? Is this expected behavior?
I have tried with two different ESP-IDF versions (5.3.1 and 5.4.1). The older one was worse (in that the pin seemed to pull even stronger).
Edit: looks like it's ~1M Ohm.
RMT input pulls pin high
-
floitsch_toit
- Posts: 43
- Joined: Wed Jun 29, 2022 4:25 pm
- Location: Aarhus, Denmark
- Contact:
-
ahsrabrifat
- Posts: 201
- Joined: Sat Jan 18, 2025 2:31 pm
Re: RMT input pulls pin high
You may get help from the following docs.
https://docs.espressif.com/projects/esp ... /gpio.html
https://docs.espressif.com/projects/esp ... s/rmt.html
https://docs.espressif.com/projects/esp ... /gpio.html
https://docs.espressif.com/projects/esp ... s/rmt.html
-
floitsch_toit
- Posts: 43
- Joined: Wed Jun 29, 2022 4:25 pm
- Location: Aarhus, Denmark
- Contact:
Re: RMT input pulls pin high
Thanks.
I have gone through these documents (multiple times...).
It doesn't explain why an RMT peripheral pulls up an input line. Maybe that's the expected behavior, but I'm pretty confident that older versions of the ESP-IDF didn't do that.
I have gone through these documents (multiple times...).
It doesn't explain why an RMT peripheral pulls up an input line. Maybe that's the expected behavior, but I'm pretty confident that older versions of the ESP-IDF didn't do that.
Re: RMT input pulls pin high
Can you provide more details?
Is it 1 or just floating? How did you read that 1MO? What is the ouput of gpio_dump_io_configuration()? Why does it bother you?but I can clearly see on my oscilloscope that the level of the pin is not 0 anymore
-
floitsch_toit
- Posts: 43
- Joined: Wed Jun 29, 2022 4:25 pm
- Location: Aarhus, Denmark
- Contact:
Re: RMT input pulls pin high
Thanks for the pointer to gpio_dump_io_configuration(). The RMT configuration does, indeed, set the pull-up flag. I will have to dig deeper, but I'm confident that my code isn't setting that flag.Can you provide more details?Is it 1 or just floating? How did you read that 1MO? What is the ouput of gpio_dump_io_configuration()? Why does it bother you?but I can clearly see on my oscilloscope that the level of the pin is not 0 anymore
Reason it bothers me: I'm using an HC-SR04 ultrasound sensor. Instead of using a voltage divider to go from 5V to 3.3V, I use the forward voltage drop of an LED to bring the level to the acceptable range. This also comes with the benefit that I have a visible indication of what the sensor is doing. (And tbh, it's just what I had on the table, whereas I would have needed to look for matching resistors). However, with the LED (being a diode), the HC-SR04 can't sink the pull-up anymore, and my pin now always read 1.
Edit: I added a dump before and after the rmt_new_rx_channel():
Code: Select all
rmt_rx_channel_config_t cfg = {
.gpio_num = static_cast<gpio_num_t>(pin_num),
.clk_src = RMT_CLK_SRC_DEFAULT,
.resolution_hz = resolution,
.mem_block_symbols = static_cast<size_t>(block_symbols),
.intr_priority = 0,
.flags = {
.invert_in = false,
.with_dma = false,
.io_loop_back = false,
},
};
gpio_dump_io_configuration(stdout, 1ULL << pin_num);
err = rmt_new_rx_channel(&cfg, &handle);
gpio_dump_io_configuration(stdout, 1ULL << pin_num);
Code: Select all
================IO DUMP Start================
IO[19] -
Pullup: 0, Pulldown: 0, DriveCap: 2
InputEn: 1, OutputEn: 0, OpenDrain: 0
FuncSel: 2 (GPIO)
GPIO Matrix SigIn ID: (simple GPIO input)
SleepSelEn: 1
=================IO DUMP End==================
================IO DUMP Start================
IO[19] -
Pullup: 1, Pulldown: 0, DriveCap: 2
InputEn: 1, OutputEn: 0, OpenDrain: 0
FuncSel: 2 (GPIO)
GPIO Matrix SigIn ID: 84
SleepSelEn: 1
=================IO DUMP End==================
-
MicroController
- Posts: 2661
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: RMT input pulls pin high
Which makes sense, not setting up an input and letting it float by default...So the 'rmt_new_rx_channel' is setting the pullup.
Sounds like all you'll need is one gpio_set_pull_mode(static_cast<gpio_num_t>(pin_num), GPIO_PULLDOWN_ONLY) after initializing the RMT channel.
However, with the ~50kOhm of the internal pull-up/pull-down resistors, I guess you won't get a visible indication from the LED.
-
floitsch_toit
- Posts: 43
- Joined: Wed Jun 29, 2022 4:25 pm
- Location: Aarhus, Denmark
- Contact:
Re: RMT input pulls pin high
Espressif just removed the pullup and lets users configure the pin independently: https://github.com/espressif/esp-idf/co ... 0244f1c41b
I normally have an external pull-down resistor. For this one board is was just a relatively high one, which is why it conflicted with the pullup. And yes: in this case I wouldn't have seen anything. This LED configuration was just my goto-approach for the RC-SR04, since it doesn't need any specific resistor values.However, with the ~50kOhm of the internal pull-up/pull-down resistors, I guess you won't get a visible indication from the LED.
Who is online
Users browsing this forum: Amazon [Bot], PetalBot, Semrush [Bot] and 5 guests