Skip to content

Commit

Permalink
[nrfconnect] Added Wi-Fi support to nrfconnect examples. (#23715)
Browse files Browse the repository at this point in the history
* [nrfconnect] Added Wi-Fi support to nrfconnect examples.

In this commit:
- Added the first support for Wi-Fi to nrfconnect examples:
lightinig-app, lock-app, light-switch-app, all-clusters-app

- Enabled CI all wi-fi samples checking for Wi-Fi target
nrf7002 - all-clusters-app on each commit, others related
to nrfconnect sources.

- Aligned Common api to NCS 2.1.1.

- Updated documentation for all samples and added Wi-Fi
nRF7002 target and descriptions

* Restyled by clang-format

* Restyled by prettier-markdown

* Some fixes after a review.

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Feb 13, 2023
1 parent de6afc5 commit 2465016
Show file tree
Hide file tree
Showing 138 changed files with 3,567 additions and 2,139 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/examples-nrfconnect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,41 @@ jobs:
nrfconnect nrf5340dk_nrf5340_cpuapp lighting-app \
examples/lighting-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Lock App on nRF7002 PDK
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 20
run: |
scripts/examples/nrfconnect_example.sh lock-app nrf7002dk_nrf5340_cpuapp
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf7002dk_nrf5340_cpuapp lock-app \
examples/lock-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Light Switch App on nRF7002 PDK
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 20
run: |
scripts/examples/nrfconnect_example.sh light-switch-app nrf7002dk_nrf5340_cpuapp
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf7002dk_nrf5340_cpuapp light-switch-app \
examples/light-switch-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK Lighting App on nRF7002 PDK
if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true'
timeout-minutes: 20
run: |
scripts/examples/nrfconnect_example.sh lighting-app nrf7002dk_nrf5340_cpuapp
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf7002dk_nrf5340_cpuapp lighting-app \
examples/light-switch-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Build example nRF Connect SDK All Clusters App on nRF7002 PDK
timeout-minutes: 20
run: |
scripts/examples/nrfconnect_example.sh all-clusters-app nrf7002dk_nrf5340_cpuapp
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
nrfconnect nrf7002dk_nrf5340_cpuapp all-clusters-app \
examples/all-clusters-app/nrfconnect/build/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: Run unit tests for Zephyr native_posix_64 platform
if: github.event_name == 'push' || steps.changed_paths.outputs.tests == 'true'
timeout-minutes: 15
Expand Down
9 changes: 9 additions & 0 deletions config/nrfconnect/chip-module/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ rsource "../../zephyr/Kconfig"

if CHIP

config CHIP_APP_LOG_LEVEL
int "Set logging level in application"
default LOG_DEFAULT_LEVEL
help
Sets the logging level in Matter application.
This config should be used only within application.
To set the logging level for Matter stack use MATTER_LOG_LEVEL
config.

config CHIP_NFC_COMMISSIONING
bool "Enable NFC commissioning support"
default n
Expand Down
8 changes: 4 additions & 4 deletions config/zephyr/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ config CHIP_SED_ACTIVE_INTERVAL
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
help
Enables Thread Synchronized Sleepy End Device support in Matter.
bool "Enable Thread Synchronized Sleepy End Device support"
depends on OPENTHREAD_CSL_RECEIVER && CHIP_ENABLE_SLEEPY_END_DEVICE_SUPPORT
help
Enables Thread Synchronized Sleepy End Device support in Matter.

config CHIP_OTA_REQUESTOR
bool "Enable OTA requestor"
Expand Down
7 changes: 4 additions & 3 deletions docs/guides/nrfconnect_android_commissioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ example for the nRF Connect platform into a Matter fabric.

This guide references the nRF52840 DK and Matter nRF Connect Lighting Example
Application that communicates with other nodes over a Thread network, but the
instructions can be adapted to other platforms and applications. In particular,
some sections of this guide include deviations from the original procedure that
are needed to test a Wi-Fi device.
instructions can be adapted to other platforms and applications. For instance,
some sections of this guide include steps for testing a Wi-Fi device, which are
adapted from the original Thread-based procedure.

<hr>

Expand Down Expand Up @@ -68,6 +68,7 @@ accessory using Android CHIPTool:
replace this DK with another compatible device, such as the nRF5340 DK or
nRF7002 DK. nRF52840 DK and nRF5340 DK can be used to test Matter over
Thread, and nRF7002 DK can be used to test Matter over Wi-Fi.

- 1x nRF52840 DK for running the
[OpenThread Radio Co-Processor](https://openthread.io/platforms/co-processor)
firmware. You can replace this DK with another compatible device, such as
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ include(${CHIP_ROOT}/config/nrfconnect/app/check-nrfconnect-version.cmake)
# Set Kconfig root files that will be processed as a first Kconfig for used child images.
set(mcuboot_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.mcuboot.root)
set(multiprotocol_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root)
set(hci_rpmsg_KCONFIG_ROOT ${CHIP_ROOT}/config/nrfconnect/chip-module/Kconfig.hci_rpmsg.root)

if(DEFINED CONF_FILE AND NOT CONF_FILE STREQUAL "prj.conf")
set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml)
Expand Down
13 changes: 13 additions & 0 deletions examples/all-clusters-app/nrfconnect/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ config STATE_LEDS
Use LEDs to render the current state of the device such as the progress of commissioning of
the device into a network or the factory reset initiation.

# Sample configuration used for Thread networking
if NET_L2_OPENTHREAD

choice OPENTHREAD_NORDIC_LIBRARY_CONFIGURATION
default OPENTHREAD_NORDIC_LIBRARY_MTD
endchoice

choice OPENTHREAD_DEVICE_TYPE
default OPENTHREAD_MTD
endchoice

endif # NET_L2_OPENTHREAD

rsource "../../../config/nrfconnect/chip-module/Kconfig.features"
rsource "../../../config/nrfconnect/chip-module/Kconfig.defaults"
source "Kconfig.zephyr"
106 changes: 76 additions & 30 deletions examples/all-clusters-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ creating your own application.
The example is based on
[Matter](https://github.com/project-chip/connectedhomeip) and Nordic
Semiconductor's nRF Connect SDK, and was created to facilitate testing and
certification of a Matter device communicating over a low-power, 802.15.4 Thread
network.
certification of a Matter device communicating over a low-power 802.15.4 Thread
network, or Wi-Fi 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. The
device works as a Thread Minimal End Device.
into an existing Matter network and can be controlled by this network. In the
case of Thread, this device works as a Thread Sleepy End Device. Support for
both Thread and Wi-Fi is mutually exclusive and depends on the hardware
platform, so only one protocol can be supported for a specific device.

<hr>

Expand All @@ -24,6 +26,7 @@ device works as a Thread Minimal End Device.
- [Bluetooth LE rendezvous](#bluetooth-le-rendezvous)
- [Requirements](#requirements)
- [Supported devices](#supported_devices)
- [IPv6 network support](#ipv6-network-support)
- [Device UI](#device-ui)
- [Setting up the environment](#setting-up-the-environment)
- [Using Docker container for setup](#using-docker-container-for-setup)
Expand Down Expand Up @@ -55,17 +58,27 @@ and [Zephyr RTOS](https://zephyrproject.org/). Visit Matter's
[nRF Connect platform overview](../../../docs/guides/nrfconnect_platform_overview.md)
to read more about the platform structure and dependencies.

The Matter device that runs the all clusters application is controlled by the
Matter controller device over the Thread protocol. By default, the Matter device
has Thread disabled, and it should be paired with Matter controller and get
configuration from it. Some actions required before establishing full
communication are described below.
By default, the Matter accessory device has IPv6 networking disabled. You must
pair it with the Matter controller over Bluetooth® LE to get the configuration
from the controller to use the device within a Thread or Wi-Fi network. You have
to make the device discoverable manually (for security reasons). See
[Bluetooth LE advertising](#bluetooth-le-advertising) to learn how to do this.
The controller must get the commissioning information from the Matter accessory
device and provision the device into the network.

You can test this application remotely over the Thread or the Wi-Fi protocol,
which in either case requires more devices, including a Matter controller that
you can configure either on a PC or a mobile device.

### Bluetooth LE advertising

In this example, to commission the device onto a Matter network, it must be
discoverable over Bluetooth LE. For security reasons, you must start Bluetooth
LE advertising manually after powering up the device by pressing **Button 4**.
LE advertising manually after powering up the device by pressing:

- On nRF52840 DK, nRF5340 DK, and nRF21540 DK: **Button 4**.

- On nRF7002 DK: **Button 2**.

### Bluetooth LE rendezvous

Expand All @@ -75,14 +88,16 @@ commissioner role.

To start the rendezvous, the controller must get the commissioning information
from the Matter device. The data payload is encoded within a QR code, printed to
the UART console.
the UART console, and shared using an NFC tag. The emulation of the NFC tag
starts automatically when Bluetooth LE advertising is started and stays enabled
until Bluetooth LE advertising timeout expires.

#### Thread provisioning
#### Thread or Wi-Fi provisioning

Last part of the rendezvous procedure, the provisioning operation involves
sending the Thread network credentials from the Matter controller to the Matter
device. As a result, device is able to join the Thread network and communicate
with other Thread devices in the network.
sending the Thread or Wi-Fi network credentials from the Matter controller to
the Matter device. As a result, the device joins the Thread or Wi-Fi network and
can communicate with other devices in the network.

<hr>

Expand All @@ -100,14 +115,24 @@ more information.

The example supports building and running on the following devices:

| Hardware platform | Build target | Platform image |
| ------------------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` | <details><summary>nRF52840 DK</summary><img src="../../platform/nrfconnect/doc/images/nRF52840_DK_info-medium.jpg" alt="nRF52840 DK"/></details> |
| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` | <details><summary>nRF5340 DK</summary><img src="../../platform/nrfconnect/doc/images/nRF5340_DK_info-medium.jpg" alt="nRF5340 DK"/></details> |
| [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle) | `nrf52840dongle_nrf52840` | <details><summary>nRF52840 Dongle</summary><img src="../../platform/nrfconnect/doc/images/nRF52840_Dongle-medium.jpg" alt="nRF52840 Dongle"/></details> |
| Hardware platform | Build target | Platform image |
| --------------------------------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [nRF52840 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK) | `nrf52840dk_nrf52840` | <details><summary>nRF52840 DK</summary><img src="../../platform/nrfconnect/doc/images/nRF52840_DK_info-medium.jpg" alt="nRF52840 DK"/></details> |
| [nRF5340 DK](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF5340-DK) | `nrf5340dk_nrf5340_cpuapp` | <details><summary>nRF5340 DK</summary><img src="../../platform/nrfconnect/doc/images/nRF5340_DK_info-medium.jpg" alt="nRF5340 DK"/></details> |
| [nRF52840 Dongle](https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle) | `nrf52840dongle_nrf52840` | <details><summary>nRF52840 Dongle</summary><img src="../../platform/nrfconnect/doc/images/nRF52840_Dongle-medium.jpg" alt="nRF52840 Dongle"/></details> |
| [nRF7002 DK](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_nrf7002.html#nrf7002dk-nrf5340) | `nrf7002dk_nrf5340_cpuapp` | <details><summary>nRF7002DK</summary><img src="../../platform/nrfconnect/doc/images/nrf7002dk.jpg" alt="nRF7002 DK"/></details> |

<hr>

### IPv6 network support

The development kits for this sample offer the following IPv6 network support
for Matter:

- Matter over Thread is supported for `nrf52840dk_nrf52840` and
`nrf5340dk_nrf5340_cpuapp`.
- Matter over Wi-Fi is supported for `nrf7002dk_nrf5340_cpuapp`.

<a name="device-ui"></a>

## Device UI
Expand Down Expand Up @@ -137,21 +162,42 @@ following states are possible:
Bluetooth LE.

- _Short Flash Off (950ms on/50ms off)_ &mdash; The device is fully
provisioned, but does not yet have full Thread network or service
connectivity.
provisioned, but does not yet have full connectivity for Thread or Wi-Fi
network.

- _Solid On_ &mdash; The device is fully provisioned and has full Thread
network and service connectivity.
- _Solid On_ &mdash; The device is fully provisioned.

**Button 1** can be used for the following purposes:

- _Pressed for 6 s_ &mdash; Initiates the factory reset of the device.
Releasing the button within the 6-second window cancels the factory reset
procedure. **LEDs 1-4** blink in unison when the factory reset procedure is
initiated.
- _Pressed for less than 3 s_ &mdash; Initiates the OTA software update
process. This feature is disabled by default, but can be enabled by
following the
[Building with Device Firmware Upgrade support](#building-with-device-firmware-upgrade-support)
instructions.

- _Pressed for more than 3 s_ &mdash; initiates the factory reset of the
device. Releasing the button within the 3-second window cancels the factory
reset procedure.

**Button 2**:

- On nRF52840 DK, nRF5340 DK, and nRF21540 DK: Not available.

- On nRF7002 DK:

- If pressed for more than three seconds, it starts the NFC tag emulation,
enables Bluetooth LE advertising for the predefined period of time (15
minutes by default), and makes the device discoverable over Bluetooth
LE.

**Button 4**:

- On nRF52840 DK, nRF5340 DK, and nRF21540 DK: Starts the NFC tag emulation,
enables Bluetooth LE advertising for the predefined period of time (15
minutes by default), and makes the device discoverable over Bluetooth LE.
This button is used during the commissioning procedure.

**Button 4** &mdash; Pressing the button once starts Bluetooth LE advertising
for the predefined period of time (15 minutes by default).
- On nRF7002 DK: Not available.

**SEGGER J-Link USB port** can be used to get logs from the device or
communicate with it using the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
&uart1 {
status = "disabled";
};
&gpio1 {
status = "disabled";
};
&i2c0 {
status = "disabled";
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* 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.
*/

/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# 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.
#

# This target uses Kconfig.hci_rpmsg.defaults to set options common for all
# samples using hci_rpmsg. This file should contain only options specific for this sample
# hci_rpmsg configuration or overrides of default values.

# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding
# in board files.

CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# 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.
#

# This target uses Kconfig.hci_rpmsg.defaults to set options common for all
# samples using hci_rpmsg. This file should contain only options specific for this sample
# hci_rpmsg configuration or overrides of default values.

# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding
# in board files.

CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# 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.
#

# This target uses Kconfig.hci_rpmsg.defaults to set options common for all
# samples using hci_rpmsg. This file should contain only options specific for this sample
# hci_rpmsg configuration or overrides of default values.

# Disable not used modules that cannot be set in Kconfig.hci_rpmsg.defaults due to overriding
# in board files.

CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n
Loading

0 comments on commit 2465016

Please sign in to comment.