diff --git a/examples/.build-rules.yml b/examples/.build-rules.yml index 53f0a1411..b92eba669 100644 --- a/examples/.build-rules.yml +++ b/examples/.build-rules.yml @@ -75,9 +75,9 @@ examples/mfg_test_app: temporary: true reason: the other targets are not tested yet -examples/sleepy_device: +examples/icd_app: enable: - - if: IDF_TARGET in ["esp32h2"] + - if: IDF_TARGET in ["esp32h2", "esp32c6"] temporary: true reason: the other targets are not tested yet diff --git a/examples/esp-now_bridge_light/main/idf_component.yml b/examples/esp-now_bridge_light/main/idf_component.yml index 05f6503ad..3f4859eb4 100644 --- a/examples/esp-now_bridge_light/main/idf_component.yml +++ b/examples/esp-now_bridge_light/main/idf_component.yml @@ -1,6 +1,8 @@ ## IDF Component Manager Manifest File dependencies: - espressif/esp-now: ">=2.2.0" + # esp-now 2.5.0 will use 'dcm' member in esp_now_rate_config_t, and that member is introduced after IDF v5.1.2. + # TODO: update esp-now component to the latest version when updating ESP-IDF + espressif/esp-now: "2.4.0" ## Required IDF version idf: version: ">=4.1.0" diff --git a/examples/sleepy_device/CMakeLists.txt b/examples/icd_app/CMakeLists.txt similarity index 91% rename from examples/sleepy_device/CMakeLists.txt rename to examples/icd_app/CMakeLists.txt index 493205bf0..3eb277396 100644 --- a/examples/sleepy_device/CMakeLists.txt +++ b/examples/icd_app/CMakeLists.txt @@ -9,6 +9,8 @@ endif(NOT DEFINED ENV{ESP_MATTER_PATH}) if(NOT DEFINED ENV{ESP_MATTER_DEVICE_PATH}) if("${IDF_TARGET}" STREQUAL "esp32h2") set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32h2_devkit_c) + elseif("${IDF_TARGET}" STREQUAL "esp32c6") + set(ENV{ESP_MATTER_DEVICE_PATH} $ENV{ESP_MATTER_PATH}/device_hal/device/esp32c6_devkit_c) else() message(FATAL_ERROR "Unsupported IDF_TARGET") endif() @@ -31,7 +33,7 @@ set(EXTRA_COMPONENT_DIRS "${ESP_MATTER_PATH}/device_hal/device" ${extra_components_dirs_append}) -project(sleepy_device) +project(icd_app) idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H;-DCONFIG_OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES=5" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DCONFIG_OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_MAX_SERVICES=5" APPEND) diff --git a/examples/icd_app/README.md b/examples/icd_app/README.md new file mode 100644 index 000000000..a01231ff8 --- /dev/null +++ b/examples/icd_app/README.md @@ -0,0 +1,54 @@ +# Intermittently Connected Device (ICD) + +This example creates a Matter ICD device using the ESP Matter data model. Currently it is available for ESP32-H2 and ESP32-C6. + +See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html) for more information about building and flashing the firmware. + +## 1. Additional Environment Setup + +No additional setup is required. + +## 2. Post Commissioning Setup + +No additional setup is required. + +## 3. ICD configuration options + +The ICD configuration parameters can be configured in menuconfig. + +``` +# Enable ICD server +CONFIG_ENABLE_ICD_SERVER=y +# ICD Active mode interval(ms) +CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS=1000 +# ICD Active mode threshold(ms) +CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS=1000 +# ICD Idle mode interval(s) +CONFIG_ICD_IDLE_MODE_INTERVAL_SEC=60 +# ICD Fast Poll interval(ms) +CONFIG_ICD_FAST_POLL_INTERVAL_MS=500 +# ICD Slow Poll interval(ms) +CONFIG_ICD_SLOW_POLL_INTERVAL_MS=5000 +``` + +## 4. Power usage + +The power usage will be various for different configuration parameters of ICD server. + +Below are example current wave figures for ESP32-H2 Devkit-C and ESP32-C6 Devkit-C. The ICD configurations and radio TX power are list in the table. + +| Parameter | Value | +|---------------------------|--------| +| ICD Fast Polling Interval | 500ms | +| ICD Slow Polling Interval | 5000ms | +| ICD Active Mode Duration | 1000ms | +| ICD Idle Mode Duration | 60s | +| Radio TX Power | 20dBm | + +Current Wave Figure for ESP32-H2: +![power_record_h2](image/power_record_h2.png) + +Current Wave Figure for ESP32-C6: +![power_record_c6](image/power_record_c6.png) + +**Note**: For ESP32-C6, please use ESP-IDF on branch `release/v5.1` with the commit id [931eaf7320](https://github.com/espressif/esp-idf/tree/931eaf7320b6c0b9acc9711ba4774f4f1bd3dae7). diff --git a/examples/icd_app/image/power_record_c6.png b/examples/icd_app/image/power_record_c6.png new file mode 100644 index 000000000..1c10c9166 Binary files /dev/null and b/examples/icd_app/image/power_record_c6.png differ diff --git a/examples/icd_app/image/power_record_h2.png b/examples/icd_app/image/power_record_h2.png new file mode 100644 index 000000000..78784d599 Binary files /dev/null and b/examples/icd_app/image/power_record_h2.png differ diff --git a/examples/sleepy_device/main/CMakeLists.txt b/examples/icd_app/main/CMakeLists.txt similarity index 100% rename from examples/sleepy_device/main/CMakeLists.txt rename to examples/icd_app/main/CMakeLists.txt diff --git a/examples/sleepy_device/main/app_main.cpp b/examples/icd_app/main/app_main.cpp similarity index 100% rename from examples/sleepy_device/main/app_main.cpp rename to examples/icd_app/main/app_main.cpp diff --git a/examples/sleepy_device/main/app_priv.h b/examples/icd_app/main/app_priv.h similarity index 100% rename from examples/sleepy_device/main/app_priv.h rename to examples/icd_app/main/app_priv.h diff --git a/examples/sleepy_device/partitions.csv b/examples/icd_app/partitions.csv similarity index 100% rename from examples/sleepy_device/partitions.csv rename to examples/icd_app/partitions.csv diff --git a/examples/sleepy_device/sdkconfig.defaults b/examples/icd_app/sdkconfig.defaults similarity index 100% rename from examples/sleepy_device/sdkconfig.defaults rename to examples/icd_app/sdkconfig.defaults diff --git a/examples/icd_app/sdkconfig.defaults.esp32c6 b/examples/icd_app/sdkconfig.defaults.esp32c6 new file mode 100644 index 000000000..63f185b8d --- /dev/null +++ b/examples/icd_app/sdkconfig.defaults.esp32c6 @@ -0,0 +1,94 @@ +CONFIG_IDF_TARGET="esp32c6" + +# libsodium +CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y + +# NIMBLE +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +CONFIG_BT_NIMBLE_EXT_ADV=n +CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 +CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING=y + +# FreeRTOS should use legacy API +CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y + +# Enable OpenThread +CONFIG_OPENTHREAD_ENABLED=y +CONFIG_OPENTHREAD_SRP_CLIENT=y +CONFIG_OPENTHREAD_DNS_CLIENT=y +CONFIG_OPENTHREAD_LOG_LEVEL_DYNAMIC=n +CONFIG_OPENTHREAD_LOG_LEVEL_NOTE=y +CONFIG_OPENTHREAD_CLI=n + +# Disable lwip ipv6 autoconfig +CONFIG_LWIP_IPV6_AUTOCONFIG=n + +# Use a custom partition table +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + +# LwIP config for OpenThread +CONFIG_LWIP_IPV6_NUM_ADDRESSES=8 +CONFIG_LWIP_MULTICAST_PING=y + +# MDNS platform +CONFIG_USE_MINIMAL_MDNS=n +CONFIG_ENABLE_EXTENDED_DISCOVERY=y + +# Enable OTA Requestor +CONFIG_ENABLE_OTA_REQUESTOR=y + +# Disable STA and AP for ESP32H2 +CONFIG_ENABLE_WIFI_STATION=n +CONFIG_ENABLE_WIFI_AP=n + +# Disable chip shell +CONFIG_ENABLE_CHIP_SHELL=n + +# Enable DS Peripheral +CONFIG_ESP_SECURE_CERT_DS_PERIPHERAL=y + +# BLE Sleep +CONFIG_BT_LE_SLEEP_ENABLE=y +CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL=y + +# Disable external 32K crystal +CONFIG_RTC_CLK_SRC_EXT_CRYS=n + +# Enable power management +CONFIG_PM_ENABLE=y +CONFIG_PM_DFS_INIT_AUTO=y +CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP=y +CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=n +CONFIG_ESP_PHY_MAC_BB_PD=y + +# FreeRTOS config for light sleep +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_USE_TICKLESS_IDLE=y + +# Enable IEEE 802.15.4 sleep +CONFIG_IEEE802154_SLEEP_ENABLE=y + +# FreeRTOS config for light sleep +CONFIG_LWIP_ND6=n +CONFIG_LWIP_IPV4=n +CONFIG_DISABLE_IPV4=y + +# Disable hardware acceleration +CONFIG_MBEDTLS_HARDWARE_AES=n +CONFIG_MBEDTLS_HARDWARE_MPI=n +CONFIG_MBEDTLS_HARDWARE_SHA=n +CONFIG_MBEDTLS_HARDWARE_ECC=n +CONFIG_MBEDTLS_HARDWARE_ECDSA_VERIFY=n +CONFIG_MBEDTLS_SSL_PROTO_DTLS=y + +# Use OpenThread MTD +CONFIG_OPENTHREAD_MTD=y + +# ICD configurations +CONFIG_ENABLE_ICD_SERVER=y +CONFIG_ICD_FAST_POLL_INTERVAL_MS=500 +CONFIG_ICD_IDLE_MODE_INTERVAL_SEC=60 +CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS=1000 +CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS=1000 diff --git a/examples/sleepy_device/sdkconfig.defaults.esp32h2 b/examples/icd_app/sdkconfig.defaults.esp32h2 similarity index 100% rename from examples/sleepy_device/sdkconfig.defaults.esp32h2 rename to examples/icd_app/sdkconfig.defaults.esp32h2 diff --git a/examples/sleepy_device/README.md b/examples/sleepy_device/README.md deleted file mode 100644 index 6a0349e72..000000000 --- a/examples/sleepy_device/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Sleepy device - -This example creates a Sleepy device using the ESP Matter -data model. Currently it can be only available for ESP32-H2. - -See the [docs](https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html) for more information about building and flashing the firmware. - -## 1. Additional Environment Setup - -No additional setup is required. - -## 2. Post Commissioning Setup - -No additional setup is required. - -## 3. ICD configuration options - -The ICD configuration parameters can be configured in menuconfig. - -``` -# Enable ICD server -CONFIG_ENABLE_ICD_SERVER=y -# ICD Active mode interval(ms) -CONFIG_ICD_ACTIVE_MODE_INTERVAL_MS=1000 -# ICD Active mode threshold(ms) -CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS=1000 -# ICD Idle mode interval(s) -CONFIG_ICD_IDLE_MODE_INTERVAL_SEC=60 -# ICD Fast Poll interval(ms) -CONFIG_ICD_FAST_POLL_INTERVAL_MS=500 -# ICD Slow Poll interval(ms) -CONFIG_ICD_SLOW_POLL_INTERVAL_MS=5000 -``` - -## 4. Power usage - -The power usage will be various for different configuration parameters of ICD server. Below is an example current wave figure for ESP32-H2 Devkit-C. The ICD configurations and radio TX power are also on the picture. -![power_record](image/power_record.png) - diff --git a/examples/sleepy_device/image/power_record.png b/examples/sleepy_device/image/power_record.png deleted file mode 100644 index bf8b3400d..000000000 Binary files a/examples/sleepy_device/image/power_record.png and /dev/null differ diff --git a/examples/sleepy_device/main/idf_component.yml b/examples/sleepy_device/main/idf_component.yml deleted file mode 100644 index 95ee7845b..000000000 --- a/examples/sleepy_device/main/idf_component.yml +++ /dev/null @@ -1,6 +0,0 @@ -dependencies: - espressif/cmake_utilities: - version: 0.* - rules: # will add "optional_component" only when all if clauses are True - - if: "idf_version >=5.0" - - if: "target in [esp32c2]"