1menu "ESP32H2-Specific"
2    visible if IDF_TARGET_ESP32H2
3
4    choice ESP32H2_DEFAULT_CPU_FREQ_MHZ
5        prompt "CPU frequency"
6        default ESP32H2_DEFAULT_CPU_FREQ_64 if IDF_ENV_FPGA
7        default ESP32H2_DEFAULT_CPU_FREQ_96 if !IDF_ENV_FPGA
8        help
9            CPU frequency to be set on application startup.
10
11        config ESP32H2_DEFAULT_CPU_FREQ_16
12            bool "16 MHz"
13            depends on IDF_ENV_FPGA     #ESP32H2-TODO: IDF-3786
14        config ESP32H2_DEFAULT_CPU_FREQ_32
15            bool "32 MHz"
16            depends on IDF_ENV_FPGA     #ESP32H2-TODO: IDF-3786
17        config ESP32H2_DEFAULT_CPU_FREQ_64
18            bool "64 MHz"
19            depends on IDF_ENV_FPGA     #ESP32H2-TODO: IDF-3786
20        config ESP32H2_DEFAULT_CPU_FREQ_96
21            bool "96 MHz"
22            depends on !IDF_ENV_FPGA
23    endchoice
24
25    config ESP32H2_DEFAULT_CPU_FREQ_MHZ
26        int
27        default 16 if ESP32H2_DEFAULT_CPU_FREQ_16
28        default 32 if ESP32H2_DEFAULT_CPU_FREQ_32
29        default 64 if ESP32H2_DEFAULT_CPU_FREQ_64
30        default 96 if ESP32H2_DEFAULT_CPU_FREQ_96
31
32    choice ESP32H2_REV_MIN
33        prompt "Minimum Supported ESP32-H2 Revision"
34        default ESP32H2_REV_MIN_0
35        help
36            Minimum revision that ESP-IDF would support.
37
38            Only supporting higher chip revisions can reduce binary size.
39
40        config ESP32H2_REV_MIN_0
41            bool "Rev 0"
42    endchoice
43
44    config ESP32H2_REV_MIN
45        int
46        default 0 if ESP32H2_REV_MIN_0
47
48    config ESP32H2_DEBUG_OCDAWARE
49        bool "Make exception and panic handlers JTAG/OCD aware"
50        default y
51        select FREERTOS_DEBUG_OCDAWARE
52        help
53            The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and
54            instead of panicking, have the debugger stop on the offending instruction.
55
56    config ESP32H2_BROWNOUT_DET
57        bool "Hardware brownout detect & reset"
58        default y
59        help
60            The ESP32-C3 has a built-in brownout detector which can detect if the voltage is lower than
61            a specific value. If this happens, it will reset the chip in order to prevent unintended
62            behaviour.
63
64    choice ESP32H2_BROWNOUT_DET_LVL_SEL
65        prompt "Brownout voltage level"
66        depends on ESP32H2_BROWNOUT_DET
67        default ESP32H2_BROWNOUT_DET_LVL_SEL_7
68        help
69            The brownout detector will reset the chip when the supply voltage is approximately
70            below this level. Note that there may be some variation of brownout voltage level
71            between each chip.
72
73            #The voltage levels here are estimates, more work needs to be done to figure out the exact voltages
74            #of the brownout threshold levels.
75        config ESP32H2_BROWNOUT_DET_LVL_SEL_7
76            bool "2.51V"
77        config ESP32H2_BROWNOUT_DET_LVL_SEL_6
78            bool "2.64V"
79        config ESP32H2_BROWNOUT_DET_LVL_SEL_5
80            bool "2.76V"
81        config ESP32H2_BROWNOUT_DET_LVL_SEL_4
82            bool "2.92V"
83        config ESP32H2_BROWNOUT_DET_LVL_SEL_3
84            bool "3.10V"
85        config ESP32H2_BROWNOUT_DET_LVL_SEL_2
86            bool "3.27V"
87    endchoice
88
89    config ESP32H2_BROWNOUT_DET_LVL
90        int
91        default 2 if ESP32H2_BROWNOUT_DET_LVL_SEL_2
92        default 3 if ESP32H2_BROWNOUT_DET_LVL_SEL_3
93        default 4 if ESP32H2_BROWNOUT_DET_LVL_SEL_4
94        default 5 if ESP32H2_BROWNOUT_DET_LVL_SEL_5
95        default 6 if ESP32H2_BROWNOUT_DET_LVL_SEL_6
96        default 7 if ESP32H2_BROWNOUT_DET_LVL_SEL_7
97
98    choice ESP32H2_TIME_SYSCALL
99        prompt "Timers used for gettimeofday function"
100        default ESP32H2_TIME_SYSCALL_USE_RTC_SYSTIMER
101        help
102            This setting defines which hardware timers are used to
103            implement 'gettimeofday' and 'time' functions in C library.
104
105            - If both high-resolution (systimer) and RTC timers are used, timekeeping will
106              continue in deep sleep. Time will be reported at 1 microsecond
107              resolution. This is the default, and the recommended option.
108            - If only high-resolution timer (systimer) is used, gettimeofday will
109              provide time at microsecond resolution.
110              Time will not be preserved when going into deep sleep mode.
111            - If only RTC timer is used, timekeeping will continue in
112              deep sleep, but time will be measured at 6.(6) microsecond
113              resolution. Also the gettimeofday function itself may take
114              longer to run.
115            - If no timers are used, gettimeofday and time functions
116              return -1 and set errno to ENOSYS.
117            - When RTC is used for timekeeping, two RTC_STORE registers are
118              used to keep time in deep sleep mode.
119
120        config ESP32H2_TIME_SYSCALL_USE_RTC_SYSTIMER
121            bool "RTC and high-resolution timer"
122            select ESP_TIME_FUNCS_USE_RTC_TIMER
123            select ESP_TIME_FUNCS_USE_ESP_TIMER
124        config ESP32H2_TIME_SYSCALL_USE_RTC
125            bool "RTC"
126            select ESP_TIME_FUNCS_USE_RTC_TIMER
127        config ESP32H2_TIME_SYSCALL_USE_SYSTIMER
128            bool "High-resolution timer"
129            select ESP_TIME_FUNCS_USE_ESP_TIMER
130        config ESP32H2_TIME_SYSCALL_USE_NONE
131            bool "None"
132            select ESP_TIME_FUNCS_USE_NONE
133    endchoice
134
135    choice ESP32H2_RTC_CLK_SRC
136        prompt "RTC clock source"
137        default ESP32H2_RTC_CLK_SRC_INT_RC
138        help
139            Choose which clock is used as RTC clock source.
140
141        config ESP32H2_RTC_CLK_SRC_INT_RC
142            bool "Internal 150kHz RC oscillator"
143        config ESP32H2_RTC_CLK_SRC_EXT_CRYS
144            bool "External 32kHz crystal"
145            select ESP_SYSTEM_RTC_EXT_XTAL
146        config ESP32H2_RTC_CLK_SRC_EXT_OSC
147            bool "External 32kHz oscillator at 32K_XP pin"
148            select ESP_SYSTEM_RTC_EXT_OSC
149        config ESP32H2_RTC_CLK_SRC_INT_8MD256
150            bool "Internal 8MHz oscillator, divided by 256 (~32kHz)"
151    endchoice
152
153    config ESP32H2_RTC_CLK_CAL_CYCLES
154        int "Number of cycles for RTC_SLOW_CLK calibration"
155        default 3000 if ESP32H2_RTC_CLK_SRC_EXT_CRYS || ESP32H2_RTC_CLK_SRC_EXT_OSC || ESP32H2_RTC_CLK_SRC_INT_8MD256
156        default 576 if ESP32H2_RTC_CLK_SRC_INT_RC
157        range 0 125000
158        help
159            When the startup code initializes RTC_SLOW_CLK, it can perform
160            calibration by comparing the RTC_SLOW_CLK frequency with main XTAL
161            frequency. This option sets the number of RTC_SLOW_CLK cycles measured
162            by the calibration routine. Higher numbers increase calibration
163            precision, which may be important for applications which spend a lot of
164            time in deep sleep. Lower numbers reduce startup time.
165
166            When this option is set to 0, clock calibration will not be performed at
167            startup, and approximate clock frequencies will be assumed:
168
169            - 150000 Hz if internal RC oscillator is used as clock source. For this use value 1024.
170            - 32768 Hz if the 32k crystal oscillator is used. For this use value 3000 or more.
171              In case more value will help improve the definition of the launch of the crystal.
172              If the crystal could not start, it will be switched to internal RC.
173
174    config ESP32H2_NO_BLOBS
175        bool "No Binary Blobs"
176        depends on !BT_ENABLED
177        default n
178        help
179            If enabled, this disables the linking of binary libraries in the application build. Note
180            that after enabling this Wi-Fi/Bluetooth will not work.
181
182    config ESP32H2_LIGHTSLEEP_GPIO_RESET_WORKAROUND
183        bool "light sleep GPIO reset workaround"
184        default y
185        select PM_SLP_DISABLE_GPIO if FREERTOS_USE_TICKLESS_IDLE
186        help
187            ESP32H2 will reset at wake-up if GPIO is received a small electrostatic pulse during
188            light sleep, with specific condition
189
190            - GPIO needs to be configured as input-mode only
191            - The pin receives a small electrostatic pulse, and reset occurs when the pulse
192              voltage is higher than 6 V
193
194            For GPIO set to input mode only, it is not a good practice to leave it open/floating,
195            The hardware design needs to controlled it with determined supply or ground voltage
196            is necessary.
197
198            This option provides a software workaround for this issue. Configure to isolate all
199            GPIO pins in sleep state.
200
201endmenu  # ESP32H2-Specific
202