From 241d92bdc57e0137eccf2108a46e53e558ffeb24 Mon Sep 17 00:00:00 2001 From: Florian Loitsch Date: Fri, 6 Jun 2025 10:41:48 +0200 Subject: [PATCH] Set the initial value of the RMT-TX to 1 when in open-drain. This works around https://github.com/espressif/esp-idf/issues/16068. Once that issue is resolved we should adopt their solution. --- components/esp_driver_rmt/src/rmt_tx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/esp_driver_rmt/src/rmt_tx.c b/components/esp_driver_rmt/src/rmt_tx.c index 75dc021560f0..d4032ae8bd06 100644 --- a/components/esp_driver_rmt/src/rmt_tx.c +++ b/components/esp_driver_rmt/src/rmt_tx.c @@ -348,7 +348,10 @@ 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); + // Toit: work around https://github.com/espressif/esp-idf/issues/16068. + // It should be possible to set the initial idle level, but to make things a bit easier, we + // always set it to 1 for open-drain configurations. It's the safer and more useful option. + rmt_ll_tx_fix_idle_level(hal->regs, channel_id, config->flags.io_loop_back ? 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);