Kconfig 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. menu "Power Management"
  2. config PM_ENABLE
  3. bool "Support for power management"
  4. # SMP FreeRTOS currently does not support power management IDF-4997
  5. depends on (!FREERTOS_SMP && !IDF_TARGET_ESP32P4) || __DOXYGEN__ # TODO: IDF-7527
  6. default n
  7. help
  8. If enabled, application is compiled with support for power management.
  9. This option has run-time overhead (increased interrupt latency,
  10. longer time to enter idle state), and it also reduces accuracy of
  11. RTOS ticks and timers used for timekeeping.
  12. Enable this option if application uses power management APIs.
  13. config PM_DFS_INIT_AUTO
  14. bool "Enable dynamic frequency scaling (DFS) at startup"
  15. depends on PM_ENABLE
  16. default n
  17. help
  18. If enabled, startup code configures dynamic frequency scaling.
  19. Max CPU frequency is set to DEFAULT_CPU_FREQ_MHZ setting,
  20. min frequency is set to XTAL frequency.
  21. If disabled, DFS will not be active until the application
  22. configures it using esp_pm_configure function.
  23. config PM_PROFILING
  24. bool "Enable profiling counters for PM locks"
  25. depends on PM_ENABLE
  26. default n
  27. help
  28. If enabled, esp_pm_* functions will keep track of the amount of time
  29. each of the power management locks has been held, and esp_pm_dump_locks
  30. function will print this information.
  31. This feature can be used to analyze which locks are preventing the chip
  32. from going into a lower power state, and see what time the chip spends
  33. in each power saving mode. This feature does incur some run-time
  34. overhead, so should typically be disabled in production builds.
  35. config PM_TRACE
  36. bool "Enable debug tracing of PM using GPIOs"
  37. depends on PM_ENABLE
  38. default n
  39. help
  40. If enabled, some GPIOs will be used to signal events such as RTOS ticks,
  41. frequency switching, entry/exit from idle state. Refer to pm_trace.c
  42. file for the list of GPIOs.
  43. This feature is intended to be used when analyzing/debugging behavior
  44. of power management implementation, and should be kept disabled in
  45. applications.
  46. config PM_SLP_IRAM_OPT
  47. bool "Put lightsleep related codes in internal RAM"
  48. depends on FREERTOS_USE_TICKLESS_IDLE
  49. help
  50. If enabled, about 2.1KB of lightsleep related source code would be in IRAM and chip would sleep
  51. longer for 310us at 160MHz CPU frequency most each time.
  52. This feature is intended to be used when lower power consumption is needed
  53. while there is enough place in IRAM to place source code.
  54. config PM_RTOS_IDLE_OPT
  55. bool "Put RTOS IDLE related codes in internal RAM"
  56. depends on FREERTOS_USE_TICKLESS_IDLE
  57. help
  58. If enabled, about 180Bytes of RTOS_IDLE related source code would be in IRAM and chip would sleep
  59. longer for 20us at 160MHz CPU frequency most each time.
  60. This feature is intended to be used when lower power consumption is needed
  61. while there is enough place in IRAM to place source code.
  62. config PM_SLP_DISABLE_GPIO
  63. bool "Disable all GPIO when chip at sleep"
  64. depends on FREERTOS_USE_TICKLESS_IDLE
  65. help
  66. This feature is intended to disable all GPIO pins at automantic sleep to get a lower power mode.
  67. If enabled, chips will disable all GPIO pins at automantic sleep to reduce about 200~300 uA current.
  68. If you want to specifically use some pins normally as chip wakes when chip sleeps,
  69. you can call 'gpio_sleep_sel_dis' to disable this feature on those pins.
  70. You can also keep this feature on and call 'gpio_sleep_set_direction' and 'gpio_sleep_set_pull_mode'
  71. to have a different GPIO configuration at sleep.
  72. Waring: If you want to enable this option on ESP32, you should enable `GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL`
  73. at first, otherwise you will not be able to switch pullup/pulldown mode.
  74. config PM_SLP_DEFAULT_PARAMS_OPT
  75. bool
  76. default n
  77. config PM_CHECK_SLEEP_RETENTION_FRAME
  78. bool
  79. depends on PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP
  80. default y if IDF_CI_BUILD
  81. default n
  82. help
  83. This option is invisible to users, and it is only used for ci testing,
  84. enabling it in the application will increase the sleep and wake-up time overhead
  85. config PM_LIGHTSLEEP_RTC_OSC_CAL_INTERVAL
  86. int "Calibrate the RTC_FAST/SLOW clock every N times of light sleep"
  87. default 1
  88. depends on PM_ENABLE
  89. range 1 128
  90. help
  91. The value of this option determines the calibration interval of the RTC_FAST/SLOW clock during sleep when
  92. power management is enabled. When it is configured as N, the RTC_FAST/SLOW clock will be calibrated
  93. every N times of lightsleep.
  94. Decreasing this value will increase the time the chip is in the active state, thereby increasing the
  95. average power consumption of the chip.
  96. Increasing this value can reduce the average power consumption, but when the external environment changes
  97. drastically and the chip RTC_FAST/SLOW oscillator frequency drifts, it may cause system instability.
  98. config PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP
  99. bool "Power down CPU in light sleep"
  100. depends on SOC_PM_SUPPORT_CPU_PD
  101. select PM_RESTORE_CACHE_TAGMEM_AFTER_LIGHT_SLEEP if ESP32S3_DATA_CACHE_16KB
  102. default y
  103. help
  104. If enabled, the CPU will be powered down in light sleep, ESP chips supports saving and restoring CPU's running
  105. context before and after light sleep, the feature provides applications with seamless CPU powerdowned lightsleep
  106. without user awareness.
  107. But this will takes up some internal memory. On esp32c3 soc, enabling this option will consume 1.68 KB of internal
  108. RAM and will reduce sleep current consumption by about 100 uA. On esp32s3 soc, enabling this option will consume
  109. 8.58 KB of internal RAM and will reduce sleep current consumption by about 650 uA.
  110. config PM_RESTORE_CACHE_TAGMEM_AFTER_LIGHT_SLEEP
  111. bool "Restore I/D-cache tag memory after power down CPU light sleep"
  112. depends on IDF_TARGET_ESP32S3 && PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP
  113. default y
  114. help
  115. Cache tag memory and CPU both belong to the CPU power domain. ESP chips supports saving and restoring Cache tag memory
  116. before and after sleep, this feature supports accesses to the external memory that was cached before sleep still
  117. be cached when the CPU wakes up from a powerdowned CPU lightsleep. This option controls the restore method for Cache
  118. tag memory in lightsleep.
  119. If this option is enabled, the I/D-cache tag memory will be backuped to the internal RAM before sleep and restored
  120. upon wakeup. Depending on the the cache configuration, if this option is enabled, it will consume up to 9 KB
  121. of internal RAM.
  122. If this option is disabled, all cached data won't be kept after sleep, the DCache will be writeback before
  123. sleep and invalid all cached data after sleep, all accesses to external memory(Flash/PSRAM) will be cache
  124. missed after waking up, resulting in performance degradation due to increased memory accesses latency.
  125. config PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
  126. bool "Power down Digital Peripheral in light sleep (EXPERIMENTAL)"
  127. depends on SOC_PAU_SUPPORTED
  128. default n #TODO: enable by default if periph init/deinit management supported (WIFI-5252)
  129. help
  130. If enabled, digital peripherals will be powered down in light sleep, it will reduce sleep
  131. current consumption by about 100 uA. Chip will save/restore register context at sleep/wake
  132. time to keep the system running. Enabling this option will increase static RAM and heap usage,
  133. the actual cost depends on the peripherals you have initialized. In order to save/restore the
  134. context of the necessary hardware for FreeRTOS to run, it will need at least 4.55 KB free heap
  135. at sleep time. Otherwise sleep will not power down the peripherals.
  136. Note1: Please use this option with caution, the current IDF does not support the retention of
  137. all peripherals. When the digital peripherals are powered off and a sleep and wake-up is completed,
  138. the peripherals that have not saved the running context are equivalent to performing a reset.
  139. !!! Please confirm the peripherals used in your application and their sleep retention support status
  140. before enabling this option, peripherals sleep retention driver support status is tracked in
  141. power_management.rst
  142. Note2: When this option is enabled simultaneously with FREERTOS_USE_TICKLESS_IDLE, since the UART will
  143. be powered down, the uart FIFO will be flushed before sleep to avoid data loss, however, this has the
  144. potential to block the sleep process and cause the wakeup time to be skipped, which will cause the tick
  145. of freertos to not be compensated correctly when returning from sleep and cause the system to crash.
  146. To avoid this, you can increase FREERTOS_IDLE_TIME_BEFORE_SLEEP threshold in menuconfig.
  147. config PM_UPDATE_CCOMPARE_HLI_WORKAROUND
  148. bool
  149. default y if PM_ENABLE && BTDM_CTRL_HLI
  150. config PM_LIGHT_SLEEP_CALLBACKS
  151. bool "Enable registration of pm light sleep callbacks"
  152. depends on FREERTOS_USE_TICKLESS_IDLE
  153. default n
  154. help
  155. If enabled, it allows user to register entry and exit callbacks which are called before and after
  156. entering auto light sleep.
  157. NOTE: These callbacks are executed from the IDLE task context hence you cannot have any blocking calls
  158. in your callbacks.
  159. NOTE: Enabling these callbacks may change sleep duration calculations based on time spent in callback and
  160. hence it is highly recommended to keep them as short as possible
  161. endmenu # "Power Management"