]> granicus.if.org Git - esp-idf/commitdiff
esp32: select 8M clock as RTC_FAST_CLK on startup
authorIvan Grokhotkov <ivan@espressif.com>
Thu, 27 Apr 2017 04:42:56 +0000 (12:42 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Thu, 27 Apr 2017 04:44:54 +0000 (12:44 +0800)
Even though RTC_CLK_CONFIG_DEFAULT correctly had RTC_FAST_FREQ_8M as the
fast clock, the bootloader modified fast_freq field to the currently
selected RTC_FAST_CLK (so that the clock choice is not affected by the
bootloader). The application startup code never switched to 8M clock,
which caused the default (XTAL/4) to be used as RTC_FAST_CLK. This had
caused a number of issues, such as touch pads not working in deep sleep.

Fixes https://github.com/espressif/esp-idf/issues/542.
Ref TW12053.

components/esp32/clk.c

index 449ea39321ccc3c11044c76f75da8a8d24cc37af..ce7b580eb76cc9cabda507474fede712c2967278 100644 (file)
@@ -43,6 +43,7 @@ void esp_clk_init(void)
 {
     rtc_config_t cfg = RTC_CONFIG_DEFAULT();
     rtc_init(cfg);
+    rtc_clk_fast_freq_set(RTC_FAST_FREQ_8M);
 
 #ifdef CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
     select_rtc_slow_clk(RTC_SLOW_FREQ_32K_XTAL);