Add ESP32-C6 support for ICD example

This commit is contained in:
WanqQixiang
2024-02-20 14:34:56 +08:00
parent 0715268468
commit f105b90de0
15 changed files with 153 additions and 48 deletions
+2 -2
View File
@@ -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
@@ -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)
+54
View File
@@ -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).
Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

@@ -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
-39
View File
@@ -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)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

@@ -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]"