<?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>Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16774/updating-from-s132-v2-0-x-to-s132-v3-0-0-with-dual-bank-bootloader-from-sdk-v11-0-0-does-not-work</link><description>Updating the SoftDevice on the nRF52832 from S132 v2.0.x to S132 v3.0 using the Dual Bank Bootloader from SDK v11.0.0 results in the application not starting up after the update is complete. 
 A readback of the flash after the update shows that a section</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 03 May 2019 09:15:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16774/updating-from-s132-v2-0-x-to-s132-v3-0-0-with-dual-bank-bootloader-from-sdk-v11-0-0-does-not-work" /><item><title>RE: Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/thread/185106?ContentTypeID=1</link><pubDate>Fri, 03 May 2019 09:15:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9df6862c-965d-443e-aca7-bfc57146f1f3</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Yes, you should also apply the patch to&amp;nbsp;&lt;span&gt;dfu_sd_image_validate&amp;nbsp;().&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/thread/185083?ContentTypeID=1</link><pubDate>Fri, 03 May 2019 08:22:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3072ea9-2956-429a-a913-28e99f7b4ad5</guid><dc:creator>fanoush</dc:creator><description>&lt;p&gt;I patched succesfully the&amp;nbsp;&lt;span&gt;dfu_sd_image_swap() code with 0xd000 constant, created legacy DFU package with fixed bootloader and after update I managed&amp;nbsp; to succesfully upload another combined package of SDK12 based&amp;nbsp; bootloader&amp;nbsp;with softdevice 3.0 and have DfuTarg device listening now. So overall it was a big success :-)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I guess I need also patch&amp;nbsp;dfu_sd_image_validate just to be on safe side if something goes wrong.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/thread/185067?ContentTypeID=1</link><pubDate>Fri, 03 May 2019 07:56:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b181b791-182a-4403-8572-e8282c803dd0</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Ok, let me know if you run into any issues &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/thread/184614?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2019 13:48:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75073531-6784-4f7c-81e1-a2b7526acd0d</guid><dc:creator>fanoush</dc:creator><description>&lt;p&gt;Thanks, So I&amp;#39;ll just try to patch the bootloader binary with direct 0xD000 register load, update it&amp;nbsp; and see if second&amp;nbsp;update with newer&amp;nbsp;SoftDevice/bootloader gets through.&lt;/p&gt;
