Page 1 of 1

Support for RMT 1 MHz reference clock

Posted: Thu Sep 14, 2017 6:21 am
by meowsqueak
The docs say that the 1 MHz reference clock - RMT_BASECLK_REF - is "Not supported in this version":

https://esp-idf.readthedocs.io/en/v2.0/ ... urce_clk_t

Does the hardware support a 1 MHz reference clock? If so, is this something likely to be supported sooner, or later?

Actually, is it really a hardware clock?

Re: Support for RMT 1 MHz reference clock

Posted: Thu Sep 14, 2017 6:36 am
by WiFive
REF_TICK is derived from APB_CLK via a divider.

By configuring correct divider values for each APB_CLK source, the user can ensure that the REF_TICK
frequency does not change when CPU_CLK changes source, causing the APB_CLK frequency to change.

Re: Support for RMT 1 MHz reference clock

Posted: Thu Sep 14, 2017 9:44 am
by meowsqueak
Ok, so I understand from what you've just said that the "1 MHz reference clock" needs to be set up myself, using the correct divider for the current CPU clock speed, because that is not yet done by the SDK. I'll study the System Clock section (3.2) in the reference manual.

Just wanted to note that if I do use the value RMT_BASECLK_REF I do actually get a result from the RMT consistent with a 1MHz clock, at the default APB clock of 80MHz at least. So is the main issue that the SDK doesn't scale properly if the CPU clock changes?

EDIT: I see now that you've quoted the Reference Manual, section 3.2.4.2. So to be clear, my question is really about why the SDK docs say "not yet supported" - what exactly isn't supported?

Re: Support for RMT 1 MHz reference clock

Posted: Thu Sep 14, 2017 5:00 pm
by WiFive
No sdk functions to configure ref_tick yet so don't expect its main feature, consistent clock at multiple cpu clocks, to work.

Re: Support for RMT 1 MHz reference clock

Posted: Fri Sep 15, 2017 3:17 am
by ESP_igrr
With default register settings, REF_TICK works okay (= produces 1MHz clock) at any CPU clock, provided that 40MHz XTAL is used.

The change which fixes the behavior for 26 MHz XTAL is coming up as part of frequency switching support.

As for RMT, i think the note in the driver docs means that only RMT_BASECLK_APB is considered in the code.
However it is possible to use RMT with REF_TICK directly via register manipulation (e.g. https://github.com/espressif/esp-idf/bl ... lock.c#L88).