Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Thread: created types page, moved sed vs ssed #11410

Merged
merged 1 commit into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/nrf/links.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
.. _`nRF52820 CMakeLists.txt`: https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/arm/nrf52833dk_nrf52820/CMakeLists.txt

.. _`OpenThread CLI Reference`: https://github.com/openthread/openthread/blob/main/src/cli/README.md
.. _`OpenThread CLI Reference - csl command`: https://github.com/openthread/openthread/blob/main/src/cli/README.md#csl
.. _`OpenThread CLI Reference - pollperiod command`: https://github.com/openthread/openthread/blob/main/src/cli/README.md#pollperiod
.. _`Commissioner CLI commands`: https://github.com/openthread/openthread/blob/main/src/cli/README_COMMISSIONER.md
.. _`Joiner CLI commands`: https://github.com/openthread/openthread/blob/main/src/cli/README_JOINER.md

Expand Down Expand Up @@ -824,6 +826,10 @@

.. _`OpenThread CoAP API`: https://openthread.io/reference/group/api-coap

.. _`IPv6 multicast addressing`: https://openthread.io/guides/thread-primer/ipv6-addressing#multicast

.. _`Joining an existing Thread network`: https://openthread.io/guides/thread-primer/network-discovery#join_an_existing_network

.. ### Source: threadgroup.*

.. _`Thread Group`: https://www.threadgroup.org
Expand Down
133 changes: 133 additions & 0 deletions doc/nrf/protocols/thread/device_types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
.. _thread_device_types:

Thread device types
###################

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

Thread devices can be either Full Thread Devices (FTD) or Minimal Thread Devices (MTD).
The devices are divided based on their ability to exist in a network without a parent, determined by whether the device maintains a routing table (doesn't need a parent) or not (needs a parent).
FTDs are the devices that maintain a routing table, while MTDs do not, forwarding all their messages to a parent instead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FTDs may also be in a "Child" state in the Thread network - forwarding all their messages to parent. I guess this sentence might be differently understood.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I leave it up to @pjasinski990 if we want to mention this child state and where.


Another type of Thread device classification is based on the device's ability to route messages:

* Routers can route messages, and they can function as parents to other Thread devices.
* End Devices cannot route messages, and they cannot function as parents.

Based on this classification, FTDs can be either Routers or End Devices, while MTDs can only be End Devices.

For additional information about Thread device types, see the documentation for `Device Types on OpenThread portal`_.

.. _thread_types_ftd:

Full Thread Devices
*******************

In order to maintain the routing table, FTDs keep their radio on at all times.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main reason why FTDs (but in fact also MTDs (like MED or SED during attachment, scanning)) - is that they need to be ready to receive messages asynchronously (from other devices). Maintaining routing table is a separate topic.

An important difference between FTDs and MTDs is that FTDs subscribe to special "all-routers" multicast addresses (``ff02::2`` and ``ff03::2``, see `IPv6 multicast addressing`_).
Because of these reasons, they typically consume more power than MTDs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subscription to the address won't directly result in higher power consumption. I would not mixed these two things.

It is true that the due to keeping the radio on all the time, device consumes more power, and needs to be mains powered.


Full Thread Devices can be further divided into three categories:

* Router
* Full End Device (FED)
* Router Eligible End Device (REED)

.. list-table:: Full Thread Device categories
:widths: 15 10 10 15
:header-rows: 1

* -
- Router
- Full End Device
- Router Eligible End Device
* - Maintains a routing table
- Yes
- Yes
- Yes
* - Routes messages
- Yes
- No
- When working as a Router
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit misleading. When REED operates as Router then it is called Router. Basically you cannot build the Thread device to operate as "Router" or "REED" only.. device will be in one of these states depending on the network condition.

So here i would put: No

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, maybe it would be worth to change this section a bit.

From roles perspective FTD can be either:

  • REED / Router / Leader (any of these depending on the network topology)
  • FED (which effectively is always a child)

By reading this section, i have an impression that it is possible to configure device to be a REED or Router (Active Router).

* - Can extend the network
- Yes
- No
- When working as a Router
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is also controversial like one above.


Routers can be regarded as the backbone of a Thread network.
They maintain the routing table and forward messages to other devices.
Routers, unlike End Devices, can also be used to extend the network range and a Router is required for a Minimal End Device to join the network.
The maximum number of Routers in a single Thread network is 32.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"active Router"


FEDs maintain a routing table, but they can't route messages.
This means they don't require a parent (Router) to function, but they cannot become parents themselves.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. FEDs operate as End Devices and require parent (Router) to function.


REEDs maintain a routing table and, unlike FEDs, they can become Routers if needed.
If a REED is the only device in range of an End Device trying to join the network, it will promote itself to a Router (see `Joining an existing Thread network`_ in the OpenThread documentation for more information).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe "it will proactively request promotion to a Router role" (REED may only request Leader for promotion)

Conversely, when a Router has no children it can downgrade itself to a REED.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true, but also simplification. The Thread specification provides a few other possibilities when Routers should downgrade to REED role. Basically it's all about the network topology, so maybe:

"Depending on the network topology conditions, Router may downgrade itself to a REED role (e.g. when does not have any children and sufficient number of routers are already in the network)."


.. _thread_types_mtd:

Minimal Thread Devices
**********************

Minimal Thread Devices (MTDs) are devices that do not maintain a routing table and are typically low-power devices that are not always on.
They can only be End Devices, and they always need a parent to function.
They forward all their messages to their parent.

Minimal Thread Devices can be further divided into three categories:

* Minimal End Device (MED)
* Sleepy End Device (SED)
* Synchronized Sleepy End Device (SSED)

.. list-table:: Minimal Thread Device categories
:widths: 15 10 10 15
:header-rows: 1

* -
- Minimal End Device
- Sleepy End Device
- Synchronized Sleepy End Device
* - Maintains a routing table
- No
- No
- No
* - Radio on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "Radio characteristic"
"Always enabled"
"Periodically enabled"

- Always
- Periodically
- Periodically
* - New messages
- Parent immediately forwards the messages
- The SED polls for new messages when it wakes up
- Parent forwards the messages during designated transmission window
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... or when SSED explicitly polls data.

* - No new messages
- No data transmission
- Parent indicates no pending messages
- No data transmission
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is true. However :) in order to keep synchronization, we need to send messages from time to time (to respect CSL timeout).