&lt;p&gt;And BTW the device is cheap ($7.99 on gearbest) nrf52 based DS-D6 fitness tracker repurposed to run Espruino. So far I was stuck to building it with old SDK11 due to this bug as it wasn&amp;#39;t possible to update it without opening and&amp;nbsp;using&amp;nbsp;SWD pins.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/thread/184596?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2019 13:20:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c27e7e7-dc58-43bb-9c9c-51a80e50a1ec</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/fanoush"&gt;fanoush&lt;/a&gt;: I do not know the reasoning for calculating it as (boot_settings.sd_image_start –sd_start)/2; for the nRF51 SDK. Yes, with the S132 v2.0.x the new image will be placed in flash from 0x1c000 and upwards.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/thread/184578?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2019 12:41:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1e8a352-aee4-4454-911d-816b3824bcf5</guid><dc:creator>fanoush</dc:creator><description>&lt;p&gt;Hi, I just hit this issue with some old SDK11 based device I wanted to upgrade and wonder why the block size was computed in such relatively complex way? What was the original point&amp;nbsp;of computing&amp;nbsp;exactly (startXX-startYY)/2? which was then fixed by making&amp;nbsp;it smaller anyway?&lt;/p&gt;
&lt;p&gt;I am both just curious why there&amp;nbsp;was not simply some constant like 0x8000 from the start and also for practical reason -&amp;nbsp; patching broken bootloader binary with some constant now is easier than fitting additional masking code in and/or rebuilding from&amp;nbsp;old source/SDK.&lt;/p&gt;
&lt;p&gt;I guess I can also patch it with&amp;nbsp;&lt;code&gt;0xD000 &lt;/code&gt;value as below&amp;nbsp;to be on the safe side&amp;nbsp;since&amp;nbsp;the expression is constant anyway as this buggy SDK11 bootloader is tied to SD v2.0.x so&amp;nbsp;boot_settings.sd_image_start value is always&amp;nbsp;&lt;code&gt;0x1C000&lt;/code&gt; (?) so this is in fact build time constant&amp;nbsp;no matter what new SD+bootloader package I flash(?)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/thread/140917?ContentTypeID=1</link><pubDate>Mon, 23 Jul 2018 07:00:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2445253-3876-4853-a8cc-2a77154b8e58</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Does applying the dfu_sd_image_swap() fix to&amp;nbsp;dfu_sd_image_validate() lead to correct behaviour, i.e. no SD corruption?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/thread/140106?ContentTypeID=1</link><pubDate>Fri, 13 Jul 2018 21:23:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d5813ad-9dc5-4356-9fbe-99190171b275</guid><dc:creator>MattMBL</dc:creator><description>&lt;p&gt;I have confirmed in test, that if the SD copy is interrupted by power loss, then dfu_sd_img_block_swap() is resumed via dfu_sd_image_validate() rather than dfu_sd_image_swap().&amp;nbsp; Validate still contains the non page aligned block calculation, leading&amp;nbsp;to the same SD corruption as the unfixed code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/thread/139994?ContentTypeID=1</link><pubDate>Fri, 13 Jul 2018 04:55:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cd368e9-f99c-471a-bbe6-2e72de8eb62b</guid><dc:creator>MattMBL</dc:creator><description>&lt;p&gt;This is a very old issue, but we are now needing to update some in field devices containing this bootloader.&lt;/p&gt;
&lt;p&gt;Could you comment on whether the same change is necessary further down the file in dfu_sd_image_validate()?&amp;nbsp; This code appears to do nearly the same calculations followed by a&amp;nbsp;dfu_sd_img_block_swap() using the blocksize.&lt;/p&gt;
&lt;p&gt;A cursory look suggests that the validation may fail due to this block size issue.&amp;nbsp; Any ideas under what conditions would this happen?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/thread/64162?ContentTypeID=1</link><pubDate>Tue, 06 Dec 2016 08:45:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2030b29-f9f0-4563-90c6-4a32c54c9caa</guid><dc:creator>Erik</dc:creator><description>&lt;p&gt;Thanks! I belive this is also needed for dfu_single_bank. At least I couldn&amp;#39;t get single_bank to update to 3.0.0 without this fix. Best Regards, Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Updating from S132 v2.0.x to S132 v3.0.0 with Dual Bank Bootloader from SDK v11.0.0 does not work.</title><link>https://devzone.nordicsemi.com/thread/64161?ContentTypeID=1</link><pubDate>Fri, 30 Sep 2016 10:39:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3bc6d6bb-a0b3-42d3-8c00-49c0fc7da0f9</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;We have just been made aware of this issue and we have discovered that there is a page alignment issue in the code that copies the SoftDevice from swap to the SoftDevice region.&lt;/p&gt;
&lt;p&gt;The bootloader library for the nRF52 has been inherited from the nRF51 and was designed with a flash page size of 1kB (0x400) in mind. However, on the nRF52 the flash page size is 4kB(0x1000).&lt;/p&gt;
&lt;p&gt;Since the new SoftDevice (S132 v3.0.0) is larger than the old(S132 v2.0.0), the new bootloader image is divided into blocks and copied to the SD region one by one. The bootloader verifies that each block is written correctly to the SoftDevice region before moving on to the next block. This way we ensure that new bootloader is correctly written to flash even though we have to overwrite the start of the firmware image.&lt;/p&gt;
&lt;p&gt;The block size is determined the following way:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;block_size = (boot_settings.sd_image_start –sd_start)/2;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which in our case will result in the following&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;block_size = (0x1C000 – 0x1000)/2 = 0xD800
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The 0xD800 block would have been page aligned on the nRF51, but on the nRF52 it will be 13.5 flash pages. So when the next block is written to 0xE800, then the first half of the flash page from 0xE000 to 0xE800 is erased.&lt;/p&gt;
&lt;p&gt;The fix is to set the block size so that the blocks are page aligned, which is done by adding the following line below line 715 in &lt;code&gt;dfu_sd_image_swap()&lt;/code&gt; in &lt;code&gt;dfu_dual_bank.c&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;block_size &amp;amp;= ~(uint32_t)(CODE_PAGE_SIZE - 1);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This sets the block size to 0xD000 which ensures that the blocks are page aligned. I have attached the modified &lt;code&gt;dfu_dual_bank.c&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Attachment:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4744.dfu_5F00_dual_5F00_bank_5F00_with_5F00_fix.c"&gt;dfu_dual_bank_with_fix.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>