This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

OpenThread role change resets channel settings

Hello! Based on you example I try to develop a simple HelloWorld example that follows chapter 11 of the specification. It says that to form a network a energy scan should be performed. That works perfectly fine but during role changes, it's currently the only device, the channel get reset to 11.

Log output:

:INFO:Role changed: 2
:DEBUG:22
:INFO:Role changed: 5
:DEBUG:11

Is there a internal scan or something?

Edit: I seems that the role change uses channel data stored in non volatile memory and otLinkSetChannel() only writes there if the channel is not already set.

  • Hello Caspar, thank you for raising this issue!

    This might happen because of the Thread protocol itself. Before a node can join a Thread network, it must obtain all security/network credentials, that are called the Operational Dataset.

    In general, if your node has already attached to the network (and stored Operational Dataset), you should not change just one parameter like PANID or Channel and leave all others unchanged, since it violates Thread Network behavior.

    To change those parameters in an already created network, Thread uses a special way where the Commissioner registers new parameters (Pending Operational Dataset) at the Leader, which gradually disseminates those parameters across the network. This process requires a delay to ensure that all nodes in the network (including sleepy ones) obtain the new dataset on time.

    By using CLI, we can skip the commissioning process by providing Operational Dataset parameters like PANID or Channel from the command line (in out-of-band fashion). Some parameters are set to default values and you don’t need to provide them – for example Mesh-Local Prefix.

    If you are using our latest release of OpenThread libraries, you can change any of the commissioning parameters from command line (CLI). But, prior to Channel or PANID change, please execute the factoryreset command. It will simply remove all stored data, and let you change any parameters until the thread start command is called.

    Recently, this issue was raised on OpenThread and a new commit was applied 6 days ago: github.com/.../1586

    Thanks to this commit, it should be possible to change the network parameters from CLI and automatically clear stored Operational Dataset (as factoryreset does – but without actual chip reset).

Related