Page 1 of 1

EEP32S3 RMT rmt_tx_channel_config_t .init_level = 1, does not start HIGH

Posted: Sun Jul 26, 2026 3:46 pm
by horace99
if the following simple RMT test the setting of the initial level of the RMT channel signal is not working correctly

the call to function rmt_new_tx_channel() sets .init_level = 1 therefore the initial channel level should be high - when test is run it is LOW

using Arduino IDE V2.3.10 ESP32 core V3.3.11

Code: Select all

// ESP32S3 RMT .init_level test

// rmt_tx_channel_config_t .init_level = 1,  does not start HIGH

#include "Arduino.h"
#include "driver/rmt_tx.h"

#define DATA_OUT GPIO_NUM_14  // data transmission GPIO output

void setup() {
  pinMode(DATA_OUT, OUTPUT);
  gpio_set_level(DATA_OUT, HIGH);   // set HIGH to start
  Serial.begin(115200);
  delay(3000);
  Serial.println("\n\nESP32S3 RMT .init_level test");
  Serial.printf("0 Data out %d\n", gpio_get_level(DATA_OUT));

  // setup RMT Tx channels
  rmt_channel_handle_t tx_channels = NULL;
  gpio_num_t tx_gpio_number = DATA_OUT;  // GPIO numbers
  Serial.printf("1 Data out %d\n", gpio_get_level(DATA_OUT));

  // setup channel configurations
  rmt_tx_channel_config_t tx_chan_config = {
    .gpio_num = tx_gpio_number,
    .clk_src = RMT_CLK_SRC_DEFAULT,
    .resolution_hz = 1 * 1000 * 1000,  // 1MHz clock
    .mem_block_symbols = 64,
    .trans_queue_depth = 1,
    .flags = {
      .invert_out = false,
      .init_level = 1,  // <<  fails should start HIGH - does not work
    }
  };
  ESP_ERROR_CHECK(rmt_new_tx_channel(&tx_chan_config, &tx_channels));
  Serial.printf("2 Data out %d << should be 1 HIGH\n", gpio_get_level(DATA_OUT));
  delay(3);
  rmt_encoder_handle_t copyEncoder{ NULL };
  rmt_copy_encoder_config_t copyEncoderConfig = {};

  assert(rmt_new_copy_encoder(&copyEncoderConfig, &copyEncoder) == ESP_OK && "Failed to Create Copy Encoder");
  ESP_ERROR_CHECK(rmt_enable(tx_channels));
  Serial.printf("3 Data out %d\n", gpio_get_level(DATA_OUT));
  Serial.println("Starting Transmitters");

  rmt_transmit_config_t dataTransmitConfig = {
    .loop_count = 1,  // define neumber of transmission
    .flags = {
      .eot_level = 1,   // << works OK EOT level is HIGH
    }
  };

  rmt_symbol_word_t dataPulsePattern[] = {
    { .duration0 = 2000, .level0 = 1, .duration1 = 2000, .level1 = 0 },  // 1 bit HIGH 1 LOW
  };

  assert(rmt_transmit(tx_channels, copyEncoder, &dataPulsePattern, sizeof(dataPulsePattern), &dataTransmitConfig) == ESP_OK && "Failed to begin transmitting");
  Serial.println("Transmitters Running");
  // delay(3000);
  Serial.printf("4 Data out %d\n", gpio_get_level(DATA_OUT));
}

void loop() {}

the serial monitor output shows that after the call to rmt_new_tx_channel() where the channel should be 1 HIGH it is 0 LOW

Code: Select all

ESP32S3 RMT .init_level test
0 Data out 1
1 Data out 1
2 Data out 0 << should be 1 HIGH
3 Data out 0
Starting Transmitters
Transmitters Running
4 Data out 1
oscilloscope output confirms this

UPDATE:
test on a ESP32-C3 and ESP32-C6 same result

test on a ESP32 works correctly, e.g. serial monitor output

Code: Select all

ESP32 RMT .init_level test
0 Data out 1
1 Data out 1
2 Data out 1 << should be 1 HIGH
3 Data out 1
Starting Transmitters
Transmitters Running
4 Data out 1

oscilloscope output is now as expected