<?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>nRF52840 Possible Flash Damage</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/94860/nrf52840-possible-flash-damage</link><description>I seemed to be randomly causing problems to our nRF52840 Zephyr v2.02 sensor&amp;#39;s flash. 
 Previously I had bricked 3 sensors somehow. Before full production, I need to know what I am doing wrong and how is this happening. 
 How many times can the flash</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 27 Dec 2022 09:08:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/94860/nrf52840-possible-flash-damage" /><item><title>RE: nRF52840 Possible Flash Damage</title><link>https://devzone.nordicsemi.com/thread/402215?ContentTypeID=1</link><pubDate>Tue, 27 Dec 2022 09:08:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3eeb8157-a54f-4711-b1d4-d80dade8d1cc</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="DavidKaplan"]1) Does loading a new program when debugging count as an erasure?&lt;br /&gt; I have used sensor#1 quite a bit in debugging.[/quote]
&lt;p&gt;When I run &amp;quot;debug&amp;quot; in VS Code, it calles this command to flash the chip:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;west flash -d c:\ncs\v2.2.0\zephyr\samples\hello_world\build --skip-rebuild -r nrfjprog --dev-id 1050084572&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So it flashes the chip, but does not erase the flash.&lt;/p&gt;
[quote user="DavidKaplan"]2) I erase the slot on the sensor before starting its file transfer and do not use CONFIG_IMG_ERASE_PROGRESSIVELY=y. &lt;br /&gt; Would it be better to use progressive erasures and not erase it at the start?[/quote]
&lt;p&gt;From &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_IMG_ERASE_PROGRESSIVELY"&gt;CONFIG_IMG_ERASE_PROGRESSIVELY&lt;/a&gt;: &lt;br /&gt;&amp;quot;If enabled, flash is erased as necessary when receiving new firmware, instead of erasing the whole image slot at once. This is necessary on some hardware that has long erase times, to prevent long wait times at the beginning of the DFU process.&amp;quot;&lt;/p&gt;
&lt;p&gt;It seems that this configuration is for changing how fast the DFU goes.&lt;br /&gt;I suggest that you try to time your DFU with and without this configuration, to find which setting works best for you.&lt;/p&gt;
[quote user="DavidKaplan"]3) The default nRF52840 block size is 512 bytes. Would it help to increase it if possible?[/quote]
&lt;p&gt;I assume that you mean: &amp;quot;Will it help to decrease flash wear?&amp;quot;&lt;/p&gt;
&lt;p&gt;The way I understand it, the scratch size is mostly important if you use swap-scratch, as it will decrease the amount of times you write to the same flash.&lt;/p&gt;
&lt;p&gt;However, you should use swap-move, as it reduces wear on the flash.&lt;br /&gt;In this case, here is from &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/mcuboot/design.html#swap-without-using-scratch"&gt;Swap without using scratch&lt;/a&gt;: &lt;br /&gt;&amp;quot;The algorithm does two erase cycles on the primary slot and one on the secondary slot during each swap. Assuming that receiving a new image by the DFU application requires 1 erase cycle on the secondary slot, this should result in leveling the flash wear between the slots.&amp;quot;&lt;/p&gt;
&lt;p&gt;From this it looks like the swap-move will only do a set number of erases, no matter the block size.&lt;/p&gt;
&lt;p&gt;For more information on swap alternatives, see &lt;a href="https://www.youtube.com/watch?v=KFgK3TRDNR4&amp;amp;list=PLHoBLXiNitjEZFbSsz9UN69L-Z5-3oaee&amp;amp;index=6"&gt; MCUboot swap-scratch algorithm&amp;nbsp; &lt;/a&gt;and &lt;a href="https://www.youtube.com/watch?v=TNvUHJ_NSo8&amp;amp;list=PLHoBLXiNitjEZFbSsz9UN69L-Z5-3oaee&amp;amp;index=7"&gt; The Swap-Move algorithm in MCUboot &lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Possible Flash Damage</title><link>https://devzone.nordicsemi.com/thread/402135?ContentTypeID=1</link><pubDate>Sun, 25 Dec 2022 07:13:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80d4fac5-c921-4afe-8359-1ed0a5d30e3e</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;To recap things:&lt;/p&gt;
&lt;p&gt;I previously did not define CONFIG_BOOT_SWAP_USING_MOVE=y since I was unaware of the consequences.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;In my current sensor code, I added a child_image folder and copied the mcuboot&amp;#39;s prog.conf file adding the CONFIG_BOOT_SWAP_USING_MOVE=y #define in a mcuboot.conf file.&lt;br /&gt;I then programmed two sensors with the new code and then transferred the new image (with only the date changed) by my non-SMP BLE file transfer procedure.&lt;br /&gt;One sensor was programmed OK and the other not.&lt;br /&gt;I then connected the debugger and issued nrfjprog --readcode on both the good and bad sensors and uploaded to you the hex files along with the bootloader report.&lt;br /&gt;1.hex for the first sensor (failed) and nrfjprog --readcode 2.hex for the good sensor.&lt;br /&gt;The sensors will soon be in field tests and if I am doing something wrong, I need to know now.&lt;/p&gt;
&lt;p&gt;1) Does loading a new program when debugging count as an erasure?&lt;br /&gt; I have used sensor#1 quite a bit in debugging.&lt;/p&gt;
&lt;p&gt;2) I erase the slot on the sensor before starting its file transfer and do not use CONFIG_IMG_ERASE_PROGRESSIVELY=y. &lt;br /&gt; Would it be better to use progressive erasures and not erase it at the start?&lt;/p&gt;
&lt;p&gt;Before I start the DFU, I call img_mgmt_impl_erase_slot() to erase slot1 and flash_img_init().&lt;br /&gt; Then, I use img_mgmt_impl_write_image_data() to write incoming 512-byte blocks of the image.&lt;br /&gt; When I have finished writing the whole image to slot 1, I call img_mgmt_read_info() and img_mgmt_impl_write_pending() &lt;br /&gt; with the write pending permanent flag false. It is all in the code in my post.&lt;/p&gt;
&lt;p&gt;3) The default nRF52840 block size is 512 bytes. Would it help to increase it if possible?&lt;br /&gt; I tried once 1024 but it did not work or maybe I did not change the proper define.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks David&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Possible Flash Damage</title><link>https://devzone.nordicsemi.com/thread/401971?ContentTypeID=1</link><pubDate>Thu, 22 Dec 2022 14:32:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f4d0614-c9bf-47d7-80bb-19ae6a5e1478</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As Andreas said, I will continue to help with this case.&lt;/p&gt;
&lt;p&gt;To make sure I have not missed anything, can you confirm if this is your current questions?&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You do want to know which swap type you use&lt;/li&gt;
&lt;li&gt;You are concerned that you have a limited amount of DFUs available before you use up the flash.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let me know if there was anything I have missed in the case.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Swap Type:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To figure out which swap type your project has, you can find that in VS Code after you built your project:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1671719549302v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Which swap type does your project use?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Possible Flash Damage</title><link>https://devzone.nordicsemi.com/thread/401875?ContentTypeID=1</link><pubDate>Thu, 22 Dec 2022 10:11:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2889809-1e16-409c-8d7f-8cece3a28f27</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Unfortunately II couldn&amp;#39;t identify the cause to the issue before the Holidays. I&amp;#39;ll be out of office until the 29th, but in the meanwhile&amp;nbsp;a colleague of mine will handle this case. Hopefully they will have the time to look into the issue and come with suggestions, but due to the staffing throughout the holiday period it&amp;#39;s expected that the response time will be longer until the first week of January where we&amp;#39;re fully staffed again.&lt;/p&gt;
&lt;p&gt;I hope this does not cause too many issues for you,&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Possible Flash Damage</title><link>https://devzone.nordicsemi.com/thread/401496?ContentTypeID=1</link><pubDate>Tue, 20 Dec 2022 12:01:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c81e9b00-f452-4233-9ac3-7966326687d0</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;Here is my.config file.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2330.config.txt"&gt;devzone.nordicsemi.com/.../2330.config.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;My project proj.conf&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/0285.prj.txt"&gt;devzone.nordicsemi.com/.../0285.prj.txt&lt;/a&gt;I have a overlay-secure_bootloader.conf file along the proj.conf&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/overlay_2D00_secure_5F00_bootloader.txt"&gt;devzone.nordicsemi.com/.../overlay_2D00_secure_5F00_bootloader.txt&lt;/a&gt;And in the child_image a mcuboot.conf&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mcuboot.txt"&gt;devzone.nordicsemi.com/.../mcuboot.txt&lt;/a&gt; My boards directory is based on the generic nRF52840&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/boards.zip"&gt;devzone.nordicsemi.com/.../boards.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I did not see some of the defines you highlighted in my build .config file.&lt;/p&gt;
&lt;p&gt;I just want to make sure I am not using the swap with the 256 upgrade limitation.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks David&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Possible Flash Damage</title><link>https://devzone.nordicsemi.com/thread/401468?ContentTypeID=1</link><pubDate>Tue, 20 Dec 2022 10:22:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7140375a-3a11-4195-a287-b62a0e6dcabe</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I will give an answer to some of your questions now today so you have something to work with, and I will come back to verify the items below that needs some more input tomorrow.&amp;nbsp;&lt;/p&gt;
[quote user="DavidKaplan"]After reading the&amp;nbsp; MCUboot documentation you inked, I understand that the swap-using-scratch is the default and that it may leave us with only 256 upgrades.[/quote]
&lt;p&gt;Yes, that&amp;#39;s correct for the case where you&amp;#39;re performing DFU using scratch. However the default is swap using move if the SoC family is nRF, I am not 100% sure that is the case in your application if you&amp;#39;ve created it from scratch, so we&amp;#39;ll have to look closer into this. Could you:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Share your configurations (proj.conf and overlay files)?&lt;/li&gt;
&lt;li&gt;Could you navigate to &amp;lt;your app&amp;gt;&lt;em&gt;/build/mcuboot/zephyr/.config&amp;nbsp;&lt;/em&gt;and see what is enabled or not? As a sample here, you can see that by default the sample I&amp;#39;ve chosen uses move and not scratch.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/2068.pastedimage1671528099314v1.png" alt=" " /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For reference, the sample where this .config is fetched from is this sample:&lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/nrf5340/mcuboot_smp_ble_simultaneous"&gt;https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/nrf5340/mcuboot_smp_ble_simultaneous&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Swapping using move should not cause the same issues as with scratch, so I might&amp;#39;ve been too fast in suggesting that the issue lies there. However, your configuration files should reveal if scratch or move is being used.&lt;/p&gt;
[quote user="DavidKaplan"]2)&amp;nbsp; I erase the slot on the sensor before starting its file transfer and do not use CONFIG_IMG_ERASE_PROGRESSIVELY=y. Would it be better to use progressive erasures and not erase it at the start?[/quote]
&lt;p&gt;I will have to verify this,&lt;/p&gt;
[quote user="DavidKaplan"]&lt;p&gt;3) The default nRF52840 block size is 512 bytes. Would it help to increase it if possible?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;As far as I know what is used is the slot size of 4k (8 blocks or 1 page) that is being section used for cycling the image.&amp;nbsp;I believe it should be possible to increase this in multiples of a page size, but I need to look closer into if there exists any configs or if the 52840 has any limitations w.r.t. maximum slot sector size. As the documentation states under &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/design.html#swap-using-scratch"&gt;mcuboot&lt;/a&gt;: &amp;quot;Usual minimum size of 4k..&amp;quot;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Possible Flash Damage</title><link>https://devzone.nordicsemi.com/thread/401291?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2022 13:37:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97d899f1-ca41-4c7a-bf28-bdfb3292a475</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;After reading the&amp;nbsp; MCUboot documentation you inked, I understand that the swap-using-scratch is the default and that it may leave us with only 256 upgrades.&lt;br /&gt;1) Does loaded a new program when debugging count?&lt;br /&gt;&lt;br /&gt;2)&amp;nbsp; I erase the slot on the sensor before starting its file transfer and do not use CONFIG_IMG_ERASE_PROGRESSIVELY=y. Would it be better to use progressive erasures and not erase it at the start?&lt;/p&gt;
&lt;p&gt;3) The default nRF52840 block size is 512 bytes. Would it help to increase it if possible?&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I added a child_image folder and copied the mcuboot&amp;#39;s prog.conf file adding the CONFIG_BOOT_SWAP_USING_MOVE=y #define in a mcuboot.conf file.&lt;br /&gt;&lt;br /&gt;I understand that this should drastically increase the number of possible upgrades.&lt;br /&gt;&lt;br /&gt;The sensor has only a primary and a secondary slot, so I see no reason not to do this.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;
  flash_primary (0x100000 - 1024kB):
