RMT TX pulls pin to GND (IDFGH-15421)
Answers checklist.
- [x] I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- [x] I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- [x] I have searched the issue tracker for a similar issue and not found a similar issue.
IDF version.
v6.0-dev-429-g36a5a71d5c
Espressif SoC revision.
ESP32-D0WDQ6 (revision v1.0)
Operating System used.
Linux
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
None
Development Kit.
ESP32S
Power Supply used.
USB
What is the expected behavior?
It's possible to create an RMT TX channel in open-drain mode without pulling the pin to low. -or- It's possible to write a DHT11/DHT22 driver using RMT channels.
What is the actual behavior?
Initializing the RMT TX channel pulls the pin to GND, starting the sensor's communication.
Steps to reproduce.
- Initialize an RMT TX channel as open-drain.
- The pin is pulled to GND.
Debug Logs.
Diagnostic report archive.
No response
More Information.
The idle-level is currently set unconditionally when the channel is created: https://github.com/espressif/esp-idf/blob/36a5a71d5c4b70a644a590c37b43a5da76f68ce3/components/esp_driver_rmt/src/rmt_tx.c#L333
However, for my use-case this is really bad. For an older version of the esp-idf I wrote a patch that uses the open-drain flag as indication what initial idle-level the channel should have:
diff --git a/components/esp_driver_rmt/src/rmt_tx.c b/components/esp_driver_rmt/src/rmt_tx.c
index aafa4613b2..e9ff67d05e 100644
--- a/components/esp_driver_rmt/src/rmt_tx.c
+++ b/components/esp_driver_rmt/src/rmt_tx.c
@@ -332,7 +332,7 @@ esp_err_t rmt_new_tx_channel(const rmt_tx_channel_config_t *config, rmt_channel_
// disable carrier modulation by default, can re-enable by `rmt_apply_carrier()`
rmt_ll_tx_enable_carrier_modulation(hal->regs, channel_id, false);
// idle level is determined by register value
- rmt_ll_tx_fix_idle_level(hal->regs, channel_id, 0, true);
+ rmt_ll_tx_fix_idle_level(hal->regs, channel_id, config->flags.io_od_mode ? 1 : 0, true);
// always enable tx wrap, both DMA mode and ping-pong mode rely this feature
rmt_ll_tx_enable_wrap(hal->regs, channel_id, true);
Since, in newer ESP-IDF versions the io_od_mode flag is deprecated, one could add a new config-entry, or simply copy over the current value of the pin.
Thank you for the report! This is indeed an existing issue. We will add a config to decide the level before any transmission.