RMT input pulls pin high

floitsch_toit
Posts: 43
Joined: Wed Jun 29, 2022 4:25 pm
Location: Aarhus, Denmark
Contact:

RMT input pulls pin high

Postby floitsch_toit » Mon Jun 02, 2025 6:56 pm

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.

ahsrabrifat
Posts: 201
Joined: Sat Jan 18, 2025 2:31 pm

Re: RMT input pulls pin high

Postby ahsrabrifat » Tue Jun 03, 2025 8:23 am


floitsch_toit
Posts: 43
Joined: Wed Jun 29, 2022 4:25 pm
Location: Aarhus, Denmark
Contact:

Re: RMT input pulls pin high

Postby floitsch_toit » Tue Jun 03, 2025 12:00 pm

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.

ves011
Posts: 59
Joined: Fri Oct 07, 2022 2:31 pm
Location: romania
Contact:

Re: RMT input pulls pin high

Postby ves011 » Tue Jun 03, 2025 12:36 pm

Can you provide more details?
but I can clearly see on my oscilloscope that the level of the pin is not 0 anymore
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?

floitsch_toit
Posts: 43
Joined: Wed Jun 29, 2022 4:25 pm
Location: Aarhus, Denmark
Contact:

Re: RMT input pulls pin high

Postby floitsch_toit » Wed Jun 04, 2025 3:36 pm

Can you provide more details?
but I can clearly see on my oscilloscope that the level of the pin is not 0 anymore
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?
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.

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);
leads to

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==================
So the 'rmt_new_rx_channel' is setting the pullup.

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

Re: RMT input pulls pin high

Postby MicroController » Thu Jun 05, 2025 8:29 am

So the 'rmt_new_rx_channel' is setting the pullup.
Which makes sense, not setting up an input and letting it float by default...

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

Postby floitsch_toit » Fri Jun 06, 2025 8:32 am

Espressif just removed the pullup and lets users configure the pin independently: https://github.com/espressif/esp-idf/co ... 0244f1c41b

However, with the ~50kOhm of the internal pull-up/pull-down resistors, I guess you won't get a visible indication from the LED.
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.

Who is online

Users browsing this forum: Amazon [Bot], PetalBot, Semrush [Bot] and 5 guests