RMT initialization default for source clock not always APB?

liebman
Posts: 18
Joined: Wed Dec 09, 2020 7:03 pm

RMT initialization default for source clock not always APB?

Postby liebman » Sat Oct 16, 2021 10:51 pm

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?

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: RMT initialization default for source clock not always APB?

Postby ESP_Sprite » Mon Oct 18, 2021 12:39 am

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.)

liebman
Posts: 18
Joined: Wed Dec 09, 2020 7:03 pm

Re: RMT initialization default for source clock not always APB?

Postby liebman » Mon Oct 18, 2021 1:47 pm

Thanks for that. I think I figured out what was going on. The (Arduino) library I'm using initializes RMT like this

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;
And that leaves the "flags" field uninitialized with random data. Looking in rmt.c I see

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);
    }
So random data was forcing it to REF_CLK.

Who is online

Users browsing this forum: Baidu [Spider] and 120 guests