Update: I see you have mentioned that in some more detailed documentation.


MEDs are the most basic MTDs, and their radio is always on.
They don't keep a routing table, but otherwise operate like :ref:`FEDs <thread_types_ftd>`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not fully acurate. The difference between MTD and FTD is not about the routing table only. It's about certain functionalities/capabilites which FTD has, but MTD has not, like ability to resolve IPv6 addresses, handling address registration, maintaining routing table, maintaining links with neighbors and so on.


SEDs try to limit their power consumption by sleeping most of the time, waking up periodically to poll for messages from their parent.
After waking up, they send a data request to their parent.
If the parent has any pending messages, it will send them to the SED.
Otherwise, the parent will send a response indicating no pending messages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be worth to mention how SED and SSEDs transmit messages (not data polls) to parent e.g. that it may happen any time, since Routers have their radio enabled all the time.

SSEDs operate similarly to Sleepy End Devices, but they are synchronized with their parent.
They wake up at the same time as their parent, eliminating the need for polling for messages.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean that the parent "wakes up"? Parent never goes to sleep. It may may rather send the non-polled frame only in designated transmission window.

If the parent has messages for the SSED, it sends them during the designated transmission window.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice, often there might be more frames that are buffered on Router side. In such case the first frame is received in designated transmission window, but the rest are "pulled" using regular Data Polls (exactly like SED).

The SSED allows the transmission to finish if radio activity is detected during the transmission window.
Conversely, if there is no radio activity during the specified duration of transmission window, this indicates that the parent has no messages for the SSED and the SSED returns to sleep.
The SSED synchronization results in lower power consumption compared to an SED, primarily because the SSED doesn't need to poll for messages, keeping transmission windows short.

For more information about SSED activity, see the :ref:`thread_sed_ssed` page.

.. _thread_types_configuring:

Type configuration
******************

See :ref:`thread_ug_device_type` for information about how to configure Thread device type.
2 changes: 2 additions & 0 deletions doc/nrf/protocols/thread/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ You can find more information about Thread on the `Thread Group`_ pages.
prebuilt_libs
tools
certification
device_types
sed_ssed
21 changes: 1 addition & 20 deletions doc/nrf/protocols/thread/overview/commissioning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,26 +78,7 @@ Minimal Thread Device (MTD)
A SSED is an enhanced SED.
It transmits less data than SED and relies on receiving messages from its parent only in specified time intervals.