+-------------------------------------------------+
| 0x0: mcuboot (0xc000 - 48kB)                    |
+---0xc000: mcuboot_primary (0x74000 - 464kB)-----+
| 0xc000: mcuboot_pad (0x200 - 512B)              |
+---0xc200: mcuboot_primary_app (0x73e00 - 463kB)-+
| 0xc200: app (0x73e00 - 463kB)                   |
+-------------------------------------------------+
| 0x80000: mcuboot_secondary (0x74000 - 464kB)    |
| 0xf4000: littlefs_storage (0x6000 - 24kB)       |
| 0xfa000: nvs_storage (0x6000 - 24kB)            |
+-------------------------------------------------+

  sram_primary (0x40000 - 256kB):
+--------------------------------------------+
| 0x20000000: sram_primary (0x40000 - 256kB) |
+--------------------------------------------+&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I FOTA DFU two of my nRF52840 sensors. One failed at the last block written or when calling img_mgmt_read_info() and&amp;nbsp; img_mgmt_impl_write_pending(). The other one most always works.&lt;/p&gt;
&lt;p&gt;I connected each sensor to my dk and issued the nrfjprog --readcode 1.hex for the first sensor (failed) and nrfjprog --readcode 2.hex for the good sensor. I compared the files and see that they are different.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2548.hex"&gt;devzone.nordicsemi.com/.../2548.hex&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2.hex"&gt;devzone.nordicsemi.com/.../2.hex&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks and happy holidays.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Possible Flash Damage</title><link>https://devzone.nordicsemi.com/thread/401085?ContentTypeID=1</link><pubDate>Fri, 16 Dec 2022 13:59:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1f922b8-5a7f-4069-840f-11602f3bc80e</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="DavidKaplan"]What address are slot1?[/quote]
&lt;p&gt;The first thing that runs starts at address 0x0. Depending on if you&amp;#39;re using MCUboot and/or an Immutable bootloader (b0), the location will change.&lt;/p&gt;
&lt;p&gt;If you only have the application, slot1 should be starting at 0x0. If you have MCUboot in addition to the application, then MCUboot is what starts at 0x0, and the application (primary slot) starts after. If you&amp;#39;re also using b0, then b0 starts at 0x0, then followed by MCUboot, then followed by the application&lt;/p&gt;
&lt;p&gt;You could get an indication of where the various partitions are located by navigating to the projects build folder and use&amp;nbsp;&lt;em&gt;ninja partition_manager_report&amp;nbsp;&lt;/em&gt;to see where the slots are located.&amp;nbsp;&lt;/p&gt;
[quote user="DavidKaplan"]It does not seem likely that even with a software DFU bug I have exceeded writing 10,000 times.[/quote]
&lt;p&gt;I had a closer look in the MCUboot documentation and I found this:&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/design.html#swap-using-scratch"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/design.html#swap-using-scratch&lt;/a&gt;. If you&amp;#39;re using the scratch algorithm when flashing, there might be some scratch specific wear when your doing upgrades which dramatically reduces the number of cycles you can update the device. That number could be more plausible than 10 000. I suggest you have a look at that documentation to see if that could be a possible scenario or not&lt;/p&gt;
[quote user="DavidKaplan"]I will get back to you.[/quote]
&lt;p&gt;Sounds like a plan. Just a heads up, I will be working on and off for the next couple of weeks due to the christmas holidays in Norway, so the response time might be a bit longer than usual&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Possible Flash Damage</title><link>https://devzone.nordicsemi.com/thread/400785?ContentTypeID=1</link><pubDate>Thu, 15 Dec 2022 10:00:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:288c5d6f-4f2d-496c-9cd9-ae947f6cb54c</guid><dc:creator>DavidKaplan</dc:creator><description>&lt;p&gt;It does not seem likely that even with a software DFU bug I have exceeded writing 10,000 times.&lt;/p&gt;
&lt;p&gt;The 3 sensor I have bricked do not respond to Seggar connect tries so any software above it also gives an error, so it may be another problem and not the flash with those units.&lt;/p&gt;
&lt;p&gt;The sensor that gives a hard fault after I have written the entire image to Slot1 caused me to think that maybe some flash region could not be programmed. I wanted to debug the reason but was unable to switch the BLE off so it would not give timing faults when debugging. How can I prevent the BLE timing errors when debugging this issue?&lt;/p&gt;
&lt;p&gt;I can try to read the&amp;nbsp;&lt;span&gt;nrfjprog to read out the flash-area. The flash areas are defaults for the nR52840.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What address are slot1?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I did not write a custom SMP server but use raw BLE transfers from our Gateway Central.&lt;/p&gt;
&lt;p&gt;But I do have the SMP stuff enabled for phone App DUF updates.&lt;/p&gt;
&lt;p&gt;I tried Simon&amp;#39;s test SMP DFU code but could not get it to work and decided to try custom raw transfers without the SMP complicating things.&lt;/p&gt;
&lt;p&gt;Before I start the DFU, I call&amp;nbsp;img_mgmt_impl_erase_slot() to erase slot1 and&amp;nbsp;flash_img_init().&lt;/p&gt;
&lt;p&gt;Then, I use&amp;nbsp;img_mgmt_impl_write_image_data() to write incoming 512-byte blocks of the image.&lt;/p&gt;
&lt;p&gt;When I have finished writing the whole image to slot 1, I call&amp;nbsp;img_mgmt_read_info() and&amp;nbsp; img_mgmt_impl_write_pending() with the write pending permanent flag false. It is all in the code in my post.&lt;/p&gt;
&lt;p&gt;It seems to work.&lt;/p&gt;
&lt;p&gt;I guess the&amp;nbsp;&lt;span&gt;img_mgmt_impl_erase_slot() call counts as one of the 10,000 flash writes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I will get back to you.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks David&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 Possible Flash Damage</title><link>https://devzone.nordicsemi.com/thread/400763?ContentTypeID=1</link><pubDate>Thu, 15 Dec 2022 08:57:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a57d97da-35cf-41e4-98a7-cdeed9956103</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]How many times can the flash be written?[/quote]
&lt;p&gt;From the PS for the 52840, it is specified that the device has&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/nvmc.html?cp=4_0_0_3_2_9#unique_797338916"&gt;10,000&amp;nbsp;write/erase cycles for the nRF52840 flash&lt;/a&gt;&lt;span&gt;. &lt;/span&gt;During normal circumstances you should not need to worry that you will reach this limit, as my colleague has answered&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/58431/nrf52840-flash-endurance-in-long-life-span"&gt;in this devzone case&lt;/a&gt;. The linked case has a different use-case but I think the information there can be relevant for your project.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However since you state that you can update one of the sensors but not the other it could however indicate that it is a issue with the flash, but I can&amp;#39;t say for sure. Do you think you&amp;#39;ve written that many cycles to the flash during the devices lifespan? Do you have a less used device you can test with, or do you only have one device available?&amp;nbsp;&lt;/p&gt;
[quote user=""]My DFU process:[/quote]
&lt;p&gt;Am I correct in assuming that you&amp;#39;ve written your own custom SMP server?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you use nrfjprog to read out the flash-area with the DFU images from all 3 devices and compare them to verify that the images are different?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would also like to suggest these two resources containing a lot of great samples with DFU and bootloaders in nRF Connect SDK just in case you haven&amp;#39;t seen them already. They might not contain what you need to update the sensors, but I find them great to have available when developing anything that should use the related topics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk"&gt;https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;A great repo with guides, explanations and samples for doing DFU with various means and various configurations&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu"&gt;Add DFU support to your application&lt;/a&gt;&amp;nbsp;
&lt;ul&gt;
&lt;li&gt;A similar guide with a slightly different approach&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>