<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Configuring openthread with random panid, channel</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95647/configuring-openthread-with-random-panid-channel</link><description>We are using: 
 NCS v1.9.1 nRF52840 openthread 
 We expect to operate in an environment with other Thread networks. So, we would like to randomize the network credentials, and be able to change channels based on the environment. 
 Issue 1: 
 This application</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 26 Jan 2023 06:50:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95647/configuring-openthread-with-random-panid-channel" /><item><title>RE: Configuring openthread with random panid, channel</title><link>https://devzone.nordicsemi.com/thread/406569?ContentTypeID=1</link><pubDate>Thu, 26 Jan 2023 06:50:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da394f1f-94ee-4ab8-a3a2-bc183229448b</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi Mary,&lt;/p&gt;
&lt;p&gt;That is great to hear, and thank you for sharing your solution!&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configuring openthread with random panid, channel</title><link>https://devzone.nordicsemi.com/thread/406558?ContentTypeID=1</link><pubDate>Wed, 25 Jan 2023 22:01:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a046838-a0a5-447e-bafc-9acb56d0006e</guid><dc:creator>Mary</dc:creator><description>&lt;p&gt;I was able to achieve what I wanted for Issue 1 with this code at startup:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    // Network parameters
	otOperationalDataset dataset;
	if (!otDatasetIsCommissioned(openthread_get_default_context()))
	{
		printk(&amp;quot;Thread not commissioned. Creating dataset.\r\n&amp;quot;);
		otDatasetCreateNewNetwork(openthread_get_default_context(), &amp;amp;dataset);

		// Form a network name 
		snprintk(dataset.mNetworkName.m8, sizeof(dataset.mNetworkName.m8), &amp;quot;MyNetwork&amp;quot;);
		dataset.mComponents.mIsNetworkNamePresent = true;
		otDatasetSetActive(openthread_get_default_context(), &amp;amp;dataset);
	}

	error = otDatasetGetActive(openthread_get_default_context(), &amp;amp;dataset);
	printk(&amp;quot;Active Dataset: \r\n&amp;quot;);
	if (dataset.mComponents.mIsNetworkNamePresent)
    {
        printk(&amp;quot;Network Name: &amp;quot;);
        printk(&amp;quot;%s \r\n&amp;quot;, dataset.mNetworkName.m8);
    }
	if (dataset.mComponents.mIsChannelPresent)
    {
        printk(&amp;quot;Channel: %d \r\n&amp;quot;, dataset.mChannel);
    }
	if (dataset.mComponents.mIsPanIdPresent)
    {
        printk(&amp;quot;PAN ID: 0x%04x \r\n&amp;quot;, dataset.mPanId);
    }

	openthread_set_state_changed_cb(on_thread_state_changed);
	openthread_start(openthread_get_default_context());&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I did several factory resets, and each time the channel, panid, and networkkey were different.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Mary&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configuring openthread with random panid, channel</title><link>https://devzone.nordicsemi.com/thread/404955?ContentTypeID=1</link><pubDate>Mon, 16 Jan 2023 08:41:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9aaea9d0-bfd7-4c4b-8677-3504755ab8a3</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi Mary,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue 1&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For this you can use operational datasets. The PAN ID, network key, channel, etc. that are currently in use in the Thread network are part of the active operational dataset. So you can generate a new dataset at startup. For more information you can check out &lt;a href="https://github.com/nrfconnect/sdk-openthread/blob/main/src/cli/README_DATASET.md"&gt;OpenThread CLI - Operational Datasets&lt;/a&gt;. This is the API for dataset related CLI commands, but it will show you examples of how to use datasets and what is possible. If you want to see the implementations of the different commands you can take a look at &lt;a href="https://github.com/nrfconnect/sdk-openthread/blob/main/src/cli/cli_dataset.cpp"&gt;cli_dataset.cpp&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Issue 2&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You can use datasets for this as well. Here I have changed the channel after the network has started using CLI commands:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;uart:~$ ot ifconfig up&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Done&lt;/code&gt;&lt;br /&gt;&lt;code&gt;uart:~$ ot thread start&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Done&lt;/code&gt;&lt;br /&gt;&lt;code&gt;uart:~$ ot channel&lt;/code&gt;&lt;br /&gt;&lt;code&gt;17&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Done&lt;/code&gt;&lt;br /&gt;&lt;code&gt;uart:~$ ot dataset channel 18&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Done&lt;/code&gt;&lt;br /&gt;&lt;code&gt;uart:~$ ot dataset&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Active Timestamp: 1&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Channel: 18&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Channel Mask: 0x07fff800&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Ext PAN ID: 4e0df2adca0185e4&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Mesh Local Prefix: fdd0:8846:7301:7fb1::/64&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Network Key: 206a5182b5ce9c288d2035ece9f5cc54&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Network Name: OpenThread-15f2&lt;/code&gt;&lt;br /&gt;&lt;code&gt;PAN ID: 0x15f2&lt;/code&gt;&lt;br /&gt;&lt;code&gt;PSKc: 213933f7273435e7a3c9dd833660b53b&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Security Policy: 672 onrc&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Done&lt;/code&gt;&lt;br /&gt;&lt;code&gt;uart:~$ ot channel&lt;/code&gt;&lt;br /&gt;&lt;code&gt;17&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Done&lt;/code&gt;&lt;br /&gt;&lt;code&gt;uart:~$ ot dataset commit active&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Done&lt;/code&gt;&lt;br /&gt;&lt;code&gt;uart:~$ ot channel&lt;/code&gt;&lt;br /&gt;&lt;code&gt;18&lt;/code&gt;&lt;br /&gt;&lt;code&gt;Done&lt;/code&gt;&lt;/p&gt;
[quote user=""]Do the other devices on the network also change channels if one device does?&amp;nbsp; [/quote]
&lt;p&gt;No, they will not automatically change channels. This is something you must implement in your application.&lt;/p&gt;
[quote user=""]What happens to SEDs when an FTD changes the selected channel?[/quote]
&lt;p&gt;If the FTD is the SED&amp;#39;s parent, the SED&amp;nbsp; will realize that it has lost connection to it&amp;#39;s parent and initiate MLE Attach to try to reattach to the parent or another parent router.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Configuring openthread with random panid, channel</title><link>https://devzone.nordicsemi.com/thread/404860?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2023 16:33:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d68cbd8d-86ad-4182-9aa7-dbe9bdbcfe1a</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Mary,&lt;/p&gt;
&lt;p&gt;I have started looking into your issue, and will get back to you on Monday.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>