Code: Select all
#include "Arduino.h"
#include "driver/rmt_tx.h"
void setup() {
Serial.begin(115200);
delay(2000);
rmt_channel_handle_t txChannel {NULL};
rmt_tx_channel_config_t tx_chan_config = {
.gpio_num = GPIO_NUM_19,
.clk_src = RMT_CLK_SRC_DEFAULT, // select source clock
.resolution_hz = 10000000, // 10MHz resolution,
.mem_block_symbols = 64,
.trans_queue_depth = 4, // set the number of transactions that can be pending in the background
};
assert(rmt_new_tx_channel(&tx_chan_config, &txChannel)==ESP_OK && "Failed to Create RMT Channel");
rmt_transmit_config_t transmitConfig = {
.loop_count = -1
};
rmt_encoder_handle_t copyEncoder {NULL};
rmt_copy_encoder_config_t copyEncoderConfig = {};
assert(rmt_new_copy_encoder(©EncoderConfig, ©Encoder)==ESP_OK && "Failed to Create Copy Encoder");
const rmt_symbol_word_t pulsePattern[] = {
{.duration0 = 50, .level0 = 1, .duration1 = 50, .level1 = 0},
};
assert(rmt_enable(txChannel)==ESP_OK && "Failed to Enable txChannel");
Serial.println("Starting Transmitter");
assert(rmt_transmit(txChannel, copyEncoder, &pulsePattern, sizeof(pulsePattern), &transmitConfig)==ESP_OK && "Failed to begin transmitting");
Serial.println("Transmitter Running");
}
void loop() {
}the resolution is 10MHz and
Code: Select all
const rmt_symbol_word_t pulsePattern[] = {
{.duration0 = 50, .level0 = 1, .duration1 = 50, .level1 = 0},
};
this shows the low is 5.1uSec (high is correct 5Usec)
if I change the rmt_symbol_word_t to
Code: Select all
const rmt_symbol_word_t pulsePattern[] = {
{.duration0 = 50, .level0 = 1, .duration1 = 49, .level1 = 0},
};
tested on three ESP-WROOM-32 based modules - identical problem
I checked the calibration of the oscilloscope with the built in pulse generator and a separate pulse generator
I implemented this program several months ago and don't remember having this problem at the time