<?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 branch Bootloader when TWI is busy</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36522/dfu-branch-bootloader-when-twi-is-busy</link><description>Hi, 
 I have a application where the TWI is always reading a sensor in the main task. 
 When the DFU requiere to reset, frequently the TWI is busy and the current frame is broken ! 
 When the application restart after the flash update, TWI can&amp;#39;t read</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 Jul 2018 15:10:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36522/dfu-branch-bootloader-when-twi-is-busy" /><item><title>RE: DFU branch Bootloader when TWI is busy</title><link>https://devzone.nordicsemi.com/thread/140721?ContentTypeID=1</link><pubDate>Thu, 19 Jul 2018 15:10:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2b37c5e-1ca3-4842-93b0-1d58235e877c</guid><dc:creator>Ga&amp;#233;tan</dc:creator><description>&lt;p&gt;OK thanks,&lt;/p&gt;
&lt;p&gt;I need to modify the dfu source present in SDK.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU branch Bootloader when TWI is busy</title><link>https://devzone.nordicsemi.com/thread/140706?ContentTypeID=1</link><pubDate>Thu, 19 Jul 2018 14:34:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59562c26-47b6-4b68-93c1-ef1bcaaa94be</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I suggest that you use the DFU request to set a flag. This way, you can check this flag in the main thread, to see whether it has been requested. If it has, then you can shut down the TWI gracefully before doing the DFU reset.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Short, but hopefully explaining pseudo code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;DFU_interrupt(void)
{
    DFU_reset_requested = true;
}

main()
{
    ...
    while(1)
    {
        ...
        if(DFU_reset_requested)
        {
            prepare_DFU();
            reset();
        }
        idle_state_handle(); //or whatever the wait function is called in the project
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>