OVMS3-idf/components/soc/esp32
Ivan Grokhotkov 6e9d60ef70 rtc_clk_init: handle case when XTAL frequency has already been set
On first reset, ROM code writes the estimated XTAL frequency into
RTC_APB_FREQ_REG (aka STORE5). If the application doesn’t specify exact
XTAL frequency (which is always the case for now), rtc_clk_init will
guess what kind of XTAL is used (26M or 40M), based on the estimated
frequency. Later, detected frequency is written into RTC_XTAL_FREQ_REG
(aka STORE4).

When the application switches clock source to PLL, APB frequency changes
and RTC_APB_FREQ_REG is updated. If the application encounters an RTC
WDT reset, RTC_APB_FREQ_REG will not be updated prior to reset. Once the
application starts up again, it will attempt to auto-detect XTAL
frequency based on RTC_APB_FREQ_REG, which now has value of 80000000.
This will fail, and rtc_clk_xtal_freq_estimate will fall back to the
default value of 26 MHz. Due to an incorrect XTAL frequency, PLL
initialization will also take incorrect path, and PLL will run at a
different frequency. Depending on the application this may cause just
garbage output on UART or a crash (if WiFi is used).
2017-04-21 10:33:58 +08:00
..
include add detection of invalid cache access 2017-04-13 15:27:38 +08:00
test soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
brownout.c soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
cpu_util.c soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
i2c_apll.h soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
i2c_bbpll.h soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
i2c_rtc_clk.h soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
rtc_clk.c rtc_clk_init: handle case when XTAL frequency has already been set 2017-04-21 10:33:58 +08:00
rtc_init.c soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
rtc_pm.c soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
rtc_sleep.c soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
rtc_time.c soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00
soc_log.h soc: add source code of rtc_clk, rtc_pm 2017-04-11 15:45:54 +08:00