<?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>bootloader interferes with application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46111/bootloader-interferes-with-application</link><description>Hi, 
 we have a custom board running the nrf52840. The code is getting pretty good we are getting close to beta. We are using SES as our development platform and are currently using SDK15.0. 
 We have implemented three things: 
 1) our custom ble services</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 18 Apr 2019 04:48:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46111/bootloader-interferes-with-application" /><item><title>RE: bootloader interferes with application</title><link>https://devzone.nordicsemi.com/thread/182702?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2019 04:48:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:377ca4b8-3e60-4c0a-b564-6ade4a8dfd8c</guid><dc:creator>paul</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;many thanks for your help. Turning off crc checking as you describe appears to have solved the hang. I will be looking into the UICR registers to pass information between the bootloader and the app.&lt;/p&gt;
&lt;p&gt;Cheers Paul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader interferes with application</title><link>https://devzone.nordicsemi.com/thread/182566?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2019 10:38:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74b976e9-9644-4c53-99ae-014294c9b028</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Paul,&lt;/p&gt;
&lt;p&gt;1. Assume you update the bl settings page through nrfutil when you change the application? Otherwise, the bootloader should not boot the application as the CRC&amp;nbsp;has to be different.&lt;/p&gt;
&lt;p&gt;2. That&amp;#39;s a symptom of a different problem. The device will be advertising with a different BLE address when in DFU mode (regular address + 1). Could this explain why you don&amp;#39;t see the device? I.e., you try to connect to the device with the &amp;quot;normal&amp;quot; address.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3. SES uploads the .elf file when programming the app while nrfutil uses the&amp;nbsp;.hex file to calculate the CRC. Both will result in the same code being uploaded to flash. However, they may have different byte padding rules&amp;nbsp;causing the calculated CRC of the app image in flash to be different from the CRC generated by nrfutil in the bootloader settings page. I had a case on this earlier but wasn&amp;#39;t able to find it now. But as a test, can you try to disable the CRC check in the bootloader to see if the problems go away?&lt;/p&gt;
&lt;p&gt;To disable crc check you can modify this line in nrf_bootloader.c::crc_on_valid_app_required():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static bool crc_on_valid_app_required(void)
{
    //bool ret = true;
    bool ret = false; // &amp;lt;-- always return false. Revert this change for production FW
    if (NRF_BL_APP_CRC_CHECK_SKIPPED_ON_SYSTEMOFF_RESET &amp;amp;&amp;amp;
        (nrf_power_resetreas_get() &amp;amp; NRF_POWER_RESETREAS_OFF_MASK))
    {
        nrf_power_resetreas_clear(NRF_POWER_RESETREAS_OFF_MASK);
        ret = false;
    }
    else if (NRF_BL_APP_CRC_CHECK_SKIPPED_ON_GPREGRET2 &amp;amp;&amp;amp;
            (nrf_power_gpregret2_get() &amp;amp; BOOTLOADER_DFU_SKIP_CRC))
    {
        nrf_power_gpregret2_set(nrf_power_gpregret2_get() &amp;amp; ~BOOTLOADER_DFU_SKIP_CRC);
        ret = false;
    }
    else
    {
    }

    return ret;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader interferes with application</title><link>https://devzone.nordicsemi.com/thread/182486?ContentTypeID=1</link><pubDate>Wed, 17 Apr 2019 04:52:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee31f095-4277-4722-ad8c-a54a908c247a</guid><dc:creator>paul</dc:creator><description>&lt;p&gt;Hi Vidal,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Yes that is a good description of the error case I am seeing. Interesting suggestion about the bootloader CRC. I have been thinking about it all day.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1) The application is changing all the time so I would expect it to practically never run if it was a crc issue.&lt;/p&gt;
&lt;p&gt;2) I don&amp;#39;t think that the update service (DFUTarg) is displayed in the error condition.&lt;/p&gt;
&lt;p&gt;3) The best way I have found to flash the boot loader is to run the script above by hand and then enter SES and use it to down load the application. So the bootloader - unless SES tells it about the application - knows nothing about the application. If SES does tell it - maybe store the crc somewhere - then it should always work.&lt;/p&gt;
&lt;p&gt;If I totally misunderstand, how do I get SES to update the crc on each compile and download to the device?&lt;/p&gt;
&lt;p&gt;Thanks again&lt;/p&gt;
&lt;p&gt;Paul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader interferes with application</title><link>https://devzone.nordicsemi.com/thread/182296?ContentTypeID=1</link><pubDate>Tue, 16 Apr 2019 08:43:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87dffd19-0c62-42b4-9360-7714f7dbaa17</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;2) if it&amp;#39;s just the device ID (assuming it never changes) I would suggest that you store it at a fixed address, one of the available UICR registers for instance. Then it&amp;#39;s easy to reference the device ID from both the app and bootloader using a hardcoded pointer. E.g.,&lt;/p&gt;
&lt;p&gt;DEVICE_ID&amp;nbsp; NRF_UICR-&amp;gt;CUSTOMER[10]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader interferes with application</title><link>https://devzone.nordicsemi.com/thread/182292?ContentTypeID=1</link><pubDate>Tue, 16 Apr 2019 08:38:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56c79ae3-c84a-448b-a74f-5e46e36962ac</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Paul,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for the update. Just so I understand the issue correctly, Is this the failure mode: &amp;quot;&lt;span&gt;ES tends not to return to debug mode when building and running our custom services by pressing the SES green arrow button&amp;quot;&lt;/span&gt;? On boot, the bootloader will always calculate the CRC of the app image and check that it matches the &amp;quot;Application CRC&amp;quot; stored in the settings page. If there&amp;#39;s a CRC mismatch the bootloader will think that the app is invalid and fall back do DFU mode.&amp;nbsp;Could this be the reason?&lt;/p&gt;
&lt;p&gt;Cheers&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader interferes with application</title><link>https://devzone.nordicsemi.com/thread/182213?ContentTypeID=1</link><pubDate>Tue, 16 Apr 2019 00:24:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f16f5a05-ebc1-4cbe-bc07-ddcc9e473cad</guid><dc:creator>paul</dc:creator><description>&lt;p&gt;Vidar,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; even with the 120 sec timeout I still get an intermittent failure to load the application when the bootloader is present. The solution is to use SES to erase all, run the bootloader flash script and then run the application. Usually this starts it working again. This is why I am thinking that there is some corruption somewhere.&lt;/p&gt;
&lt;p&gt;Cheers Paul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader interferes with application</title><link>https://devzone.nordicsemi.com/thread/182209?ContentTypeID=1</link><pubDate>Mon, 15 Apr 2019 23:09:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb37a3b6-1501-4aee-8cb8-35f12c8bf1fc</guid><dc:creator>paul</dc:creator><description>&lt;p&gt;Thanks Vidar,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I reviewed my changes to the default Nordic code this morning. I found three issues:&lt;/p&gt;
&lt;p&gt;1) I was attempting to log before logging was initialised which was causing a hang&lt;/p&gt;
&lt;p&gt;2) I was attempting to use FDS to pass information between the application and the bootloader service. This code just didn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;3) The timeout as you suggested causes a crash when put to 10minutes.&lt;/p&gt;
&lt;p&gt;Is there a preferred way to pass information between the application and the dfu service?&lt;/p&gt;
&lt;p&gt;Cheers Paul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bootloader interferes with application</title><link>https://devzone.nordicsemi.com/thread/181855?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2019 12:39:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69f4909c-35ae-48cb-a3ad-268b9da3bee7</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Paul,&lt;/p&gt;
&lt;p&gt;Please try to change the timeout back to 2 minutes to see if that helps. I remember we had an issue where we didn&amp;#39;t handle timer overflow (RTC), but not sure if it has been fixed in SDK 15.0.0. I will add more details once I have had time to look at the code in more detail.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>