<?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>wait_for_queue() hangs on re-init of DFU service</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25001/wait_for_queue-hangs-on-re-init-of-dfu-service</link><description>I have an app that requires BLE stack to be re-initialized, however it seems that if you run 
 ble_dfu_init();
 
 more than once, it crashes 
 Upon further inspection is seems the source the of crash is here: 
 nrf_dfu_settings_init();
 
 Drilling</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 08 Sep 2017 21:26:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25001/wait_for_queue-hangs-on-re-init-of-dfu-service" /><item><title>RE: wait_for_queue() hangs on re-init of DFU service</title><link>https://devzone.nordicsemi.com/thread/98468?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 21:26:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b706648f-0771-4351-bbfb-5bf9da6f4fa4</guid><dc:creator>ypearson</dc:creator><description>&lt;p&gt;The problem is mainly due to the inability to re-init the flash whilst you have pending flash operations (from peer manager and DFU init). They need to be handled before attempting a re-init. Also if you are using freertos you need to modify:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;app_timer_create()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is the fix that seems to be working for me:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static uint8_t is_flash_busy(void) {

uint32_t count;

fs_queued_op_count_get(&amp;amp;count);

return (count!=0);}

static void pre_ble_reinit(void) {

while(is_flash_busy())
 {
    while (pdFALSE == xSemaphoreTake(m_ble_event_ready, portMAX_DELAY));

    intern_softdevice_events_execute();
 }}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: wait_for_queue() hangs on re-init of DFU service</title><link>https://devzone.nordicsemi.com/thread/98467?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 16:03:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7324693-2477-4c49-a458-f5b3b07161b4</guid><dc:creator>ypearson</dc:creator><description>&lt;p&gt;Unfortunately I&amp;#39;m on a tight timeline, I&amp;#39;ll have to come up with a work-around or a fix.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: wait_for_queue() hangs on re-init of DFU service</title><link>https://devzone.nordicsemi.com/thread/98466?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 15:42:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12bda59a-adbd-49dd-b132-e59838ced58b</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;@ypearson: In SDK v12.x.0 the DFU Service uses a rather inefficient approach(writing data to the bootloader settings page) to signal the bootloader to stay in bootloader mode after the application performs a soft-reset. This approach was abandoned in SDK v13.0.0 where we simply write to the GPREGRET register, perform a soft-reset and then check the GPREGRET register upon entering the bootloader. Thus, I recommend moving to SDK 13 or backporting this feature from SDK v13.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: wait_for_queue() hangs on re-init of DFU service</title><link>https://devzone.nordicsemi.com/thread/98465?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 12:38:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a21176cc-20ea-48c1-9cd0-bc68a4868dac</guid><dc:creator>ypearson</dc:creator><description>&lt;p&gt;nRF5_SDK_12.2.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: wait_for_queue() hangs on re-init of DFU service</title><link>https://devzone.nordicsemi.com/thread/98464?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2017 12:24:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11a4bee5-ff13-424a-a360-95bd0dc6683f</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;Hi,
which SDK version are you using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>