RMT initialization default for source clock not always APB?
RMT initialization default for source clock not always APB?
I have 2 esp32-wroom-32E modules, one is a "ESP32-WROOM-32E (4MB HIGH TEMP)". This modules seems to default the RMT source clock to "REF tick clock, which would be 1Mhz (not supported in this version)", my other module (and others that I have tested) default to "APB clock". This examplehttps://github.com/espressif/esp-idf/tr ... _protocols does not set the source clock and does not function correctly on the "HIGH TEMP" module unless `rmt_set_source_clk(_channel, RMT_BASECLK_APB)` is called. Was there a hardware change? Both modules claim to be v3. Maybe I'm missing some other designator that would let me know? Has anyone else seen this?
-
- Posts: 9749
- Joined: Thu Nov 26, 2015 4:08 am
Re: RMT initialization default for source clock not always APB?
V3 silicon is V3 silicon, there shouldn't be a difference between these. (And even if it were a different version, I don't think the RMT changed.)
Re: RMT initialization default for source clock not always APB?
Thanks for that. I think I figured out what was going on. The (Arduino) library I'm using initializes RMT like this
And that leaves the "flags" field uninitialized with random data. Looking in rmt.c I see
So random data was forcing it to REF_CLK.
Code: Select all
rmt_config_t rmt_rx;
rmt_rx.channel = _channel;
rmt_rx.gpio_num = rx_pin;
rmt_rx.clk_div = RMT_CLK_DIV;
rmt_rx.mem_block_num = 1;
rmt_rx.rmt_mode = RMT_MODE_RX;
rmt_rx.rx_config.filter_en = true;
rmt_rx.rx_config.filter_ticks_thresh = RMT_FILTER_THRESH;
rmt_rx.rx_config.idle_threshold = RMT_IDLE_TIMEOUT;
if (rmt_config(&rmt_rx) != ESP_OK) return false;
Code: Select all
if (rmt_param->flags & RMT_CHANNEL_FLAGS_ALWAYS_ON) {
// clock src: REF_CLK
rmt_source_clk_hz = REF_CLK_FREQ;
rmt_ll_set_counter_clock_src(dev, channel, RMT_BASECLK_REF);
} else {
// clock src: APB_CLK
rmt_source_clk_hz = APB_CLK_FREQ;
rmt_ll_set_counter_clock_src(dev, channel, RMT_BASECLK_APB);
}
Who is online
Users browsing this forum: ESP_igrr and 123 guests