forked from espressif/esp-idf
ble:support esp32h2 power save example
This commit is contained in:
@@ -270,6 +270,6 @@ examples/bluetooth/nimble/hci:
|
|||||||
|
|
||||||
examples/bluetooth/nimble/power_save:
|
examples/bluetooth/nimble/power_save:
|
||||||
enable:
|
enable:
|
||||||
- if: IDF_TARGET in ["esp32", "esp32c3", "esp32s3", "esp32c6"]
|
- if: IDF_TARGET in ["esp32", "esp32c3", "esp32s3", "esp32c6", "esp32h2"]
|
||||||
temporary: true
|
temporary: true
|
||||||
reason: the other targets are not tested yet
|
reason: the other targets are not tested yet
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-S3 |
|
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S3 |
|
||||||
| ----------------- | ----- | -------- | -------- | -------- |
|
| ----------------- | ----- | -------- | -------- | -------- | -------- |
|
||||||
|
|
||||||
Bluetooth Power Save Example
|
Bluetooth Power Save Example
|
||||||
=================================
|
=================================
|
||||||
@@ -10,7 +10,6 @@ If the modem sleep mode is enabled, bluetooth will switch periodically between a
|
|||||||
In sleep state, RF, PHY and BB are turned off in order to reduce power consumption.
|
In sleep state, RF, PHY and BB are turned off in order to reduce power consumption.
|
||||||
|
|
||||||
This example contains five build configurations. For each configuration, a few configuration options are set:
|
This example contains five build configurations. For each configuration, a few configuration options are set:
|
||||||
|
|
||||||
- `sdkconfig.defaults.esp32`: ESP32 uses 32kHz XTAL as low power clock in light sleep enabled.
|
- `sdkconfig.defaults.esp32`: ESP32 uses 32kHz XTAL as low power clock in light sleep enabled.
|
||||||
- `sdkconfig.defaults.esp32c3`: ESP32C3 uses 32kHz XTAL as low power clock in light sleep enabled.
|
- `sdkconfig.defaults.esp32c3`: ESP32C3 uses 32kHz XTAL as low power clock in light sleep enabled.
|
||||||
- `sdkconfig.40m.esp32c3`: ESP32C3 uses main XTAL as low power clock in light sleep enabled.
|
- `sdkconfig.40m.esp32c3`: ESP32C3 uses main XTAL as low power clock in light sleep enabled.
|
||||||
@@ -18,12 +17,13 @@ This example contains five build configurations. For each configuration, a few c
|
|||||||
- `sdkconfig.40m.esp32c6`: ESP32C6 uses main XTAL as low power clock in light sleep enabled.
|
- `sdkconfig.40m.esp32c6`: ESP32C6 uses main XTAL as low power clock in light sleep enabled.
|
||||||
- `sdkconfig.defaults.esp32s3`: ESP32S3 uses 32kHz XTAL as low power clock in light sleep enabled.
|
- `sdkconfig.defaults.esp32s3`: ESP32S3 uses 32kHz XTAL as low power clock in light sleep enabled.
|
||||||
- `sdkconfig.40m.esp32s3`: ESP32S3 uses main XTAL as low power clock in light sleep enabled.
|
- `sdkconfig.40m.esp32s3`: ESP32S3 uses main XTAL as low power clock in light sleep enabled.
|
||||||
|
- `sdkconfig.defaults.esp32h2`: ESP32H2 uses 32kHz XTAL as low power clock in light sleep enabled.
|
||||||
|
- `sdkconfig.40m.esp32h2`: ESP32H2 uses main XTAL as low power clock in light sleep enabled.
|
||||||
## How to use example
|
## How to use example
|
||||||
|
|
||||||
### Hardware Required
|
### Hardware Required
|
||||||
|
|
||||||
This example should be able to run on any commonly available ESP32/ESP32-C3/ESP32-S3/ESP32-C6 development board.
|
This example should be able to run on any commonly available ESP32/ESP32-C3/ESP32-S3/ESP32-H2/ESP32-C6 development board.
|
||||||
|
|
||||||
### Configure the project
|
### Configure the project
|
||||||
|
|
||||||
@@ -40,8 +40,7 @@ idf.py menuconfig
|
|||||||
- `(1000) configTICK_RATE_HZ`
|
- `(1000) configTICK_RATE_HZ`
|
||||||
- `[*] configUSE_TICKLESS_IDLE`
|
- `[*] configUSE_TICKLESS_IDLE`
|
||||||
- `(3) configEXPECTED_IDLE_TIME_BEFORE_SLEEP`
|
- `(3) configEXPECTED_IDLE_TIME_BEFORE_SLEEP`
|
||||||
|
#### For Chip ESP32/ESP32-C3/ESP32-S3:
|
||||||
#### For ESP32/ESP32-C3/ESP32-S3 Chip:
|
|
||||||
|
|
||||||
4. Enable power down MAC and baseband:
|
4. Enable power down MAC and baseband:
|
||||||
- `Component config > PHY > [*] Power down MAC and baseband of Wi-Fi and Bluetooth when PHY is disabled`
|
- `Component config > PHY > [*] Power down MAC and baseband of Wi-Fi and Bluetooth when PHY is disabled`
|
||||||
@@ -54,7 +53,7 @@ idf.py menuconfig
|
|||||||
7. Enable power up main XTAL during light sleep:
|
7. Enable power up main XTAL during light sleep:
|
||||||
- `Component config > Bluetooth > Controller Options > MODEM SLEEP Options > [*] power up main XTAL during light sleep`
|
- `Component config > Bluetooth > Controller Options > MODEM SLEEP Options > [*] power up main XTAL during light sleep`
|
||||||
|
|
||||||
#### For ESP32-C6 Chip:
|
#### For Chip ESP32-C6/ESP32-H2
|
||||||
|
|
||||||
4. Enable bluetooth modem sleep:
|
4. Enable bluetooth modem sleep:
|
||||||
- `Component config > Bluetooth > Controller Options`
|
- `Component config > Bluetooth > Controller Options`
|
||||||
@@ -129,6 +128,7 @@ I (463) NimBLE:
|
|||||||
| ESP32C3 | 262 mA | 12 mA | 2.3 mA | 140 uA |
|
| ESP32C3 | 262 mA | 12 mA | 2.3 mA | 140 uA |
|
||||||
| ESP32S3 | 240 mA | 17.9 mA | 3.3 mA | 230 uA |
|
| ESP32S3 | 240 mA | 17.9 mA | 3.3 mA | 230 uA |
|
||||||
| ESP32C6 | 240 mA | 22 mA | 3.3 mA | 34 uA |
|
| ESP32C6 | 240 mA | 22 mA | 3.3 mA | 34 uA |
|
||||||
|
| ESP32H2 | 82 mA | 16.0 mA | 4.0 mA | 24 uA |
|
||||||
X: This feature is currently not supported.
|
X: This feature is currently not supported.
|
||||||
|
|
||||||
## Example Breakdown
|
## Example Breakdown
|
||||||
|
@@ -2,13 +2,17 @@ menu "Example Configuration"
|
|||||||
|
|
||||||
choice EXAMPLE_MAX_CPU_FREQ
|
choice EXAMPLE_MAX_CPU_FREQ
|
||||||
prompt "Maximum CPU frequency"
|
prompt "Maximum CPU frequency"
|
||||||
default EXAMPLE_MAX_CPU_FREQ_160
|
default EXAMPLE_MAX_CPU_FREQ_160 if !IDF_TARGET_ESP32H2
|
||||||
|
default EXAMPLE_MAX_CPU_FREQ_96 if IDF_TARGET_ESP32H2
|
||||||
depends on PM_ENABLE
|
depends on PM_ENABLE
|
||||||
help
|
help
|
||||||
Maximum CPU frequency to use for dynamic frequency scaling.
|
Maximum CPU frequency to use for dynamic frequency scaling.
|
||||||
|
|
||||||
config EXAMPLE_MAX_CPU_FREQ_80
|
config EXAMPLE_MAX_CPU_FREQ_80
|
||||||
bool "80 MHz"
|
bool "80 MHz"
|
||||||
|
config EXAMPLE_MAX_CPU_FREQ_96
|
||||||
|
bool "96 MHz"
|
||||||
|
depends on IDF_TARGET_ESP32H2
|
||||||
config EXAMPLE_MAX_CPU_FREQ_160
|
config EXAMPLE_MAX_CPU_FREQ_160
|
||||||
bool "160 MHz"
|
bool "160 MHz"
|
||||||
config EXAMPLE_MAX_CPU_FREQ_240
|
config EXAMPLE_MAX_CPU_FREQ_240
|
||||||
@@ -19,12 +23,14 @@ menu "Example Configuration"
|
|||||||
config EXAMPLE_MAX_CPU_FREQ_MHZ
|
config EXAMPLE_MAX_CPU_FREQ_MHZ
|
||||||
int
|
int
|
||||||
default 80 if EXAMPLE_MAX_CPU_FREQ_80
|
default 80 if EXAMPLE_MAX_CPU_FREQ_80
|
||||||
|
default 96 if EXAMPLE_MAX_CPU_FREQ_96
|
||||||
default 160 if EXAMPLE_MAX_CPU_FREQ_160
|
default 160 if EXAMPLE_MAX_CPU_FREQ_160
|
||||||
default 240 if EXAMPLE_MAX_CPU_FREQ_240
|
default 240 if EXAMPLE_MAX_CPU_FREQ_240
|
||||||
|
|
||||||
choice EXAMPLE_MIN_CPU_FREQ
|
choice EXAMPLE_MIN_CPU_FREQ
|
||||||
prompt "Minimum CPU frequency"
|
prompt "Minimum CPU frequency"
|
||||||
default EXAMPLE_MIN_CPU_FREQ_40M
|
default EXAMPLE_MIN_CPU_FREQ_40M if !IDF_TARGET_ESP32H2
|
||||||
|
default EXAMPLE_MIN_CPU_FREQ_32M if IDF_TARGET_ESP32H2
|
||||||
depends on PM_ENABLE
|
depends on PM_ENABLE
|
||||||
help
|
help
|
||||||
Minimum CPU frequency to use for dynamic frequency scaling.
|
Minimum CPU frequency to use for dynamic frequency scaling.
|
||||||
@@ -42,6 +48,10 @@ menu "Example Configuration"
|
|||||||
config EXAMPLE_MIN_CPU_FREQ_40M
|
config EXAMPLE_MIN_CPU_FREQ_40M
|
||||||
bool "40 MHz (use with 40MHz XTAL)"
|
bool "40 MHz (use with 40MHz XTAL)"
|
||||||
depends on XTAL_FREQ_40 || XTAL_FREQ_AUTO
|
depends on XTAL_FREQ_40 || XTAL_FREQ_AUTO
|
||||||
|
config EXAMPLE_MIN_CPU_FREQ_32M
|
||||||
|
bool "32 MHz (use with 32MHz XTAL)"
|
||||||
|
depends on IDF_TARGET_ESP32H2
|
||||||
|
depends on XTAL_FREQ_32 || XTAL_FREQ_AUTO
|
||||||
config EXAMPLE_MIN_CPU_FREQ_20M
|
config EXAMPLE_MIN_CPU_FREQ_20M
|
||||||
bool "20 MHz (use with 40MHz XTAL)"
|
bool "20 MHz (use with 40MHz XTAL)"
|
||||||
depends on XTAL_FREQ_40 || XTAL_FREQ_AUTO
|
depends on XTAL_FREQ_40 || XTAL_FREQ_AUTO
|
||||||
@@ -54,6 +64,7 @@ menu "Example Configuration"
|
|||||||
int
|
int
|
||||||
default 80 if EXAMPLE_MIN_CPU_FREQ_80M
|
default 80 if EXAMPLE_MIN_CPU_FREQ_80M
|
||||||
default 40 if EXAMPLE_MIN_CPU_FREQ_40M
|
default 40 if EXAMPLE_MIN_CPU_FREQ_40M
|
||||||
|
default 32 if EXAMPLE_MIN_CPU_FREQ_32M
|
||||||
default 20 if EXAMPLE_MIN_CPU_FREQ_20M
|
default 20 if EXAMPLE_MIN_CPU_FREQ_20M
|
||||||
default 10 if EXAMPLE_MIN_CPU_FREQ_10M
|
default 10 if EXAMPLE_MIN_CPU_FREQ_10M
|
||||||
|
|
||||||
|
23
examples/bluetooth/nimble/power_save/sdkconfig.32m.esp32h2
Normal file
23
examples/bluetooth/nimble/power_save/sdkconfig.32m.esp32h2
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
CONFIG_IDF_TARGET="esp32h2"
|
||||||
|
|
||||||
|
# Bluetooth Low Power Config
|
||||||
|
CONFIG_BT_LE_SLEEP_ENABLE=y
|
||||||
|
# CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER is not set
|
||||||
|
CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER=y
|
||||||
|
CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL=y
|
||||||
|
# CONFIG_BT_LE_LP_CLK_SRC_DEFAULT is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# Power Management
|
||||||
|
#
|
||||||
|
CONFIG_PM_ENABLE=y
|
||||||
|
CONFIG_PM_DFS_INIT_AUTO=y
|
||||||
|
CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y
|
||||||
|
# CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP is not set
|
||||||
|
# end of Power Management
|
||||||
|
|
||||||
|
#
|
||||||
|
# Sleep Config
|
||||||
|
#
|
||||||
|
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
|
||||||
|
# end of Sleep Config
|
@@ -0,0 +1,32 @@
|
|||||||
|
CONFIG_IDF_TARGET="esp32h2"
|
||||||
|
|
||||||
|
# Bluetooth Low Power Config
|
||||||
|
CONFIG_BT_LE_SLEEP_ENABLE=y
|
||||||
|
# CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER is not set
|
||||||
|
CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER=y
|
||||||
|
# CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL is not set
|
||||||
|
CONFIG_BT_LE_LP_CLK_SRC_DEFAULT=y
|
||||||
|
|
||||||
|
#
|
||||||
|
# Power Management
|
||||||
|
#
|
||||||
|
CONFIG_PM_ENABLE=y
|
||||||
|
CONFIG_PM_DFS_INIT_AUTO=y
|
||||||
|
CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y
|
||||||
|
CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP=y
|
||||||
|
# end of Power Management
|
||||||
|
|
||||||
|
#
|
||||||
|
# Sleep Config
|
||||||
|
#
|
||||||
|
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
|
||||||
|
# end of Sleep Config
|
||||||
|
|
||||||
|
#
|
||||||
|
# RTC Clock Config
|
||||||
|
#
|
||||||
|
# CONFIG_RTC_CLK_SRC_INT_RC is not set
|
||||||
|
CONFIG_RTC_CLK_SRC_EXT_CRYS=y
|
||||||
|
# CONFIG_RTC_CLK_SRC_EXT_OSC is not set
|
||||||
|
# CONFIG_RTC_CLK_SRC_INT_RC32K is not set
|
||||||
|
# end of RTC Clock Config
|
Reference in New Issue
Block a user