]> granicus.if.org Git - esp-idf/commitdiff
Add XTAL frequency selection to Kconfig
authorIvan Grokhotkov <ivan@espressif.com>
Mon, 24 Apr 2017 07:30:27 +0000 (15:30 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Mon, 24 Apr 2017 07:55:02 +0000 (15:55 +0800)
This change allows XTAL frequency to be selected using menuconfig

components/bootloader/src/main/bootloader_start.c
components/esp32/Kconfig

index b708f894edd3f83b4fc77656060b96cc4368a394..aa30ad4c74dad2ecf1d758ebc757ec28e5d1fba3 100644 (file)
@@ -240,6 +240,7 @@ void bootloader_main()
     /* Set CPU to 80MHz. Keep other clocks unmodified. */
     uart_tx_wait_idle(0);
     rtc_clk_config_t clk_cfg = RTC_CLK_CONFIG_DEFAULT();
+    clk_cfg.xtal_freq = CONFIG_ESP32_XTAL_FREQ;
     clk_cfg.cpu_freq = RTC_CPU_FREQ_80M;
     clk_cfg.slow_freq = rtc_clk_slow_freq_get();
     clk_cfg.fast_freq = rtc_clk_fast_freq_get();
index 9b3342720c7f7acbe97a0f37d5e0902c0b37ff30..4f5712f732b55e0d144e04479a5bbd8f85476689 100644 (file)
@@ -561,6 +561,34 @@ config ESP32_DEEP_SLEEP_WAKEUP_DELAY
         If you are seeing "flash read err, 1000" message printed to the
         console after deep sleep reset, try increasing this value.
 
+choice ESP32_XTAL_FREQ_SEL
+    prompt "Main XTAL frequency"
+    default ESP32_XTAL_FREQ_AUTO
+    help
+        ESP32 currently supports the following XTAL frequencies:
+            - 26 MHz
+            - 40 MHz
+        Startup code can automatically estimate XTAL frequency. This feature
+        uses the internal 8MHz oscillator as a reference. Because the internal
+        oscillator frequency is temperature dependent, it is not recommended
+        to use automatic XTAL frequency detection in applications which need
+        to work at high ambient temperatures and use high-temperature
+        qualified chips and modules.
+config ESP32_XTAL_FREQ_40
+    bool "40 MHz"
+config ESP32_XTAL_FREQ_26
+    bool "26 MHz"
+config ESP32_XTAL_FREQ_AUTO
+    bool "Autodetect"
+endchoice
+
+# Keep these values in sync with rtc_xtal_freq_t enum in soc/rtc.h
+config ESP32_XTAL_FREQ
+    int
+    default 0 if ESP32_XTAL_FREQ_AUTO
+    default 40 if ESP32_XTAL_FREQ_40
+    default 26 if ESP32_XTAL_FREQ_26
+
 endmenu
 
 menuconfig WIFI_ENABLED