<?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>Using OpenThread and ESB Together on nRF52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/109475/using-openthread-and-esb-together-on-nrf52840</link><description>Hello everyone, 
 I&amp;#39;m currently working on a project using the nRF52840dk, where I&amp;#39;m trying to use both OpenThread and ESB together. 
 However, I&amp;#39;ve encountered a couple of issues that I&amp;#39;m hoping to get some insights on. 
 1. Build Error with CONFIG_ESB</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 Mar 2024 17:38:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/109475/using-openthread-and-esb-together-on-nrf52840" /><item><title>RE: Using OpenThread and ESB Together on nRF52840</title><link>https://devzone.nordicsemi.com/thread/475455?ContentTypeID=1</link><pubDate>Fri, 22 Mar 2024 17:38:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70fd4d91-09dd-4c53-93e8-d2a0f7c8b54d</guid><dc:creator>Shi</dc:creator><description>&lt;p&gt;&lt;span&gt;Following the tests, I encountered an issue where the ESB program from the BLE+ESB demo mentioned previously could not function properly. Specifically, after disabling ESB and then starting OpenThread, the application would consistently trigger the RADIO_IRQn associated with the ESB connection, leading to the application freezing. The root cause was identified as the failure to restore OpenThread&amp;#39;s MPSL interrupt bindings after shutting down ESB. The relevant code for this operation is found within the&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;code&gt;mpsl_lib_init()&lt;/code&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;function.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Taking inspiration from the BLE implementation, I attempted to call&amp;nbsp;&lt;strong&gt;&lt;code&gt;mpsl_lib_uninit()&lt;/code&gt;&lt;/strong&gt;&amp;nbsp;before starting ESB and&amp;nbsp;&lt;strong&gt;&lt;code&gt;mpsl_lib_init()&lt;/code&gt;&lt;/strong&gt;&amp;nbsp;after shutting it down. However, this approach resulted in an &lt;span style="text-decoration:underline;"&gt;&amp;quot;mpsl_init: MPSL ASSERT: 107, 271&amp;quot;&lt;/span&gt; error, which seems to be related to clock settings.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Further debugging revealed that it was unnecessary to uninitialize MPSL. Instead, simply calling&amp;nbsp;&lt;strong&gt;&lt;code&gt;mpsl_lib_init()&lt;/code&gt;&lt;/strong&gt;&amp;nbsp;function&amp;nbsp;(excluding the&amp;nbsp;&lt;span style="text-decoration:underline;"&gt;&lt;code&gt;&amp;quot;err = mpsl_lib_init_internal();&amp;quot;&lt;/code&gt;&lt;/span&gt;&amp;nbsp;part) after shutting down ESB was sufficient. Additionally, it was discovered that ESB can be started and stopped directly within the timeslot status change event using the conventional method, without needing to manipulate the IRQ register as done in the demo. The event code is as follows:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void timeslot_callback(timeslot_callback_type_t type)
{
    int err;
    if (type == APP_TS_STARTED) {
        err = esb_initialize();
        if (err) {
            LOG_ERR(&amp;quot;ESB initialize failed, err %d&amp;quot;, err);
            return;
        }
    } else {
        esb_disable();

        err = MULTITHREADING_LOCK_ACQUIRE();
        if (err) {
            LOG_ERR(&amp;quot;MULTITHREADING_LOCK_ACQUIRE() failed, err %d&amp;quot;, err);
            return;
        }
        mpsl_lib_init_irq();
        MULTITHREADING_LOCK_RELEASE();
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using OpenThread and ESB Together on nRF52840</title><link>https://devzone.nordicsemi.com/thread/475332?ContentTypeID=1</link><pubDate>Fri, 22 Mar 2024 09:26:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1701d983-f3bf-4de1-af55-cfea68020df4</guid><dc:creator>Shi</dc:creator><description>&lt;p dir="auto"&gt;Continuing our previous discussion, I&amp;#39;d like to share some updates and progress. After implementing the missing&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;code&gt;CONFIG_MPSL_DYNAMIC_INTERRUPTS=y&lt;/code&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;configuration from the example project and modifying the timeslot request logic, I&amp;#39;ve observed some positive changes. Specifically, I adjusted the handling of timeslot requests: instead of directly requesting another timeslot within the event handler upon a failed extension request, I now send a&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;code&gt;REQ_MAKE_REQUEST&lt;/code&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;message to a thread via a message queue. Then, upon receiving the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;code&gt;REQ_MAKE_REQUEST&lt;/code&gt;&lt;/strong&gt;, the thread delays for 1 millisecond before executing&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;code&gt;mpsl_timeslot_request&lt;/code&gt;&lt;/strong&gt;. My rationale for this approach is based on the assumption that the delay only needs to exceed the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;code&gt;NRF_802154_PRECISE_ACK_TIMEOUT_DEFAULT_TIMEOUT&lt;/code&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;default of 210 microseconds.&lt;/p&gt;
&lt;p dir="auto"&gt;With these adjustments, I am now able to run OpenThread in MTD sleep 500ms mode successfully. Next, I plan to test the ESB&amp;#39;s transmission and reception functionality. If everything goes well without further issues, I&amp;#39;ll be prepared to close this discussion topic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using OpenThread and ESB Together on nRF52840</title><link>https://devzone.nordicsemi.com/thread/475143?ContentTypeID=1</link><pubDate>Thu, 21 Mar 2024 13:48:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb287406-d84e-450b-9bc0-a9b4e1687452</guid><dc:creator>Shi</dc:creator><description>&lt;p&gt;Hello Kenneth,&lt;br /&gt;&lt;span&gt;I want to express my sincere thanks for your guidance and information.Following your advice, I was able to compile without the need for&amp;nbsp;&lt;strong&gt;&lt;code&gt;CONFIG_NRF_802154_TEMPERATURE_UPDATE=n&lt;/code&gt;&lt;/strong&gt;. However, I&amp;#39;ve encountered a series of challenges that I&amp;#39;m hoping you can help me navigate.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp;&lt;strong&gt;Successful Timeslot Requests&lt;/strong&gt;: Using the example code you provided, I successfully requested timeslots. This, however, seems to affect OpenThread&amp;#39;s ability to connect to a router, keeping it in a &amp;quot;detached&amp;quot; state. Interestingly, running&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;ot scan&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;can still detect the Thread network without any issues.&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;&lt;strong&gt;Temporary Resolution by Closing Timeslot Session&lt;/strong&gt;: Closing the timeslot session after 30 seconds allows OpenThread to quickly connect to the router and&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;code&gt;ot ping&lt;/code&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;operates normally. However, reopening the timeslot session after another 30 seconds leads to continuous state changes every 0.5 seconds (according to&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;code&gt;CONFIG_OPENTHREAD_POLL_PERIOD=500&lt;/code&gt;&lt;/strong&gt;), with OpenThread staying in the &amp;quot;child&amp;quot; state. During this period,&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;code&gt;ot ping&lt;/code&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;encounters packet loss due to the consecutive state changes, even though&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;code&gt;tcpdump -i wpan0&lt;/code&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;on the pinged otbr indicates successful receipt and transmission of ICMP6 packets.&lt;/p&gt;
&lt;p&gt;3.&amp;nbsp;&lt;strong&gt;Observations on Timeslot and Radio Control&lt;/strong&gt;: It seems that OpenThread does not request timeslots for receiving, which allows the application to capture the timeslot and take control of the radio. This is particularly noticeable when OpenThread is in MTD&amp;nbsp;mode with&amp;nbsp;&lt;span style="text-decoration:underline;"&gt;mRxOnWhenIdle=1&lt;/span&gt;; timeslots are successfully requested and maintained until&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;code&gt;ot ping&lt;/code&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;commands briefly take over the radio before releasing it, suggesting that OpenThread does not monopolize the radio during reception.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Here are the configurations I&amp;#39;ve implemented:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NO_OPTIMIZATIONS=n
CONFIG_DEBUG_OPTIMIZATIONS=n
CONFIG_SPEED_OPTIMIZATIONS=y
CONFIG_SIZE_OPTIMIZATIONS=y

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304
CONFIG_MAIN_STACK_SIZE=2048

CONFIG_MPSL=y
CONFIG_MPSL_TIMESLOT_SESSION_COUNT=2
CONFIG_MPSL_FEM=y
CONFIG_MPSL_FEM_SIMPLE_GPIO=y

CONFIG_NETWORKING=y
CONFIG_NET_L2_OPENTHREAD=y
CONFIG_OPENTHREAD_SLAAC=y
CONFIG_OPENTHREAD_DNS_CLIENT=y
CONFIG_OPENTHREAD_MTD=y
CONFIG_OPENTHREAD_MTD_SED=y
CONFIG_OPENTHREAD_POLL_PERIOD=500
CONFIG_RAM_POWER_DOWN_LIBRARY=y

CONFIG_DYNAMIC_INTERRUPTS=y
CONFIG_DYNAMIC_DIRECT_INTERRUPTS=y

CONFIG_ESB=y
CONFIG_ESB_DYNAMIC_INTERRUPTS=y&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;These issues have left me quite puzzled, and I would greatly appreciate your insights or suggestions on how to resolve them. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you in advance for your assistance.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using OpenThread and ESB Together on nRF52840</title><link>https://devzone.nordicsemi.com/thread/474948?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2024 15:40:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a8d680e-4114-4200-b9d0-4fd6073797ca</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Not entirely sure what the problem is, but you can find an example that use BLE and ESB here:&lt;br /&gt;&lt;span&gt;&lt;span dir="ltr"&gt;&lt;a title="https://github.com/too1/ncs-esb-ble-mpsl-demo" href="https://github.com/too1/ncs-esb-ble-mpsl-demo" rel="noopener noreferrer" target="_blank"&gt;https://github.com/too1/ncs-esb-ble-mpsl-demo&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;The prj.conf is here:&lt;br /&gt;&lt;a title="https://github.com/too1/ncs-esb-ble-mpsl-demo/blob/master/app_netcore/prj.conf" href="https://github.com/too1/ncs-esb-ble-mpsl-demo/blob/master/app_netcore/prj.conf" rel="noopener noreferrer" target="_blank"&gt;https://github.com/too1/ncs-esb-ble-mpsl-demo/blob/master/app_netcore/prj.conf&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;I suspect you are missing one of the configurations, try to add line 19-26.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;Kenneth&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>