From 16479246f15f3b92888dac3910197c1ed17d30fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Thu, 16 Jun 2022 02:25:50 +0200 Subject: [PATCH] [nrfconnect] Use [S]SED mode by default in a few examples (#19463) * [nrfconnect] Use [S]SED mode by default in a few examples Reduce the number of build types in some Matter samples by: 1. Removing Low Power builds. 2. Enabling SED in Lock and Light Switch and SSED in Window Covering by default. 3. Enabling PM_DEVICE in release builds. Signed-off-by: Damian Krolik * Restyled by prettier-markdown * Expose SED intervals via Kconfig Co-authored-by: Restyled.io --- config/zephyr/Kconfig | 20 +++++++++++ .../nrfconnect_examples_configuration.md | 6 ++++ .../all-clusters-app/nrfconnect/README.md | 19 ++--------- .../main/include/CHIPProjectConfig.h | 2 -- .../nrfconnect/overlay-low_power.conf | 30 ----------------- .../nrfconnect/README.md | 19 ++--------- .../main/include/CHIPProjectConfig.h | 2 -- .../nrfconnect/overlay-low_power.conf | 30 ----------------- .../light-switch-app/nrfconnect/README.md | 19 ++--------- .../nrfconnect/main/AppTask.cpp | 4 +-- .../main/include/CHIPProjectConfig.h | 1 - .../nrfconnect/overlay-low_power.conf | 30 ----------------- examples/light-switch-app/nrfconnect/prj.conf | 1 + .../nrfconnect/prj_no_dfu.conf | 1 + .../nrfconnect/prj_release.conf | 4 +++ examples/lighting-app/nrfconnect/README.md | 3 +- .../lighting-app/nrfconnect/main/AppTask.cpp | 5 +-- examples/lock-app/nrfconnect/README.md | 19 ++--------- examples/lock-app/nrfconnect/main/AppTask.cpp | 4 +-- .../main/include/CHIPProjectConfig.h | 2 -- .../nrfconnect/overlay-low_power.conf | 30 ----------------- examples/lock-app/nrfconnect/prj.conf | 1 + examples/lock-app/nrfconnect/prj_no_dfu.conf | 1 + examples/lock-app/nrfconnect/prj_release.conf | 4 +++ examples/pump-app/nrfconnect/README.md | 3 +- .../pump-controller-app/nrfconnect/README.md | 3 +- examples/window-app/nrfconnect/README.md | 19 ++--------- .../window-app/nrfconnect/main/AppTask.cpp | 6 ++-- .../main/include/CHIPProjectConfig.h | 7 ---- .../nrfconnect/overlay-low_power.conf | 33 ------------------- examples/window-app/nrfconnect/prj.conf | 4 +++ .../window-app/nrfconnect/prj_no_dfu.conf | 4 +++ .../window-app/nrfconnect/prj_release.conf | 7 ++++ .../nrfconnect/CHIPDevicePlatformConfig.h | 12 +++++++ 34 files changed, 87 insertions(+), 268 deletions(-) delete mode 100644 examples/all-clusters-app/nrfconnect/overlay-low_power.conf delete mode 100644 examples/all-clusters-minimal-app/nrfconnect/overlay-low_power.conf delete mode 100644 examples/light-switch-app/nrfconnect/overlay-low_power.conf delete mode 100644 examples/lock-app/nrfconnect/overlay-low_power.conf delete mode 100644 examples/window-app/nrfconnect/overlay-low_power.conf diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 42055393de2a58..b197f0491a9689 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -139,6 +139,26 @@ config CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT help Enables Thread Sleepy End Device support in Matter. +if CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT + +config CHIP_SED_IDLE_INTERVAL + int "Sleepy End Device idle interval (ms)" + default 1000 + help + SED wake interval in milliseconds while the device is idle, meaning that + there is no active exchange to or from the device, and its commissioning + window is closed. + +config CHIP_SED_ACTIVE_INTERVAL + int "Sleepy End Device active interval (ms)" + default 200 + help + SED wake interval in milliseconds while the device is active, meaning that + there is an active exchange to or from the device, or its commissioning + window is open. + +endif # CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT + config CHIP_THREAD_SSED bool "Enable Thread Synchronized Sleepy End Device support" depends on OPENTHREAD_CSL_RECEIVER && CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT diff --git a/docs/guides/nrfconnect_examples_configuration.md b/docs/guides/nrfconnect_examples_configuration.md index 236008b740f6c4..119852b3929a89 100644 --- a/docs/guides/nrfconnect_examples_configuration.md +++ b/docs/guides/nrfconnect_examples_configuration.md @@ -179,6 +179,12 @@ following Kconfig options: - `CONFIG_OPENTHREAD_MTD` - `CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT` +The following Kconfig options can be used to tune Thread Sleepy End Device wake +intervals: + +- `CONFIG_CHIP_SED_IDLE_INTERVAL` +- `CONFIG_CHIP_SED_ACTIVE_INTERVAL` + **Commissioning with NFC support** You can configure the Matter protocol to use an NFC tag for commissioning, diff --git a/examples/all-clusters-app/nrfconnect/README.md b/examples/all-clusters-app/nrfconnect/README.md index 29ca4bcb7e4648..101c286e304088 100644 --- a/examples/all-clusters-app/nrfconnect/README.md +++ b/examples/all-clusters-app/nrfconnect/README.md @@ -14,7 +14,8 @@ certification of a Matter device communicating over a low-power, 802.15.4 Thread network. The example behaves as a Matter accessory, that is a device that can be paired -into an existing Matter network and can be controlled by this network. +into an existing Matter network and can be controlled by this network. The +device works as a Thread Minimal End Device.
@@ -294,22 +295,6 @@ features like logs and command-line interface, run the following command: Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. -### Building with low-power configuration - -You can build the example using the low-power configuration, which enables -Thread's Sleepy End Device mode and disables debug features, such as the UART -console or the **LED 1** usage. - -To build for the low-power configuration, run the following command with -_build-target_ replaced with the build target name of the Nordic Semiconductor's -kit you own (for example `nrf52840dk_nrf52840`): - - $ west build -b build-target -- -DOVERLAY_CONFIG=overlay-low_power.conf - -For example, use the following command for `nrf52840dk_nrf52840`: - - $ west build -b nrf52840dk_nrf52840 -- -DOVERLAY_CONFIG=overlay-low_power.conf - ### Building with Device Firmware Upgrade support Support for DFU using Matter OTA is disabled by default. diff --git a/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h index 7a2941f28621df..9fea28ec9fde12 100644 --- a/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/all-clusters-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -29,5 +29,3 @@ // Use a default pairing code if one hasn't been provisioned in flash. #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 - -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 2000_ms32 diff --git a/examples/all-clusters-app/nrfconnect/overlay-low_power.conf b/examples/all-clusters-app/nrfconnect/overlay-low_power.conf deleted file mode 100644 index c962425f6ef937..00000000000000 --- a/examples/all-clusters-app/nrfconnect/overlay-low_power.conf +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright (c) 2022 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Enable MTD Sleepy End Device -CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y - -# Disable UART console -CONFIG_SHELL=n -CONFIG_LOG=n -CONFIG_UART_CONSOLE=n -CONFIG_SERIAL=n - -# Suspend devices when the CPU goes to sleep -CONFIG_PM_DEVICE=y - -# Disable auxiliary state LEDs -CONFIG_STATE_LEDS=n diff --git a/examples/all-clusters-minimal-app/nrfconnect/README.md b/examples/all-clusters-minimal-app/nrfconnect/README.md index 919fb768d5fd51..909b3d5b8861cd 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/README.md +++ b/examples/all-clusters-minimal-app/nrfconnect/README.md @@ -14,7 +14,8 @@ certification of a Matter device communicating over a low-power, 802.15.4 Thread network. The example behaves as a Matter accessory, that is a device that can be paired -into an existing Matter network and can be controlled by this network. +into an existing Matter network and can be controlled by this network. The +device works as a Thread Minimal End Device.
@@ -294,22 +295,6 @@ features like logs and command-line interface, run the following command: Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. -### Building with low-power configuration - -You can build the example using the low-power configuration, which enables -Thread's Sleepy End Device mode and disables debug features, such as the UART -console or the **LED 1** usage. - -To build for the low-power configuration, run the following command with -_build-target_ replaced with the build target name of the Nordic Semiconductor's -kit you own (for example `nrf52840dk_nrf52840`): - - $ west build -b build-target -- -DOVERLAY_CONFIG=overlay-low_power.conf - -For example, use the following command for `nrf52840dk_nrf52840`: - - $ west build -b nrf52840dk_nrf52840 -- -DOVERLAY_CONFIG=overlay-low_power.conf - ### Building with Device Firmware Upgrade support Support for DFU using Matter OTA is disabled by default. diff --git a/examples/all-clusters-minimal-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/all-clusters-minimal-app/nrfconnect/main/include/CHIPProjectConfig.h index 7a2941f28621df..9fea28ec9fde12 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/all-clusters-minimal-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -29,5 +29,3 @@ // Use a default pairing code if one hasn't been provisioned in flash. #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 - -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 2000_ms32 diff --git a/examples/all-clusters-minimal-app/nrfconnect/overlay-low_power.conf b/examples/all-clusters-minimal-app/nrfconnect/overlay-low_power.conf deleted file mode 100644 index c962425f6ef937..00000000000000 --- a/examples/all-clusters-minimal-app/nrfconnect/overlay-low_power.conf +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright (c) 2022 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Enable MTD Sleepy End Device -CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y - -# Disable UART console -CONFIG_SHELL=n -CONFIG_LOG=n -CONFIG_UART_CONSOLE=n -CONFIG_SERIAL=n - -# Suspend devices when the CPU goes to sleep -CONFIG_PM_DEVICE=y - -# Disable auxiliary state LEDs -CONFIG_STATE_LEDS=n diff --git a/examples/light-switch-app/nrfconnect/README.md b/examples/light-switch-app/nrfconnect/README.md index 0b14393eafe3c1..2b559a38edebd6 100644 --- a/examples/light-switch-app/nrfconnect/README.md +++ b/examples/light-switch-app/nrfconnect/README.md @@ -19,7 +19,8 @@ Semiconductor's nRF Connect SDK, and supports remote access and control of a lighting examples over a low-power, 802.15.4 Thread network. The example behaves as a Matter accessory, that is a device that can be paired -into an existing Matter network and can be controlled by this network. +into an existing Matter network and can be controlled by this network. The +device works as a Thread Sleepy End Device.
@@ -452,22 +453,6 @@ features like logs and command-line interface, run the following command: Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. -### Building with low-power configuration - -You can build the example using the low-power configuration, which enables -Thread's Sleepy End Device mode and disables debug features, such as the UART -console or the **LED 1** usage. - -To build for the low-power configuration, run the following command with -_build-target_ replaced with the build target name of the Nordic Semiconductor's -kit you own (for example `nrf52840dk_nrf52840`): - - $ west build -b build-target -- -DOVERLAY_CONFIG=overlay-low_power.conf - -For example, use the following command for `nrf52840dk_nrf52840`: - - $ west build -b nrf52840dk_nrf52840 -- -DOVERLAY_CONFIG=overlay-low_power.conf - ### Building with Device Firmware Upgrade support Support for DFU using Matter OTA is enabled by default. diff --git a/examples/light-switch-app/nrfconnect/main/AppTask.cpp b/examples/light-switch-app/nrfconnect/main/AppTask.cpp index f8dfd2d63d4750..4b98212214a41c 100644 --- a/examples/light-switch-app/nrfconnect/main/AppTask.cpp +++ b/examples/light-switch-app/nrfconnect/main/AppTask.cpp @@ -115,10 +115,8 @@ CHIP_ERROR AppTask::Init() #ifdef CONFIG_OPENTHREAD_MTD_SED err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); -#elif CONFIG_OPENTHREAD_MTD - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); #else - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); #endif if (err != CHIP_NO_ERROR) { diff --git a/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h index 5361319e42ecfe..ffd8d9b208940c 100644 --- a/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/light-switch-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -30,4 +30,3 @@ /* Use a default pairing code if one hasn't been provisioned in flash. */ #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 2000_ms32 diff --git a/examples/light-switch-app/nrfconnect/overlay-low_power.conf b/examples/light-switch-app/nrfconnect/overlay-low_power.conf deleted file mode 100644 index c962425f6ef937..00000000000000 --- a/examples/light-switch-app/nrfconnect/overlay-low_power.conf +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright (c) 2022 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Enable MTD Sleepy End Device -CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y - -# Disable UART console -CONFIG_SHELL=n -CONFIG_LOG=n -CONFIG_UART_CONSOLE=n -CONFIG_SERIAL=n - -# Suspend devices when the CPU goes to sleep -CONFIG_PM_DEVICE=y - -# Disable auxiliary state LEDs -CONFIG_STATE_LEDS=n diff --git a/examples/light-switch-app/nrfconnect/prj.conf b/examples/light-switch-app/nrfconnect/prj.conf index ade76cb81238fa..629b5cc693e1d3 100644 --- a/examples/light-switch-app/nrfconnect/prj.conf +++ b/examples/light-switch-app/nrfconnect/prj.conf @@ -29,6 +29,7 @@ CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n +CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y # Bluetooth overrides CONFIG_BT_DEVICE_NAME="MatterSwitch" diff --git a/examples/light-switch-app/nrfconnect/prj_no_dfu.conf b/examples/light-switch-app/nrfconnect/prj_no_dfu.conf index e032d64f912595..d23c1bd2f66f0e 100644 --- a/examples/light-switch-app/nrfconnect/prj_no_dfu.conf +++ b/examples/light-switch-app/nrfconnect/prj_no_dfu.conf @@ -29,6 +29,7 @@ CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n +CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y # Bluetooth overrides CONFIG_BT_DEVICE_NAME="MatterSwitch" diff --git a/examples/light-switch-app/nrfconnect/prj_release.conf b/examples/light-switch-app/nrfconnect/prj_release.conf index 0126f60b948f6f..8766ded201a22d 100644 --- a/examples/light-switch-app/nrfconnect/prj_release.conf +++ b/examples/light-switch-app/nrfconnect/prj_release.conf @@ -29,6 +29,7 @@ CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n +CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y # Bluetooth overrides CONFIG_BT_DEVICE_NAME="MatterSwitch" @@ -41,6 +42,9 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32772 == 0x8004 (example light-switch-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 +# Suspend devices when the CPU goes into sleep +CONFIG_PM_DEVICE=y + # Disable all debug features CONFIG_SHELL=n CONFIG_OPENTHREAD_SHELL=n diff --git a/examples/lighting-app/nrfconnect/README.md b/examples/lighting-app/nrfconnect/README.md index ff8013e360ad93..408d794b6436d2 100644 --- a/examples/lighting-app/nrfconnect/README.md +++ b/examples/lighting-app/nrfconnect/README.md @@ -14,7 +14,8 @@ Semiconductor's nRF Connect SDK, and supports remote access and control of a lighting over a low-power, 802.15.4 Thread network. The example behaves as a Matter accessory, that is a device that can be paired -into an existing Matter network and can be controlled by this network. +into an existing Matter network and can be controlled by this network. The +device works as a Thread Router.
diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index 3e4b71b1068d07..46ea48cf6b1a19 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -114,11 +114,8 @@ CHIP_ERROR AppTask::Init() return err; } -#ifdef CONFIG_OPENTHREAD_MTD - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); -#else err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); -#endif + if (err != CHIP_NO_ERROR) { LOG_ERR("ConnectivityMgr().SetThreadDeviceType() failed"); diff --git a/examples/lock-app/nrfconnect/README.md b/examples/lock-app/nrfconnect/README.md index ee46aab4ee2560..c1e2a2baf7e065 100644 --- a/examples/lock-app/nrfconnect/README.md +++ b/examples/lock-app/nrfconnect/README.md @@ -16,7 +16,8 @@ Semiconductor's nRF Connect SDK, and supports remote access and control of a simulated door lock over a low-power, 802.15.4 Thread network. The example behaves as a Matter accessory, that is a device that can be paired -into an existing Matter network and can be controlled by this network. +into an existing Matter network and can be controlled by this network. The +device works as a Thread Sleepy End Device.
@@ -381,22 +382,6 @@ features like logs and command-line interface, run the following command: Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. -### Building with low-power configuration - -You can build the example using the low-power configuration, which enables -Thread's Sleepy End Device mode and disables debug features, such as the UART -console or the **LED 1** usage. - -To build for the low-power configuration, run the following command with -_build-target_ replaced with the build target name of the Nordic Semiconductor's -kit you own (for example `nrf52840dk_nrf52840`): - - $ west build -b build-target -- -DOVERLAY_CONFIG=overlay-low_power.conf - -For example, use the following command for `nrf52840dk_nrf52840`: - - $ west build -b nrf52840dk_nrf52840 -- -DOVERLAY_CONFIG=overlay-low_power.conf - ### Building with Device Firmware Upgrade support Support for DFU using Matter OTA is enabled by default. diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index 6975dea5e6a65c..d1b1e2266810a6 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -107,10 +107,8 @@ CHIP_ERROR AppTask::Init() #ifdef CONFIG_OPENTHREAD_MTD_SED err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); -#elif CONFIG_OPENTHREAD_MTD - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); #else - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); #endif if (err != CHIP_NO_ERROR) { diff --git a/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h index bfa54151bad46d..7f6a313e145f87 100644 --- a/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/lock-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -30,5 +30,3 @@ // Use a default pairing code if one hasn't been provisioned in flash. #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 - -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 20000_ms32 diff --git a/examples/lock-app/nrfconnect/overlay-low_power.conf b/examples/lock-app/nrfconnect/overlay-low_power.conf deleted file mode 100644 index c75bcf53951546..00000000000000 --- a/examples/lock-app/nrfconnect/overlay-low_power.conf +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright (c) 2021 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Enable MTD Sleepy End Device -CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y - -# Disable UART console -CONFIG_SHELL=n -CONFIG_LOG=n -CONFIG_UART_CONSOLE=n -CONFIG_SERIAL=n - -# Suspend devices when the CPU goes to sleep -CONFIG_PM_DEVICE=y - -# Disable auxiliary state LEDs -CONFIG_STATE_LEDS=n diff --git a/examples/lock-app/nrfconnect/prj.conf b/examples/lock-app/nrfconnect/prj.conf index a74e2e254f7303..e42060f48b5639 100644 --- a/examples/lock-app/nrfconnect/prj.conf +++ b/examples/lock-app/nrfconnect/prj.conf @@ -29,6 +29,7 @@ CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n +CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y # Default OpenThread network settings CONFIG_OPENTHREAD_PANID=4660 diff --git a/examples/lock-app/nrfconnect/prj_no_dfu.conf b/examples/lock-app/nrfconnect/prj_no_dfu.conf index 82431c05977810..bd48ff463ddd8a 100644 --- a/examples/lock-app/nrfconnect/prj_no_dfu.conf +++ b/examples/lock-app/nrfconnect/prj_no_dfu.conf @@ -29,6 +29,7 @@ CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n +CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y # Default OpenThread network settings CONFIG_OPENTHREAD_PANID=4660 diff --git a/examples/lock-app/nrfconnect/prj_release.conf b/examples/lock-app/nrfconnect/prj_release.conf index 93d253d3955324..7b1aae9180179f 100644 --- a/examples/lock-app/nrfconnect/prj_release.conf +++ b/examples/lock-app/nrfconnect/prj_release.conf @@ -29,6 +29,7 @@ CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n +CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y # Default OpenThread network settings CONFIG_OPENTHREAD_PANID=4660 @@ -47,6 +48,9 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32774 == 0x8006 (example lock-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 +# Suspend devices when the CPU goes into sleep +CONFIG_PM_DEVICE=y + # Disable all debug features CONFIG_SHELL=n CONFIG_OPENTHREAD_SHELL=n diff --git a/examples/pump-app/nrfconnect/README.md b/examples/pump-app/nrfconnect/README.md index 515c64272e0d1d..94df485f7afe4a 100644 --- a/examples/pump-app/nrfconnect/README.md +++ b/examples/pump-app/nrfconnect/README.md @@ -17,7 +17,8 @@ Semiconductor's nRF Connect SDK, and supports remote access and control of a simulated pump over a low-power, 802.15.4 Thread network. The example behaves as a Matter accessory, that is a device that can be paired -into an existing Matter network and can be controlled by this network. +into an existing Matter network and can be controlled by this network. The +device works as a Thread Minimal End Device.
diff --git a/examples/pump-controller-app/nrfconnect/README.md b/examples/pump-controller-app/nrfconnect/README.md index b3e9c279e36d11..81e5e23b1f81d9 100644 --- a/examples/pump-controller-app/nrfconnect/README.md +++ b/examples/pump-controller-app/nrfconnect/README.md @@ -18,7 +18,8 @@ Semiconductor's nRF Connect SDK, and supports remote access and control of a simulated pump over a low-power, 802.15.4 Thread network. The example behaves as a Matter accessory, that is a device that can be paired -into an existing Matter network and can be controlled by this network. +into an existing Matter network and can be controlled by this network. The +device works as a Thread Minimal End Device.
diff --git a/examples/window-app/nrfconnect/README.md b/examples/window-app/nrfconnect/README.md index 4f6ce47c8f74cb..8fbabd6f23f2b5 100644 --- a/examples/window-app/nrfconnect/README.md +++ b/examples/window-app/nrfconnect/README.md @@ -62,7 +62,8 @@ configuration from it. Some actions required before establishing full communication are described below. The example can be configured to use the secure bootloader and utilize it for -performing over-the-air Device Firmware Upgrade using Bluetooth LE. +performing over-the-air Device Firmware Upgrade using Bluetooth LE. The device +works as a Thread Synchronized Sleepy End Device. ### Bluetooth LE advertising @@ -388,22 +389,6 @@ features like logs and command-line interface, run the following command: Remember to replace _build-target_ with the build target name of the Nordic Semiconductor's kit you own. -### Building with low-power configuration - -You can build the example using the low-power configuration, which enables -Thread's Synchronized Sleepy End Device mode and disables debug features, such -as the UART console or the **LED 1** usage. - -To build for the low-power configuration, run the following command with -_build-target_ replaced with the build target name of the Nordic Semiconductor's -kit you own (for example `nrf52840dk_nrf52840`): - - $ west build -b build-target -- -DOVERLAY_CONFIG=overlay-low_power.conf - -For example, use the following command for `nrf52840dk_nrf52840`: - - $ west build -b nrf52840dk_nrf52840 -- -DOVERLAY_CONFIG=overlay-low_power.conf - ### Building with Device Firmware Upgrade support Support for DFU using Matter OTA is enabled by default. diff --git a/examples/window-app/nrfconnect/main/AppTask.cpp b/examples/window-app/nrfconnect/main/AppTask.cpp index 01055a4935f54d..f62b096c61d878 100644 --- a/examples/window-app/nrfconnect/main/AppTask.cpp +++ b/examples/window-app/nrfconnect/main/AppTask.cpp @@ -107,10 +107,10 @@ CHIP_ERROR AppTask::Init() return err; } -#ifdef CONFIG_OPENTHREAD_MTD_SED - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); -#elif CONFIG_CHIP_THREAD_SSED +#if CONFIG_CHIP_THREAD_SSED err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SynchronizedSleepyEndDevice); +#elif CONFIG_OPENTHREAD_MTD_SED + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #else err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); #endif diff --git a/examples/window-app/nrfconnect/main/include/CHIPProjectConfig.h b/examples/window-app/nrfconnect/main/include/CHIPProjectConfig.h index de64851584ba9d..9fea28ec9fde12 100644 --- a/examples/window-app/nrfconnect/main/include/CHIPProjectConfig.h +++ b/examples/window-app/nrfconnect/main/include/CHIPProjectConfig.h @@ -29,10 +29,3 @@ // Use a default pairing code if one hasn't been provisioned in flash. #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 #define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 - -#ifdef CONFIG_CHIP_THREAD_SSED -#define CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL 500_ms32 -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 500_ms32 -#else -#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL 2000_ms32 -#endif diff --git a/examples/window-app/nrfconnect/overlay-low_power.conf b/examples/window-app/nrfconnect/overlay-low_power.conf deleted file mode 100644 index 602eb4f76784e2..00000000000000 --- a/examples/window-app/nrfconnect/overlay-low_power.conf +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright (c) 2022 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Enable MTD Sleepy End Device -CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y - -# Enable Thread CSL to support Synchronized SED -CONFIG_CHIP_THREAD_SSED=y - -# Disable UART console -CONFIG_SHELL=n -CONFIG_LOG=n -CONFIG_UART_CONSOLE=n -CONFIG_SERIAL=n - -# Suspend devices when the CPU goes to sleep -CONFIG_PM_DEVICE=y - -# Disable auxiliary state LEDs -CONFIG_STATE_LEDS=n diff --git a/examples/window-app/nrfconnect/prj.conf b/examples/window-app/nrfconnect/prj.conf index 1ffcaee2b430a4..9595ec207e8582 100644 --- a/examples/window-app/nrfconnect/prj.conf +++ b/examples/window-app/nrfconnect/prj.conf @@ -30,6 +30,10 @@ CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n +CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y +CONFIG_CHIP_THREAD_SSED=y +CONFIG_CHIP_SED_IDLE_INTERVAL=500 +CONFIG_CHIP_SED_ACTIVE_INTERVAL=500 # Default OpenThread network settings CONFIG_OPENTHREAD_PANID=4660 diff --git a/examples/window-app/nrfconnect/prj_no_dfu.conf b/examples/window-app/nrfconnect/prj_no_dfu.conf index 1bb9717bae150f..680894d3cbb4e5 100644 --- a/examples/window-app/nrfconnect/prj_no_dfu.conf +++ b/examples/window-app/nrfconnect/prj_no_dfu.conf @@ -29,6 +29,10 @@ CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n +CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y +CONFIG_CHIP_THREAD_SSED=y +CONFIG_CHIP_SED_IDLE_INTERVAL=500 +CONFIG_CHIP_SED_ACTIVE_INTERVAL=500 # Default OpenThread network settings CONFIG_OPENTHREAD_PANID=4660 diff --git a/examples/window-app/nrfconnect/prj_release.conf b/examples/window-app/nrfconnect/prj_release.conf index dcc71d6d218c46..2278618efca3fa 100644 --- a/examples/window-app/nrfconnect/prj_release.conf +++ b/examples/window-app/nrfconnect/prj_release.conf @@ -29,6 +29,10 @@ CONFIG_OPENTHREAD_THREAD_VERSION_1_2=y CONFIG_OPENTHREAD_NORDIC_LIBRARY_MTD=y CONFIG_OPENTHREAD_MTD=y CONFIG_OPENTHREAD_FTD=n +CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT=y +CONFIG_CHIP_THREAD_SSED=y +CONFIG_CHIP_SED_IDLE_INTERVAL=500 +CONFIG_CHIP_SED_ACTIVE_INTERVAL=500 # Default OpenThread network settings CONFIG_OPENTHREAD_PANID=4660 @@ -47,6 +51,9 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example window-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 +# Suspend devices when the CPU goes into sleep +CONFIG_PM_DEVICE=y + # Disable all debug features CONFIG_SHELL=n CONFIG_OPENTHREAD_SHELL=n diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index bcab84e5d9efc0..fb6617d34d3dd8 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -163,6 +163,18 @@ #define CHIP_DEVICE_CONFIG_THREAD_SSED CONFIG_CHIP_THREAD_SSED #endif // CONFIG_CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT +#ifndef CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL +#ifdef CONFIG_CHIP_SED_IDLE_INTERVAL +#define CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL chip::System::Clock::Milliseconds32(CONFIG_CHIP_SED_IDLE_INTERVAL) +#endif // CONFIG_CHIP_SED_IDLE_INTERVAL +#endif // CHIP_DEVICE_CONFIG_SED_IDLE_INTERVAL + +#ifndef CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL +#ifdef CONFIG_CHIP_SED_ACTIVE_INTERVAL +#define CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL chip::System::Clock::Milliseconds32(CONFIG_CHIP_SED_ACTIVE_INTERVAL) +#endif // CONFIG_CHIP_SED_ACTIVE_INTERVAL +#endif // CHIP_DEVICE_CONFIG_SED_ACTIVE_INTERVAL + #ifdef CONFIG_CHIP_COMMISSIONABLE_DEVICE_TYPE #define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE 1 #endif // CONFIG_CHIP_COMMISSIONABLE_DEVICE_TYPE