<?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>DFU over BLE using SMP failing when device is in Error state</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/107819/dfu-over-ble-using-smp-failing-when-device-is-in-error-state</link><description>We are using the CAF Power Manager module and CAF Simple Management Protocol module. 
 The DFU over SMP works like a charm using the nrf connect app when the device is in a normal state (all module report MODULE_STATE_READY). However, if a module report</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 05 Feb 2024 11:29:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/107819/dfu-over-ble-using-smp-failing-when-device-is-in-error-state" /><item><title>RE: DFU over BLE using SMP failing when device is in Error state</title><link>https://devzone.nordicsemi.com/thread/467538?ContentTypeID=1</link><pubDate>Mon, 05 Feb 2024 11:29:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f96ecb74-1e46-4ad4-960b-ce9b5bd16083</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That makes sense. If you have an empty while loop without any k_sleep() or similar it will consume all available CPU resources, blocking any lower priority threads.&lt;/p&gt;
&lt;p&gt;CAF is used by several of our reference applications, and can definetly be usefull. But compared to with some other SDKs (includign our older nRF5 SDK), you generally do not need that much boiler plate code with Zephyr, which is perhaps why such libraries are not that much used. But to be clear, there is nothing wrong with using CAF modules if those solves an issue for you and it&amp;nbsp; handles of&amp;nbsp;tasks you would otherwise have to implement handling for yourself.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU over BLE using SMP failing when device is in Error state</title><link>https://devzone.nordicsemi.com/thread/467216?ContentTypeID=1</link><pubDate>Thu, 01 Feb 2024 15:20:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b340ace-13d3-468b-81da-c931d5ff1848</guid><dc:creator>Severin Ferard</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;After conducting further testing, I discovered that removing the &lt;code&gt;for (;;) {}&lt;/code&gt; loop in the main function resolves the issue. This loop was responsible for sampling multiple sensors. When encountering a &lt;code&gt;MODULE_STATE_ERROR&lt;/code&gt;, the sampling was bypassed, resulting in what seemed like an empty &lt;code&gt;while (true)&lt;/code&gt; loop. My understanding is that this perpetually empty loop failed to yield back the system thread, potentially leading to allocation issues, although I&amp;#39;m not entirely certain about the underlying behavior.&lt;/p&gt;
&lt;p&gt;Regarding the specific use case, I aim for testers to update the firmware through our mobile application even after a critical error, particularly if the error stemmed from a misconfiguration (e.g., a sensor receiving the wrong address). Since the SWD port is not easily accessible within the testing product, having to dismantle everything to reach the SWD port due to a typo in firmware flashed during a previous DFU would be cumbersome.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m somewhat surprised to learn that CAF is not commonly used in consumer applications. To avoid reinventing the wheel, we are leveraging the CAF BLE state module, CAF LED module, and CAF power management module, along with a slightly modified version of the Desktop Battery measurement. I&amp;#39;m curious whether the common approach is to rewrite these functionalities from scratch or if consumer applications typically do not utilize the Application Event Manager framework. I&amp;#39;m relatively new to the nRF Connect ecosystem; hence, my main references were the nRF Desktop sample application, although it may not necessarily exemplify the preferred approach.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU over BLE using SMP failing when device is in Error state</title><link>https://devzone.nordicsemi.com/thread/467177?ContentTypeID=1</link><pubDate>Thu, 01 Feb 2024 13:34:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40463707-23cc-4843-be0d-4e1e8b150ca3</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The CAF modules are not much used outside of nRF Dekstop so I must admitt I don&amp;#39;t ahve much experience with it, but I am having some problems understanding&amp;nbsp;the big picture. This only happens when the state is MODULE_STATE_ERROR right? And this indicate a critical (non-recoverable) error, which also puts the power maner in&amp;nbsp;POWER_STATE_ERROR. Is it expected and desierable to do DFU in that case and not just reset?&lt;/p&gt;
&lt;p&gt;Also, out of curiosity, may I ask why you are using CAF?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU over BLE using SMP failing when device is in Error state</title><link>https://devzone.nordicsemi.com/thread/466851?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 00:01:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f00e7a8-23ff-41b2-ae05-2ed3463294cc</guid><dc:creator>Severin Ferard</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I tried to create a minimal reproducible exemple, but I couldn&amp;#39;t get the DFU over SMP to work. I kept getting the same kind of error as in my app when in an error state. This would then indicate that something is wrong in my configuration ? Here is the MRE:&lt;/p&gt;
&lt;p&gt;prj.conf&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y

CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
CONFIG_BOOTLOADER_MCUBOOT=y

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;HelloWorld&amp;quot;

CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_CBPRINTF_FP_SUPPORT=y
CONFIG_ASSERT=y

CONFIG_APP_EVENT_MANAGER=y
CONFIG_CAF=y
CONFIG_HEAP_MEM_POOL_SIZE=4096

CONFIG_BT_SMP=y
CONFIG_CAF_BLE_STATE=y
CONFIG_CAF_BLE_ADV=y

CONFIG_PM_POLICY_CUSTOM=y
CONFIG_CAF_POWER_MANAGER=y
CONFIG_CAF_POWER_MANAGER_EVENTS=y
CONFIG_CAF_POWER_MANAGER_STAY_ON=y
CONFIG_CAF_POWER_MANAGER_TIMEOUT=120

CONFIG_NET_BUF_LOG=y
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;main.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;zephyr/logging/log.h&amp;gt;
LOG_MODULE_REGISTER(main);

#include &amp;lt;app_event_manager.h&amp;gt;
#define MODULE main
#include &amp;lt;caf/events/module_state_event.h&amp;gt;

int main(void)
{
        if (app_event_manager_init())
        {
                LOG_ERR(&amp;quot;Application Event Manager not initialized&amp;quot;);
        }
        else
        {
                module_set_state(MODULE_STATE_READY);
        }

        for (;;)
        {
        }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I get the same behaviour than previously stated; when connected with the nrf Connect App, I can start a dfu update but it get stuck for a while at &amp;quot;Requesting McuMgr parameters...&amp;quot; then at &amp;quot;Requesting bootloader info...&amp;quot; and finally at &amp;quot;Validating&amp;quot;, all while the progress stays at 0.00%. In the RTT logs, I keep seeing multiple&amp;nbsp;&lt;em&gt;net_buf_alloc():1258: Failed to get free buffer.&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU over BLE using SMP failing when device is in Error state</title><link>https://devzone.nordicsemi.com/thread/466561?ContentTypeID=1</link><pubDate>Mon, 29 Jan 2024 14:51:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec2c8bbe-8104-425b-8490-f8289540f2be</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am not immediately able to see from the log where the buffer is attemted to be allocated, and also not why (seemingly) buffers are not freed, so that you run out of buffers. Can you elaboreate how this happens and perhaps how to reproduce?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>