1choice RTC_CLK_SRC
2    prompt "RTC clock source"
3    default RTC_CLK_SRC_INT_RC
4    help
5        Choose which clock is used as RTC clock source.
6
7    config RTC_CLK_SRC_INT_RC
8        bool "Internal 136kHz RC oscillator"
9    config RTC_CLK_SRC_EXT_CRYS
10        bool "External 32kHz crystal"
11        select ESP_SYSTEM_RTC_EXT_XTAL
12    config RTC_CLK_SRC_EXT_OSC
13        bool "External 32kHz oscillator at 32K_XP pin"
14        select ESP_SYSTEM_RTC_EXT_OSC
15    config RTC_CLK_SRC_INT_RC32K
16        bool "Internal 32kHz RC oscillator (NOT RECOMMENDED TO USE, READ DOCS FIRST)"
17        depends on RTC_CLK_SRC_USE_DANGEROUS_RC32K_ALLOWED
18        help
19            To be able to select this option, please select `RTC_CLK_SRC_USE_DANGEROUS_RC32K_ALLOWED` first.
20            This option will be removed in IDF v6.0.
21endchoice
22
23config RTC_CLK_SRC_USE_DANGEROUS_RC32K_ALLOWED
24    bool "Confirm to use the unrecommended 32 kHz RC oscillator (READ DOCS FIRST)"
25    help
26        Internal RC32K clock is unstable at extreme temperatures and is not recommended for use.
27
28config RTC_CLK_CAL_CYCLES
29    int "Number of cycles for RTC_SLOW_CLK calibration"
30    default 3000 if RTC_CLK_SRC_EXT_CRYS || RTC_CLK_SRC_EXT_OSC || RTC_CLK_SRC_INT_RC32K
31    default 1024 if RTC_CLK_SRC_INT_RC
32    range 0 8190 if RTC_CLK_SRC_EXT_CRYS || RTC_CLK_SRC_EXT_OSC || RTC_CLK_SRC_INT_RC32K
33    range 0 32766 if RTC_CLK_SRC_INT_RC
34    help
35        When the startup code initializes RTC_SLOW_CLK, it can perform
36        calibration by comparing the RTC_SLOW_CLK frequency with main XTAL
37        frequency. This option sets the number of RTC_SLOW_CLK cycles measured
38        by the calibration routine. Higher numbers increase calibration
39        precision, which may be important for applications which spend a lot of
40        time in deep sleep. Lower numbers reduce startup time.
41
42        When this option is set to 0, clock calibration will not be performed at
43        startup, and approximate clock frequencies will be assumed:
44
45        - 136000 Hz if internal RC oscillator is used as clock source. For this use value 1024.
46        - 32768 Hz if the 32k crystal oscillator is used. For this use value 3000 or more.
47            In case more value will help improve the definition of the launch of the crystal.
48            If the crystal could not start, it will be switched to internal RC.
49