Support for RMT 1 MHz reference clock

meowsqueak
Posts: 151
Joined: Thu Jun 15, 2017 4:54 am
Location: New Zealand

Support for RMT 1 MHz reference clock

Postby meowsqueak » Thu Sep 14, 2017 6:21 am

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?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Support for RMT 1 MHz reference clock

Postby WiFive » Thu Sep 14, 2017 6:36 am

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.

meowsqueak
Posts: 151
Joined: Thu Jun 15, 2017 4:54 am
Location: New Zealand

Re: Support for RMT 1 MHz reference clock

Postby meowsqueak » Thu Sep 14, 2017 9:44 am

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?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Support for RMT 1 MHz reference clock

Postby WiFive » Thu Sep 14, 2017 5:00 pm

No sdk functions to configure ref_tick yet so don't expect its main feature, consistent clock at multiple cpu clocks, to work.

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Support for RMT 1 MHz reference clock

Postby ESP_igrr » Fri Sep 15, 2017 3:17 am

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

Who is online

Users browsing this forum: No registered users and 172 guests