Skip to content

Commit

Permalink
samples: dect: add simple sample
Browse files Browse the repository at this point in the history
Add simple dect sample.

Signed-off-by: Eivind Jølsgard <eivind.jolsgard@nordicsemi.no>
  • Loading branch information
eivindj-nordic committed Apr 29, 2024
1 parent 94aeb08 commit 50334a2
Show file tree
Hide file tree
Showing 8 changed files with 531 additions and 0 deletions.
12 changes: 12 additions & 0 deletions samples/dect/dect_phy/hello_dect/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(hello_dect)

target_sources(app PRIVATE src/main.c)
52 changes: 52 additions & 0 deletions samples/dect/dect_phy/hello_dect/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

config CARRIER
int "Carrier to use"
default 0
help
The availability of the channels and the exact regulation to use them varies in different countries.
See ETSI TS 103 636-2 5.4.2 for the calculation.

config NETWORK_ID
int "Network ID"
range 1 4294967295
default 91

config MCS
int "MCS"
default 1
help
The MCS impacts how much data can be fit into each subslot.

config TX_POWER
int "TX power"
range 0 11
default 11
help
Transmission power, see table 6.2.1-3 of ETSI TS 103 636-4.

config TX_TRANSMISSIONS
int "TX transmissions"
range 0 4294967295
default 30
help
Transmissions before sample exits, use 0 to transmit forever.

config RX_PERIOD_S
int "RX period"
default 5
help
Receive window period.
Time is given in seconds.

module = DECT_PHY_HELLO
module-str = DECT NR+ PHY Hello
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"

menu "Zephyr Kernel"
source "Kconfig.zephyr"
endmenu
131 changes: 131 additions & 0 deletions samples/dect/dect_phy/hello_dect/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
.. _nrf_modem_dect_phy_hello:

nRF91x1: DECT NR+ PHY hello sample
##################################

.. contents::
:local:
:depth: 2

This sample demonstrates how to set up a simple DECT NR+ application with the DECT PHY modem firmware.



Requirements
************

The sample needs at least two nRF91x1 Development Kits.

See :ref:`nrf91x1_ug_intro` for more details.

.. note::

The :ref:`nrf_modem_dect_phy_simple` requires the DECT NR+ PHY modem firmware to run on the nRF91x1 modem core. Please contact our sales department to know more.


.. include:: /includes/tfm.txt

Overview
********

The sample shows a simple broadcast and reception of DECT NR+ messages between devices on a hard-coded channel.

After initialization the devices will run a loop, transmitting a counter value before listening for incoming receptions. The time to listen is given by the :kconfig:option:`CONFIG_RX_PERIOD_S` Kconfig option.
The loop is exited after a number of transmissions given by the :kconfig:option:`CONFIG_TX_TRANSMISSIONS` Kconfig option, or continue forever if the :kconfig:option:`CONFIG_TX_TRANSMISSIONS` Kconfig option is ``0``.

Each device can be reset to run the sample again.

Building and running
********************

.. |sample path| replace:: :file:`samples/modem_trace_flash`

.. include:: /includes/build_and_run_ns.txt

.. important::