For more information, see `Device Types on OpenThread portal`_.

SED vs SSED activity
--------------------

.. thread_ssed_description_start

A Thread Synchronized Sleepy End Device (SSED) is synchronized with its parent router and uses the radio only at scheduled intervals, by using the Coordinated Sampled Listening (CSL) feature introduced as one of `Thread 1.2 Base Features`_.
During those intervals, the device waits for the router to send it any data related to the desired device activity.
The SSED does require sending packets occasionally to keep synchronization with the router.
However, unlike a regular SED, an SSED does not actively communicate with the router by polling and goes into the idle mode in-between the scheduled activity periods.
If there is no application-related traffic for a longer period of time, the SSED sends a data poll request packet to synchronize with the parent.
Overall, the SSED features further reduce energy consumption of the device and generate less data traffic compared to a standard Thread SED.

.. figure:: images/thread_sed_ssed_comparison.svg
:alt: Comparison of Thread SED and Thread SSED radio activity

Comparison of Thread SED and Thread SSED radio activity

.. thread_ssed_description_end
For more information, see the :ref:`thread_device_types` page.

.. _thread_ot_commissioning_types:

Expand Down
2 changes: 2 additions & 0 deletions doc/nrf/protocols/thread/overview/supported_features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ For more information about this Thread version, see the official `Thread 1.2 in
.. note::
See :ref:`thread_ug_thread_specification_options` for the list of 1.2 features that are currently available in |NCS|.

.. _thread_ug_supported_features_csl:

Coordinated Sampled Listening (CSL)
===================================

Expand Down
64 changes: 64 additions & 0 deletions doc/nrf/protocols/thread/sed_ssed.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
.. _thread_sed_ssed:

Sleepy End Device types in Thread
#################################

Sleepy End Devices (SEDs) and Synchronized Sleepy End Devices (SSEDs) are both Minimal Thread Devices (MTDs).
Unlike Full Thread Devices (FTDs), MTDs do not maintain a routing table and are typically low-power devices that are not always on.

For more information, see the :ref:`thread_types_mtd` section in the :ref:`thread_device_types` documentation.

Sleepy End Device
*****************

SEDs are MTDs that sleep most of the time in order to minimize the power consumption.
They communicate with the Thread network by occasionally polling the parent Router for any pending data.

The :kconfig:option:`CONFIG_OPENTHREAD_POLL_PERIOD` Kconfig handles the SED configuration by configuring the polling period.
A higher polling frequency results in lower latency (better responsiveness), but also higher power consumption.

The polling period can also be configured in runtime.
See the ``pollperiod`` command in the OpenThread `CLI reference <OpenThread CLI Reference - pollperiod command>`_.

Synchronized Sleepy End Device
******************************

SSEDs are MTDs that are further optimized for power consumption.
A Thread SSED is synchronized with its parent Router and uses the radio only at scheduled intervals.
It does this by using the :ref:`thread_ug_supported_features_csl` feature (introduced as one of the `Thread 1.2 Base Features`_).
During those intervals, the device waits for the Router to send it any data related to the desired device activity.
This reduces the network traffic (since there is no polling) and the power consumption (since the radio is off most of the time).

An SSED does require sending packets occasionally to keep synchronization with the Router.
However, unlike a regular SED, an SSED does not actively communicate with the Router by polling and it goes into the idle mode between the scheduled activity periods.
If there is no application-related traffic for an extended period of time, the SSED sends a data poll request packet to synchronize with the parent.

The |NCS| provides the following Kconfig options that let you enable CSL and specify the CSL parameters:

* :kconfig:option:`CONFIG_OPENTHREAD_CSL_RECEIVER` - Enables SSED child mode.
* :kconfig:option:`CONFIG_OPENTHREAD_CSL_AUTO_SYNC` - Enables the CSL autosynchronization feature.
* :kconfig:option:`CONFIG_OPENTHREAD_CSL_TIMEOUT` - Sets the default CSL timeout in seconds.
* :kconfig:option:`CONFIG_OPENTHREAD_CSL_CHANNEL` - Sets the default CSL channel.
This option corresponds to the ``csl channel`` CLI parameter.

The following Kconfig options affect the size of the receive window, and thus also affect the device's power consumption:

* :kconfig:option:`CONFIG_OPENTHREAD_CSL_RECEIVE_TIME_AHEAD` - Sets the CSL receiver wake up margin in microseconds.
* :kconfig:option:`CONFIG_OPENTHREAD_MIN_RECEIVE_ON_AHEAD` - Sets the minimum receiving time before start of MAC header.
* :kconfig:option:`CONFIG_OPENTHREAD_MIN_RECEIVE_ON_AFTER` - Sets the minimum receiving time after start of MAC header.
* :kconfig:option:`CONFIG_OPENTHREAD_PLATFORM_CSL_UNCERT` - Sets the fixed uncertainty of the device for scheduling CSL Transmissions in units of 10 microseconds.

Additionally, you must configure the ``period`` CLI parameter to enable CSL.
For more information on using the CLI to configure parameters for CSL, see the ``csl`` command in the OpenThread `CLI reference <OpenThread CLI Reference - csl command_>`_.

Comparison of SED and SSED
**************************

Compared to an SED, an SSED has no drawbacks for transmission and provides reduced power consumption and network traffic.
This means you should configure your SED devices as SSEDs whenever possible.
Comment on lines +57 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would definitely not advise to use SSED always but only for cases where we need a small latency (small csl interval) and want to have similar or smaller power consumption than SED has (e.g. window coverings). For sensors that report a new measurement each e.g. 30-60 seconds, is it justified to use CSL?

The common misconception is that SSED role is just better version of SED role. This is not true, it was designed for specific use cases and I would still expect vast majority of devices to use SED role rather than SSED role.

@edmont could you comment here? I would like to provide a clear recommendation when usage of SSED is better. Unfortunately, we need to account the possibility of being a child of a router that has very large uncertainty - which would make solution much worse than SED.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general e.g. from HomeKit or Matter perspective, it would be great that potential user will read this section and will be able to choose the SED or SSED role depending on its device type / communication patters.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree, SSEDs are not intended to fully replace SEDs. As a rule of thumb it would be beneficial (in terms of energy and spectrum usage) to used SSEDs when the application requires to poll more often than 20 seconds. But this depends on many factors, like routers CSL Accuracy. KRKNWK-13546 should address this topic more in detail.

You can see the difference in power consumption on the :ref:`Thread power consumption <thread_power_consumption>` page.

.. figure:: overview/images/thread_sed_ssed_comparison.svg
:alt: Comparison of Thread SED and Thread SSED radio activity

Comparison of Thread SED and Thread SSED radio activity
5 changes: 4 additions & 1 deletion doc/nrf/releases/release-notes-changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -427,4 +427,7 @@ cJSON
Documentation
=============

* Added a page on :ref:`ug_wireless_coexistence` in :ref:`protocols`.
Added:

* A page on :ref:`ug_wireless_coexistence` in :ref:`protocols`.
* Pages on :ref:`thread_device_types` and :ref:`thread_sed_ssed` to the :ref:`ug_thread` documentation.
Comment on lines +430 to +433
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be featured in Protocols/Thread section, actually.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was kind of 50/50 on it, seeing as it's purely a documentation addition.

16 changes: 13 additions & 3 deletions samples/matter/window_covering/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,19 @@ SSED device type

The SSED device type was created for the window covering devices to optimize the power usage of the device and communication pattern with the parent.

.. include:: /protocols/thread/overview/commissioning.rst
:start-after: thread_ssed_description_start
:end-before: thread_ssed_description_end
A Thread Synchronized Sleepy End Device (SSED) is synchronized with its parent router and uses the radio only at scheduled intervals, by using the :ref:`thread_ug_supported_features_csl` feature introduced as one of the `Thread 1.2 Base Features`_.
During those intervals, the device waits for the router to send it any data related to the desired device activity.
The SSED does require sending packets occasionally to keep synchronization with the router.
However, unlike a regular SED, an SSED does not actively communicate with the router by polling and goes into the idle mode between the scheduled activity periods.
If there is no application-related traffic for an extended period of time, the SSED sends a data poll request packet to synchronize with the parent.
Compared to a standard SED, the SSED features further reduce energy consumption of the device and generate less data traffic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"MAY further reduce energy" - it's not granted ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"MAY further reduce energy" - it's not granted ;)


.. figure:: ../../../doc/nrf/protocols/thread/overview/images/thread_sed_ssed_comparison.svg
:alt: Comparison of Thread SED and Thread SSED radio activity

Comparison of Thread SED and Thread SSED radio activity

See the :ref:`thread_sed_ssed` page for more information.

Sample testing
==============
Expand Down