OpenThread/Zephyr CLI Command Reference - how to tell a device to forget a thread

231 views
Skip to first unread message

Joseph Flynn

unread,
Feb 23, 2022, 1:47:25 PM2/23/22
to openthread-users
In my bench-top testing I created a demo thread called OpenThreadDemo3.  Tinkered a bit on how to figure out how to get devices to join via the QR code and think I got it.

I created a new thread network called OpenThreadDemo4, generated join barcodes for my devices and can use the mobile app to join my new devices via qr-code.

Awesome!

But...

All of the devices that were formally part of the Demo3 network are still connecting to that old thread.  I imagine there is a ot cli command to tell that device to forget its old references to Demo3 and prepare for joining Demo4 but I can't seem to find a good reference.

For production, I'll need to program a button or give some way for the device to forget its old network so that it could listen for new ones.

Ideas on ways to forget a network in specific or more generally is there a reference for zephyr openthread CLI commands?

Thanks

Jonathan Hui

unread,
Feb 23, 2022, 1:54:47 PM2/23/22
to Joseph Flynn, openthread-users
OpenThread CLI has the factoryreset command, which typically deletes all Thread-related non-volatile storage and restarts the Thread stack.

I would check to see if Zephyr provides a factory-reset mechanism which deletes all non-volatile state.

--
Jonathan Hui



--
You received this message because you are subscribed to the Google Groups "openthread-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openthread-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/7a2e3386-f3f0-4ffa-b9d6-8f825871dc3bn%40googlegroups.com.

Joseph Flynn

unread,
Feb 23, 2022, 2:50:38 PM2/23/22
to openthread-users
That worked.  If I could bind any command to an on-board button with the intent to join a new network via a commissioner, do you think the "factoryreset" might be the best?

I'll keep looking for samples that might fit my use case.

All of the demos I have in my nrf sdk samples directory seem to use the hardcoded parameters/credentials.  I got the qr-code commission to work but only if the target device is NOT currently on a network.  And what makes it tough is that sometimes the device creates a new network of just itself.

Jonathan Hui

unread,
Feb 23, 2022, 3:01:26 PM2/23/22
to Joseph Flynn, openthread-users
On Wed, Feb 23, 2022 at 11:50 AM Joseph Flynn <jjfl...@gmail.com> wrote:
That worked.  If I could bind any command to an on-board button with the intent to join a new network via a commissioner, do you think the "factoryreset" might be the best?

I would look to see if Zephyr has any better recommendations that would cover the entire platform and not just OpenThread-specific pieces.

I'll keep looking for samples that might fit my use case.

All of the demos I have in my nrf sdk samples directory seem to use the hardcoded parameters/credentials.  I got the qr-code commission to work but only if the target device is NOT currently on a network.  And what makes it tough is that sometimes the device creates a new network of just itself.

Yes, in OpenThread, an FTD not configured to any network will create a new random network when starting Thread (see ActiveDataset::GenerateLocal()). This behavior exists for legacy product reasons. We have an existing effort to remove this behavior (see openthread/openthread#6091). In the meantime, you can try removing the call ActiveDataset::GenerateLocal() in ActiveDataset::StartLeader().

Hope that helps.

--
Jonathan Hui

Joseph Flynn

unread,
Feb 23, 2022, 3:01:37 PM2/23/22
to openthread-users

I think this user is on the same use case as me.  Wanting to join a new network in the best way.  https://groups.google.com/g/openthread-users/c/GIg2i5WYF9A .

Jonathan Hui

unread,
Feb 23, 2022, 3:21:23 PM2/23/22
to Joseph Flynn, openthread-users
Yes, setting the PANID and starting the Joiner process can work to join a new network, but it will not cause the device to forget the old network unless the Joiner process succeeds in obtaining new credentials from the new network. In other words, the Joiner process will overwrite the old Active Operational Dataset with a new one after obtaining new Thread credentials.

--
Jonathan Hui



Joseph Flynn

unread,
Feb 23, 2022, 3:34:26 PM2/23/22
to openthread-users
I'm using the qr-code method where I generate a qr based on the unique eiu64 and the PSKd and scan that from the external commissioner. 
The Joiner needs to be as HANDS-OFF as possible as I would not normally have a shell to work with where I can submit shell commands. All I would really have to work with is maybe a push-button.

Jonathan Hui

unread,
Feb 23, 2022, 3:36:14 PM2/23/22
to Joseph Flynn, openthread-users
The OpenThread CLIs are just making calls to OpenThread APIs. You can update your code to call the appropriate OpenThread APIs at the appropriate time (e.g. in response to a push button press).

--
Jonathan Hui



Reply all
Reply to author
Forward
0 new messages