<?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>Openthread Disconnect by Router / Parent  Handling</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114668/openthread-disconnect-by-router-parent-handling</link><description>Hello, 
 
 We use nrf-connect-sdk v1.9.1 (Zephyr v2.7 LTS) 
 
 We have a set of network devices. Both routers as sleepy-end-devices. 
 The sleepy-end-devices connect to the network and stay in connected state as sleepy-end-devices. 
 
 However when we</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 18 Sep 2024 14:01:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114668/openthread-disconnect-by-router-parent-handling" /><item><title>RE: Openthread Disconnect by Router / Parent  Handling</title><link>https://devzone.nordicsemi.com/thread/502957?ContentTypeID=1</link><pubDate>Wed, 18 Sep 2024 14:01:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75fce195-b5bb-46c6-98f3-3c2926586235</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure if I fully understand the case, I&amp;#39;ve tried to reproduce the issue with our CLI sample on NCS v1.9.1.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve added a function in the main.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void on_thread_state_changed(uint32_t flags, void *context)
{
  struct openthread_context *ot_context = context;

  if (flags &amp;amp; OT_CHANGED_THREAD_ROLE) {
    LOG_WRN(&amp;quot;Thread state changed! new state: %d&amp;quot;,otThreadGetDeviceRole(ot_context-&amp;gt;instance));
  }

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;in &lt;code&gt;main()&lt;/code&gt; I&amp;#39;ve added setting the callback:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;openthread_set_state_changed_cb(on_thread_state_changed);&lt;/pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;And built the sample with&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;pre class="ui-code" data-mode="text"&gt;west build -p -b nrf52840dk_nrf52840 -- -DOVERLAY_CONFIG=&amp;quot;overlay-logging.conf;overlay-rtt.conf&amp;quot;&lt;/pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;After flashing I&amp;#39;ve joined the network as SED (leader has been set up earlier with matching credentials):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ot mode n

ot channel 23

ot panid 0xabcd

ot networkkey  00112233445566778899aabbccddeeaa

ot pollperiod 1000

ot ifconfig up

ot thread start&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And as expected, I get&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;wrn&amp;gt; cli_sample: Thread state changed! new state: 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;when starting interface, and&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;wrn&amp;gt; cli_sample: Thread state changed! new state: 2&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;when device attaches as child.&lt;/p&gt;
&lt;p&gt;Later I switch power off on parent. Devicediscovers that it gets no ack for data requests, and changes state to detached:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;wrn&amp;gt; cli_sample: Thread state changed! new state: 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Could you confirm this is the behavior you want to achieve?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Openthread Disconnect by Router / Parent  Handling</title><link>https://devzone.nordicsemi.com/thread/502306?ContentTypeID=1</link><pubDate>Thu, 12 Sep 2024 12:44:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19e42a95-ec8b-489c-aaa5-c701070cf7bf</guid><dc:creator>MauriceWillemsen</dc:creator><description>&lt;p&gt;Further, I enabled&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div style="padding-left:30px;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_OPENTHREAD_PARENT_SEARCH=y
CONFIG_OPENTHREAD_PARENT_SEARCH_BACKOFF_INTERVAL=60
CONFIG_OPENTHREAD_PARENT_SEARCH_CHECK_INTERVAL=60&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;So the end device is nicely switching between Routers. However when I force unpower the current parent router, it still sticks to this router as parent. And it never switches to another. Remaining in connected state to a non existing router.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;There is no receiver parent response from the non-existing router but it has its rssi still in memory&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;[01:26:48.826,934] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: PeriodicParentSearch: Backoff interval passed
[01:26:48.827,026] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: PeriodicParentSearch: Parent RSS -70
[01:26:48.827,117] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: PeriodicParentSearch: Parent RSS less than -65, searching for new parents
[01:26:48.827,209] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: AttachState Idle -&amp;gt; Start
[01:26:48.827,362] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: PeriodicParentSearch: (Re)starting timer for backoff interval
[01:26:48.828,399] &amp;lt;inf&amp;gt; net_openthread: [NOTE]-MLE-----: Attempt to attach - any-partition 
[01:26:48.828,491] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: AttachState Start -&amp;gt; ParentReqRouters
[01:26:48.829,833] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: Send Parent Request to routers (ff02:0:0:0:0:0:0:2)
[01:26:48.834,014] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----: Sent IPv6 UDP msg, len:84, chksum:f285, to:0xffff, sec:no, prio:net
[01:26:48.834,259] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     src:[fe80:0:0:0:a442:8846:7c09:4b23]:19788
[01:26:48.834,472] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     dst:[ff02:0:0:0:0:0:0:2]:19788
[01:26:49.288,299] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----: Received IPv6 UDP msg, len:129, chksum:8c4e, from:1ae86dd51a931d4f, sec:no, prio:net, rss:-80.0
[01:26:49.288,543] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     src:[fe80:0:0:0:18e8:6dd5:1a93:1d4f]:19788
[01:26:49.288,757] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     dst:[fe80:0:0:0:a442:8846:7c09:4b23]:19788
[01:26:49.289,825] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: Receive Parent Response (fe80:0:0:0:18e8:6dd5:1a93:1d4f,0x1c00)
[01:26:49.332,672] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----: Received IPv6 UDP msg, len:129, chksum:17ab, from:2e3bed05f5b5733c, sec:no, prio:net, rss:-76.0
[01:26:49.332,885] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     src:[fe80:0:0:0:2c3b:ed05:f5b5:733c]:19788
[01:26:49.333,129] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     dst:[fe80:0:0:0:a442:8846:7c09:4b23]:19788
[01:26:49.334,136] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: Receive Parent Response (fe80:0:0:0:2c3b:ed05:f5b5:733c,0x5c00)
[01:26:49.386,596] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----: Received IPv6 UDP msg, len:84, chksum:dfe3, from:9620d37e01240941, sec:no, prio:net, rss:-55.0
[01:26:49.386,840] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     src:[fe80:0:0:0:9420:d37e:124:941]:19788
[01:26:49.387,054] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     dst:[ff02:0:0:0:0:0:0:2]:19788
[01:26:49.580,017] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: AttachState ParentReqRouters -&amp;gt; ParentReqReeds
[01:26:49.581,024] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: Send Parent Request to routers and REEDs (ff02:0:0:0:0:0:0:2)
[01:26:49.586,151] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----: Sent IPv6 UDP msg, len:84, chksum:4270, to:0xffff, sec:no, prio:net
[01:26:49.586,395] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     src:[fe80:0:0:0:a442:8846:7c09:4b23]:19788
[01:26:49.586,608] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     dst:[ff02:0:0:0:0:0:0:2]:19788
[01:26:49.959,503] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----: Received IPv6 UDP msg, len:129, chksum:c9c5, from:2e3bed05f5b5733c, sec:no, prio:net, rss:-76.0
[01:26:49.959,716] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     src:[fe80:0:0:0:2c3b:ed05:f5b5:733c]:19788
[01:26:49.959,960] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     dst:[fe80:0:0:0:a442:8846:7c09:4b23]:19788
[01:26:49.960,968] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: Receive Parent Response (fe80:0:0:0:2c3b:ed05:f5b5:733c,0x5c00)
[01:26:50.165,283] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----: Received IPv6 UDP msg, len:129, chksum:0136, from:1ae86dd51a931d4f, sec:no, prio:net, rss:-79.0
[01:26:50.165,527] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     src:[fe80:0:0:0:18e8:6dd5:1a93:1d4f]:19788
[01:26:50.165,771] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MAC-----:     dst:[fe80:0:0:0:a442:8846:7c09:4b23]:19788
[01:26:50.166,809] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: Receive Parent Response (fe80:0:0:0:18e8:6dd5:1a93:1d4f,0x1c00)
[01:26:50.831,237] &amp;lt;inf&amp;gt; net_openthread: [INFO]-MLE-----: AttachState ParentReqReeds -&amp;gt; Idle&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Openthread Disconnect by Router / Parent  Handling</title><link>https://devzone.nordicsemi.com/thread/502243?ContentTypeID=1</link><pubDate>Thu, 12 Sep 2024 08:27:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:298da203-dc72-4a1e-ac45-742e0aff1fa1</guid><dc:creator>MauriceWillemsen</dc:creator><description>&lt;p&gt;Thankyou for your answer,&lt;/p&gt;
&lt;p&gt;We are using that callback, which gives us state change handlers when connected to the network, or when we actively close&amp;nbsp;the&amp;nbsp;connection (stop openthread).&lt;/p&gt;
&lt;p&gt;However when the device is sleepy-end-device and we shut down from router side. The sleepy-end-device stays in last thread_role_changed&amp;nbsp;OT_DEVICE_ROLE_CHILD, without getting&amp;nbsp;event OT_DEVICE_ROLE_DETACHED ever.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Openthread Disconnect by Router / Parent  Handling</title><link>https://devzone.nordicsemi.com/thread/502186?ContentTypeID=1</link><pubDate>Wed, 11 Sep 2024 18:34:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f37eacea-0d63-497b-9e3d-6b151b11ce03</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Check out &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/108593/matter-thread-event-indicating-ready-to-update-status-and-status-confirmed-updated/470734"&gt;this post&lt;/a&gt;, but&amp;nbsp;the&amp;nbsp;&lt;span&gt;callback is registered by &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.9.1/samples/openthread/coap_client/src/coap_client_utils.c#L263C2-L263C33"&gt;openthread_set_state_changed_cb&lt;/a&gt;&lt;/span&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.9.1/samples/openthread/coap_client/src/coap_client_utils.c#L263C2-L263C33"&gt;&amp;nbsp;in&amp;nbsp;v1.9.1&lt;/a&gt;.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>