DECT NR+ operates on free but regulated radio channels. The regulation and availability of the channels varies in different countries.
It is your responsibility to operate the devices according to the local regulation, both at the development site and the device operation regions.
If you are in the EU and US, you can use the ``overlay-eu.conf`` and ``overlay-us.conf``Kconfig overlays respectively.
Otherwise set the carrier using the :kconfig:option:`CONFIG_CARRIER` Kconfig option.
Testing
=======
|test_sample|
After programming the sample to your development kits, test it by performing the following steps:
#. |connect_kit|
#. |connect_terminal|
#. Observe that the devices will transmit a counter value that is received by the other devices.
#. After a given number of transmissions, observe that the devices shut down and exit the sample.
Sample output
=============
The sample shows an output similar to the following:
Device 1:
.. code-block:: console
*** Booting nRF Connect SDK v3.5.99-ncs1 ***
[00:00:00.378,784] <inf> app: Dect NR+ PHY Hello sample started
[00:00:00.691,375] <inf> app: Dect NR+ PHY initialized, device ID: 12345
[00:00:00.691,406] <inf> app: Transmitting 0
[00:00:05.697,784] <inf> app: Transmitting 1
[00:00:10.704,193] <inf> app: Transmitting 2
[00:00:14.186,553] <inf> app: Received header from device ID 67890
[00:00:14.186,889] <inf> app: Received data (RSSI: -54.5): Hello DECT! 0
[00:00:15.710,571] <inf> app: Transmitting 3
[00:00:19.192,932] <inf> app: Received header from device ID 67890
[00:00:19.193,267] <inf> app: Received data (RSSI: -54.5): Hello DECT! 1
[00:00:20.716,949] <inf> app: Transmitting 4
...
[00:02:24.352,661] <inf> app: Received header from device ID 67890
[00:02:24.352,996] <inf> app: Received data (RSSI: -54.5): Hello DECT! 26
[00:02:25.876,739] <inf> app: Transmitting 29
[00:02:25.876,831] <inf> app: Reached maximum number of transmissions (30)
[00:02:25.876,831] <inf> app: Shutting down
[00:02:25.893,554] <inf> app: Bye!
Device 2:
.. code-block:: console
*** Booting nRF Connect SDK v3.5.99-ncs1 ***
[00:00:00.407,287] <inf> app: Dect NR+ PHY Hello sample started
[00:00:00.719,238] <inf> app: Dect NR+ PHY initialized, device ID: 67890
[00:00:00.719,268] <inf> app: Transmitting 0
[00:00:02.254,211] <inf> app: Received header from device ID 12345
[00:00:02.254,547] <inf> app: Received data (RSSI: -54.5): Hello DECT! 3
[00:00:05.725,646] <inf> app: Transmitting 1
[00:00:07.260,620] <inf> app: Received header from device ID 12345
[00:00:07.260,955] <inf> app: Received data (RSSI: -54.5): Hello DECT! 4
...
[00:02:10.885,284] <inf> app: Transmitting 26
[00:02:12.420,318] <inf> app: Received header from device ID 12345
[00:02:12.420,654] <inf> app: Received data (RSSI: -54.5): Hello DECT! 29
[00:02:15.891,693] <inf> app: Transmitting 27
[00:02:20.898,071] <inf> app: Transmitting 28
[00:02:25.904,449] <inf> app: Transmitting 29
[00:02:25.904,541] <inf> app: Reached maximum number of transmissions (30)
[00:02:25.904,571] <inf> app: Shutting down
[00:02:25.921,325] <inf> app: Bye!
Dependencies
************
It uses the following `sdk-nrfxlib`_ libraries:
* :ref:`nrfxlib:nrf_modem`
It uses the following Zephyr libraries:
* :ref:`zephyr:uart_api`
In addition, it uses the following secure firmware components:
* :ref:`Trusted Firmware-M <ug_tfm>`
1 change: 1 addition & 0 deletions samples/dect/dect_phy/hello_dect/overlay-eu.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_CARRIER=1702
1 change: 1 addition & 0 deletions samples/dect/dect_phy/hello_dect/overlay-us.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_CARRIER=1677
6 changes: 6 additions & 0 deletions samples/dect/dect_phy/hello_dect/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CONFIG_NRF_MODEM_LIB=y

CONFIG_NRF_MODEM_LINK_BINARY_DECT_PHY=y
CONFIG_HWINFO=y

CONFIG_LOG=y
9 changes: 9 additions & 0 deletions samples/dect/dect_phy/hello_dect/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sample:
name: Dect NR+ PHY Hello
tests:
sample.nrf9161.dect_phy_hello:
build_only: true
integration_platforms:
- nrf9161dk_nrf9161_ns
platform_allow: nrf9161dk_nrf9161_ns
tags: ci_build
Loading

0 comments on commit 50334a2

Please sign in to comment.