<?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>first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66754/first-secure-connection-after-dfu-fails-sdk17-s113</link><description>Hello. 
 After performing a secure DFU download, the first attempt to open a secure NUS connection fails with an NRF_ERROR_INVALID_PARAM error. After resetting the device, all subsequent connections are successful. I have traced this to the call to BLE_GATS_EVT_WRITE</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 12 Feb 2021 18:37:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66754/first-secure-connection-after-dfu-fails-sdk17-s113" /><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/294244?ContentTypeID=1</link><pubDate>Fri, 12 Feb 2021 18:37:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a918f078-9c6c-4b46-862a-e1af8b852868</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;FDS_VIRTUAL_PAGES did not have the same configuration for the boot loader and the application. This difference was the root of this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/279636?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2020 08:35:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2effa462-96f3-4836-81a6-d04170def527</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="ajcurtis"]&lt;p&gt;1.&amp;nbsp;Reducing&amp;nbsp;FDS_VIRTUAL_PAGES causes peer_manager initialization to fail.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is unclear to me the relationship between virtual pages and physical pages. It sounds like they are independent. (it is state above that it may grow) On the other hand it appears from the source code that they number of physical pages is directly related to the number of virtual pages.&lt;/p&gt;[/quote]
&lt;p&gt;This issue is not related to the size of the virtual pages, as they anyway need to be a multiple of the physical pages (in practice you typically configure it so that a virtual page is the same as a physical page). (Also, reducing the number of pages &lt;em&gt;can&lt;/em&gt; cause fds initialization and thus peer manager initialization to fail. If it actually does not not depends on if the swap page was removed or not. If only data page(s) were deleted, you would &amp;quot;just&amp;quot; lose data.).&lt;/p&gt;
&lt;p&gt;Just as a side note it is unlikely that the virtual page size is different than the virtual page size. It does not make sense for most application, as that would waste mor flash on the swap page. And the only benefit would be to support very large records.&lt;/p&gt;
[quote user="ajcurtis"]&lt;p&gt;2. The proposed solution is to erase the pages prior to peer manager initialization.&lt;/p&gt;
&lt;p&gt;The peer manager is not part of our application. It is part of the SDK. How do we know what pages to erase? peer_data_storage.h defines&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;PDS_FIRST_RESERVED_RECORD_KEY and&amp;nbsp;&amp;nbsp;PDS_LAST_RESERVED_RECORD_KEY. Do we find the ID for all keys in this range and delete them?&lt;/span&gt;&lt;/p&gt;[/quote]
&lt;p&gt;You know that the FDS pages are immediately below the bootloader, counting downwards as many pages as you have configured in your sdk_config.h. You cannot know at which page data is contained, regardless of if it is stored by the peer_manager or another user, as data will be shifted around during the life cycle of a device as it performs garbage collection without searching for FDS records (like FDS itself does).&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t need to keep the data, then you can simply delete all FDS pages blindly. If not, then you can search for the data and temporarily store them somewhere else. That would be up to you though. You would not be able to use FDS directly if it cannot be initialized, but you could use code from the FDS implementation. I do not know enough about your use case and requirements to say if this is sensible or not, though.&lt;/p&gt;
[quote user="ajcurtis"]3. pm_init() calls pds_init() which calls fds_init(). To erase the peer manager information we would need to fds_init() first. It looks like this will be fine. Just verifying.[/quote]
&lt;p&gt;Yes. FDS is intended to support multiple &amp;quot;users&amp;quot; and it is perfectly legal to initialize it more than once (it will simply return&amp;nbsp;NRF_SUCCESS and trigger the event indicating it is initialized again for any subsequent calls to&amp;nbsp;fds_init()).&lt;/p&gt;
[quote user="ajcurtis"]4. Is there a generic way to determine how FDS_VIRTUAL_PAGES was previously configured? It appears that this macro is used to calculate the number of physical pages. Is is possible to read the FDS pages and determine the end and therefore the previous value of FDS_VIRTUAL_PAGES?[/quote]
&lt;p&gt;Yes, that should be possible. During initialization FDS will tag all pages with an FDS page header. So if you don&amp;#39;t know how many pages the previous firmware configured you can search through all pages. If the first word is 0xDEADC0DE (FDS_PAGE_TAG_MAGIC) and the second tag is either&amp;nbsp;0xF11E01FF (FDS_PAGE_TAG_SWAP) or&amp;nbsp;0xF11E01FE (FDS_PAGE_TAG_DATA), then the page is an FDS page (at least FDS will consider it as one). So if you search downwards from just below the bootloader, and count the number of times you find this pattern you will know the virtual page count.&lt;/p&gt;
[quote user="ajcurtis"]&lt;div&gt;5. Where are these pages located? How does the number of FDS pages affect soft device flash size, application flash size or flash available for dual boot DFU operation?&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Currently our application only supports dual boot DFU mode. The remaining flash for application growth is becoming an issue.&lt;/div&gt;[/quote]
&lt;p&gt;FDS pages are always located immediately below the bootloader (or at the very end of the flash if a bootloader is not present).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/279598?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 23:03:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d596392-661c-4bda-b9a0-a824b97f2b47</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;This is all very interesting. Let me try to bring this down to my reality.&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp;Reducing&amp;nbsp;FDS_VIRTUAL_PAGES causes peer_manager initialization to fail.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is unclear to me the relationship between virtual pages and physical pages. It sounds like they are independent. (it is state above that it may grow) On the other hand it appears from the source code that they number of physical pages is directly related to the number of virtual pages.&lt;/p&gt;
&lt;p&gt;2. The proposed solution is to erase the pages prior to peer manager initialization.&lt;/p&gt;
&lt;p&gt;The peer manager is not part of our application. It is part of the SDK. How do we know what pages to erase? peer_data_storage.h defines&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;PDS_FIRST_RESERVED_RECORD_KEY and&amp;nbsp;&amp;nbsp;PDS_LAST_RESERVED_RECORD_KEY. Do we find the ID for all keys in this range and delete them?&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;3. pm_init() calls pds_init() which calls fds_init(). To erase the peer manager information we would need to fds_init() first. It looks like this will be fine. Just verifying.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;4. Is there a generic way to determine how FDS_VIRTUAL_PAGES was previously configured? It appears that this macro is used to calculate the number of physical pages. Is is possible to read the FDS pages and determine the end and therefore the previous value of FDS_VIRTUAL_PAGES?&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;5. Where are these pages located? How does the number of FDS pages affect soft device flash size, application flash size or flash available for dual boot DFU operation?&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Currently our application only supports dual boot DFU mode. The remaining flash for application growth is becoming an issue.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/279468?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 11:44:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecca8263-bde4-41ef-b276-e72f94b6f832</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="mrono"]If the pages aren&amp;#39;t empty how does the application know it is safe to erase them?[/quote]
&lt;p&gt;Except for the&amp;nbsp;bootloader when it is doing a dual bank update, the only thing that can write to the flash is the application that you (who is&amp;nbsp;developing&amp;nbsp;it) is responsible for. So you need to know the flash layout, and as you make the application you need to let the application &amp;quot;know&amp;quot; whatever it needs to know. That is basically it. In other words: If you never use a flash page for anything (directly or indirectly via FDS or something else), then you know it is safe to erase. And you decide what your applications &amp;quot;knows&amp;quot; as you write it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/279464?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 11:31:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6b6ed79-6d9a-4835-8076-66f51d76fe60</guid><dc:creator>mrono</dc:creator><description>&lt;p&gt;Thank you.&lt;/p&gt;
&lt;p&gt;Just to clarify further: Assuming a &amp;#39;typical&amp;#39; nRF52 flash layout. Nordic&amp;#39;s secure Bootloader, FDS, softdevice and application. No extra flash sections, no other writers to flash than bootloder and FDS. FDS never shrinks, only grows.&lt;/p&gt;
&lt;p&gt;So assuming these conditions, is it possible that we end up in a situation where FDS can&amp;#39;t grow? The scenario I described above occurred to me as a possibility, but I&amp;#39;m not even sure if the bootloader leaves stuff into bank 1 after copying it to bank 0.&lt;/p&gt;
&lt;p&gt;Because if there is a need to increase the size of FDS then there is a need to use those pages as well. So this:&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/66754/first-secure-connection-after-dfu-fails-sdk17-s113/279462#279462"]you would have to delete the &lt;em&gt;new&lt;/em&gt; flash page(s) before you&amp;nbsp;initialize FDS.[/quote]
&lt;p&gt;.. is a bit difficult for the application. If the pages aren&amp;#39;t empty how does the application know it is safe to erase them?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/279462?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 11:08:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60d5cba0-4bb0-42c7-81d0-c162d2ba1199</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I was not clear enough in my previous post.&lt;/p&gt;
[quote user="mrono"]So are you saying that even if one has always reserved the correct amount of pages in both the bootloader and application, and never reduced the number of pages, that increasing the number of pages is still not necessarily safe?[/quote]
&lt;p&gt;No, &lt;em&gt;increasing&lt;/em&gt; the amount of pages is &lt;em&gt;safe&lt;/em&gt;. But you may not be able to actually use&amp;nbsp;the new page(s) for anything useful unless you make sure it is erased before FDS is initialized. That is because FDS will stay away from pages that do not have the FDS page tag but have other content. So it will simply not be used by FDS. But again: this is only if the additional flash pages are not erased (contain other than FF...).&lt;/p&gt;
[quote user="mrono"]&lt;p&gt;I guess the problematic scenario is a case where at some point the application size is just right to completely fill the empty flash using a dual bank update. The next&amp;nbsp; updates are still successful even if size increases, as the update switches to a single bank. But now stale code is left in the last pages that would be used if the FDS needs to grow?&lt;/p&gt;
&lt;p&gt;Am I on the right track here? And the only solution is that the application deletes a page in flash that is not empty but supposedly unused?&lt;/p&gt;[/quote]
&lt;p&gt;Yes. In this case you would have to delete the &lt;em&gt;new&lt;/em&gt; flash page(s) before you&amp;nbsp;initialize FDS. So the logic to do that should be part of the new app you are updating to (which use more FDS pages).&lt;/p&gt;
[quote user="mrono"]Is there a way for the application to know if the page is truly unused, or if it is part of the application itself (ie the flash is truly full)?[/quote]
&lt;p&gt;You will know the size of the app when you build it, but I do not think the app can automatically know that an area is truly unused (perhaps you have some code there that writes to some flash above the end address of the app etc?). But you can know, so that should be OK. As long as you have control of the memory map of your application, you should be good and have the information you need.&lt;/p&gt;
&lt;p&gt;Another approach here is to modify the FDS implementation so that it would not care if a page is empty or not, but simply erase it if it does not have the FDS page tag but is part of the reserved pages.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/279446?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 10:19:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f8d20cc-205f-4999-b4d0-10fd04822f8f</guid><dc:creator>mrono</dc:creator><description>&lt;p&gt;I&amp;#39;m not the original poster (sorry Allen for this sidetrack), but this latest reply seems to have a major impact so I&amp;#39;d like to ask for clarification.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/66754/first-secure-connection-after-dfu-fails-sdk17-s113/279419#279419"]So the only way to get a predictable and&amp;nbsp;consistent&amp;nbsp;behavior when updating an existing product via DFU while changing the number of FDS pages is to delete all those pages before you initialize FDS. In that case all data will be lost, but FDS will&amp;nbsp;initializes the empty pages and you will be good to go.[/quote][quote userid="7377" url="~/f/nordic-q-a/66754/first-secure-connection-after-dfu-fails-sdk17-s113/279419#279419"]1. If you add an additional FDS page, this may or may not be empty. If the page is empty, it will be initialized by FDS and used. If it is not empty, it will not be used (see line 706-711 in fds.c in SDK 17.0.2.[/quote]
&lt;p&gt;So are you saying that even if one has always reserved the correct amount of pages in both the bootloader and application, and never reduced the number of pages, that increasing the number of pages is still not necessarily safe?&lt;/p&gt;
&lt;p&gt;I guess the problematic scenario is a case where at some point the application size is just right to completely fill the empty flash using a dual bank update. The next&amp;nbsp; updates are still successful even if size increases, as the update switches to a single bank. But now stale code is left in the last pages that would be used if the FDS needs to grow?&lt;/p&gt;
&lt;p&gt;Am I on the right track here? And the only solution is that the application deletes a page in flash that is not empty but supposedly unused? Is there a way for the application to know if the page is truly unused, or if it is part of the application itself (ie the flash is truly full)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/279419?ContentTypeID=1</link><pubDate>Wed, 11 Nov 2020 08:34:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4ad94ad-8df0-4fef-9605-22b26974e62a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Changing the number of FDS pages through DFU does not work out of the box. Basically, there are two different scenarios:&lt;/p&gt;
&lt;p&gt;1. If you add an additional FDS page, this may or may not be empty. If the page is empty, it will be initialized by FDS and used. If it is not empty, it will not be used (see line 706-711 in fds.c in SDK 17.0.2.&lt;/p&gt;
&lt;p&gt;2. If you remove FDS pages, then you may&amp;nbsp;remove data and/or swap pages (those shift around after every garbage collection so you can never know). If you remove data page(s), you risk loosing data such as bonding information. If only data pages are deleted, you &amp;quot;just&amp;quot; loose data. If the swap page is removed, fds_init() will return the FDS_ERR_NO_PAGES error.&lt;/p&gt;
&lt;p&gt;So the only way to get a predictable and&amp;nbsp;consistent&amp;nbsp;behavior when updating an existing product via DFU while changing the number of FDS pages is to delete all those pages before you initialize FDS. In that case all data will be lost, but FDS will&amp;nbsp;initializes the empty pages and you will be good to go.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/279350?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 17:26:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbe3b171-a97f-4cec-be54-5a65d6abbd03</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;There is one additional twist to this problem.&lt;/p&gt;
&lt;p&gt;I have verified that the reset issue is due to a mismatch between the the reserved flash size.&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;when the size of FDS_VIRTUAL_PAGES is increased, the first attempt to make a BLE connection causes a reset. However it recovered with the next boot.&lt;/li&gt;
&lt;li&gt;when the size of FDS_VIRTUAL_PAGES is decreased, the device goes into a reset loop where pm_init() returns NRF_INTERNAL_ERROR.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Is there a way to correct this problem? It appears the bonds need to be deleted before the peer manager is initialized to work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/274748?ContentTypeID=1</link><pubDate>Wed, 14 Oct 2020 00:50:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6a6ce0d-8430-4e32-b15e-e14978b8b7bb</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;dfu_data_types.h has this code which confused me. The constant 3 should actually be number of pages or something to make it clearer.&lt;/p&gt;
&lt;p&gt;#ifndef NRF_DFU_APP_DATA_AREA_SIZE&lt;br /&gt;#define NRF_DFU_APP_DATA_AREA_SIZE (CODE_PAGE_SIZE * 3)&lt;br /&gt;#endif&lt;/p&gt;
&lt;p&gt;--------------------------------------------------------------------------------------------------&lt;/p&gt;
&lt;p&gt;Changing the number of &lt;span&gt;FDS_VIRTUAL_PAGES&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;pages to 3, to match the bootloader&amp;nbsp;&lt;span&gt;NRF_DFU_APP_DATA_AREA_SIZE&amp;nbsp;&lt;/span&gt;&lt;span&gt;12288, did resolve the problem!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for the help!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/274417?ContentTypeID=1</link><pubDate>Mon, 12 Oct 2020 16:18:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3219ae28-ecdb-4f7b-80ad-258cf397e296</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Then this cold be the problem. NRF_DFU_APP_DATA_AREA_SIZE is in bytes, and each flash page is 1024 words = 4096 bytes (this is where the 4 comes from in your calculation, and 3 is the number of pages). Your value of 12288 matches 3 FDS pages, not 4.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/274414?ContentTypeID=1</link><pubDate>Mon, 12 Oct 2020 16:11:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60dc35a0-7725-48a8-a3c7-9793e8c6a8f8</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;Application sdk_config.h&lt;br /&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;FDS_VIRTUAL_PAGES&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;4&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Bootloader sdk_config.h&lt;/div&gt;
&lt;div&gt;#define NRF_DFU_APP_DATA_AREA_SIZE 12288&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;This is the current configuration. I believe they match. 1024 page size * 4 num pages * 3 = 12288?&lt;/div&gt;
&lt;div&gt;Not sure why it is x3&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/274413?ContentTypeID=1</link><pubDate>Mon, 12 Oct 2020 16:04:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3a1a27c-3eae-441e-a1cd-701b1991e2dd</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;Einar,&lt;/p&gt;
&lt;p&gt;I believe you hit on the issue. I remember increasing the number of FDS pages from 4 to 5. There was a problem which was resolved with this changed. I need to go back and evaluate this again.&lt;/p&gt;
&lt;p&gt;Will keep you posted.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/274240?ContentTypeID=1</link><pubDate>Mon, 12 Oct 2020 09:22:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:745c4d62-d349-4365-9bef-a300e7de6dcb</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="ajcurtis"]The original logs had service changed enabled for both the application and the bootloader. Later I disabled the service changed notification in the application. There was no change in the bond behavior either way.[/quote]
&lt;p&gt;You should always have service changed enabled both in the bootloader and application. If you don&amp;#39;t use it, then you should remove it in both. (If not, you can end up in a situation where the phone will not do service discovery because it waits for the service changed indication, as it discovered the service changed characteristic before, when device was in the bootloader). I do not think this is related to the issue at hand, though.&lt;/p&gt;
[quote user="ajcurtis"]I believe deleting the bonds on Android would work. However that is not a viable solution for our product. Right now we would rather ship with this defect provided it recovers on the next boot.[/quote]
&lt;p&gt;I agree that is not a viable solution for most products. However, this suggests that the bonding information is lost or corrupted, so it is relevant information.&lt;/p&gt;
[quote user="ajcurtis"]Which FDS configuration is of concern? Here are the option from sdk_config.h. No appdata reserved.[/quote]
&lt;p&gt;I assume this is from the application&amp;#39;s sdk_config.h. Here you reserve 5 pages. Is that the case for both the old and new firmware?&lt;/p&gt;
&lt;p&gt;App data flash pages are reserved differently in different SDK versions. IN the SDK 14 bootloader, this is&amp;nbsp;&amp;nbsp;DFU_APP_DATA_RESERVED, which you typically set as a project vide define or by modifying nrf_dfu_types.h. In SDK 17 this is the&amp;nbsp;NRF_DFU_APP_DATA_AREA_SIZE. In both cases these must be configured to match the number of FDS pages.&lt;/p&gt;
&lt;p&gt;If this is not the problem, then I would very much like to see your application and bootloader projects, both old and new to compare and see if anything sticks out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/274150?ContentTypeID=1</link><pubDate>Sun, 11 Oct 2020 03:24:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:496144aa-1512-4746-97f0-3665c9fd3722</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;Which FDS configuration is of concern? Here are the option from sdk_config.h. No appdata reserved.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;FDS_ENABLED&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;FDS_VIRTUAL_PAGES&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;5&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;FDS_VIRTUAL_PAGE_SIZE&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;1024&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;FDS_VIRTUAL_PAGES_RESERVED&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;FDS_BACKEND&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;2&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;FDS_OP_QUEUE_SIZE&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;4&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;FDS_CRC_CHECK_ON_READ&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;FDS_CRC_CHECK_ON_WRITE&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;#define&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;FDS_MAX_USERS&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;4&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;The original logs had service changed enabled for both the application and the bootloader. Later I disabled the service changed notification in the application. There was no change in the bond behavior either way.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;I will test going from SDK17 S113 7.0.1 to SDK17 S113 7.2.0&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;I believe deleting the bonds on Android would work. However that is not a viable solution for our product. Right now we would rather ship with this defect provided it recovers on the next boot.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/273455?ContentTypeID=1</link><pubDate>Wed, 07 Oct 2020 11:03:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75cbaf7f-d882-4eec-b76b-7332dfdb91f1</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;From older post&lt;/p&gt;
[quote user="ajcurtis"]Could the issue be passing the bond information back to the application from the bootloader when the DFU is complete?&amp;nbsp;[/quote]
&lt;p&gt;No. bonding information only goes from application to bootloader when starting the DFU, but not from the bootloader to application. It is not touched.&lt;/p&gt;
[quote user="ajcurtis"]After more testing, it appears the reset issue reported is related to a bond mismatch between the host and device. There seems to be several failure modes:[/quote]
&lt;p&gt;I do not get a full understanding from the logs, but I think I may have read them too quickly before. It could be that bonding information is deleted during the DFU update. You could verify the FDS page configuration in the application and the reserved appdata in the bootloader. This does not fit what we see with the GATT write, though.&lt;/p&gt;
&lt;p&gt;Some questions, which it would be good to get answered:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Have you looked into uploading a project that can reproduce this on a DK?&lt;/li&gt;
&lt;li&gt;Do you have service changed enabled in both the bootloader and application?&lt;/li&gt;
&lt;li&gt;You mention tha tyou deleted bonding information in Windows, and then you did not see any issues. What was that issue?&lt;/li&gt;
&lt;li&gt;What happens if you delete bonding information on the Android device?&lt;/li&gt;
&lt;li&gt;Do you only see this issue when doing DFU from SDK 14 to SDK 17? What if you DFU in the same SDK 17 or SDK 14 application again (you need to change the version number in the .zip, though)? Same issue?&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/273331?ContentTypeID=1</link><pubDate>Tue, 06 Oct 2020 23:42:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95a1d5e5-aebf-4454-ac8b-ff2d0e9e2565</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;After more testing, it appears the reset issue reported is related to a bond mismatch between the host and device. There seems to be several failure modes:&lt;/p&gt;
&lt;p&gt;Tesing from Windows&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp;Host maintains the bond negotiated for DFU:&amp;nbsp; (both sides have previous bonds)&lt;br /&gt;PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED&lt;br /&gt; 0&amp;gt; PMM: CONNECTED, stored 0 peers&lt;br /&gt;this never crashed but we have a 30 second timer to complete a connection&lt;/p&gt;
&lt;p&gt;2. Host bond is deleted, device has original bond:&lt;br /&gt;This reproduces the reset condition reported. However when it resets it gets&amp;nbsp;PM_EVT_CONN_SEC_FAILED and loops, never completing the connection&lt;/p&gt;
&lt;p&gt;If the bonds are deleted on both sides when the DFU operation is completed, everything works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/273317?ContentTypeID=1</link><pubDate>Tue, 06 Oct 2020 19:33:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cd43c12-78a3-46a6-aefc-0335f5ed3a36</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;Another detail that I should point out is that this is a DFU upgrade of the entire chip.&lt;/p&gt;
&lt;p&gt;from SDK14, S132 v5.0 to SDK17, S113 v7.2.0&lt;/p&gt;
&lt;p&gt;Everything is different, including the format of the bootloader settings file.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/273315?ContentTypeID=1</link><pubDate>Tue, 06 Oct 2020 19:17:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:420f6749-1536-4e0d-91bf-315cc112a4cd</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;Here is a log from a Windows DFU process. The main difference is that in Windows we delete the bonds on both sides after the DFU operation. (work around Windows bug) This works fine.&lt;/p&gt;
&lt;p&gt;Could the issue be passing the bond information back to the application from the bootloader when the DFU is complete?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;0&amp;gt; REBOOT (59)&lt;br /&gt; 0&amp;gt; Bluetooth Name NM04-000078 &lt;br /&gt; 0&amp;gt; Board Type D045 &lt;br /&gt; 0&amp;gt; Model Type ETM &lt;br /&gt; 0&amp;gt; FPGA Ver Model 4 Version 4 &lt;br /&gt; 0&amp;gt; Firmware Ver 2.1.399 &lt;br /&gt; 0&amp;gt; Firmware Type FIELD&lt;br /&gt; 0&amp;gt; SoftDevice Ver 7.2.0&lt;br /&gt; 0&amp;gt; BootLoader Ver 7 (INSTALLED)&lt;br /&gt; 0&amp;gt; Mfg Data Ver 4 &lt;br /&gt; 0&amp;gt; Sys Config Ver 12 &lt;br /&gt; 0&amp;gt; API Versions OK&lt;br /&gt; 0&amp;gt; Bluetooth Enabled &lt;br /&gt; 0&amp;gt; UART Enabled&lt;br /&gt; 0&amp;gt; Stimulation Enabled&lt;br /&gt; 0&amp;gt; Acceleration Disabled (0)&lt;br /&gt; 0&amp;gt; Force Error Disabled (0)&lt;br /&gt; 0&amp;gt; Electrode Map Field 8 Contact&lt;br /&gt; 0&amp;gt; Reboot Reason DFU&lt;br /&gt; 0&amp;gt; &lt;br /&gt; 0&amp;gt; 0:00:00.000 BLE terminated&lt;br /&gt; 0&amp;gt; BLE: Local BDADDR xE49C814C1039&lt;br /&gt; 0&amp;gt; PM: PM_EVT_PEER_DELETE_SUCCEEDED&lt;br /&gt; 0&amp;gt; PM: Bond deleted.&lt;br /&gt; 0&amp;gt; 0:00:01.446 PWR: Entering normal power&lt;br /&gt; 0&amp;gt; 0:00:01.449 STIM STATE: x02&lt;br /&gt; 0&amp;gt; 0:00:01.449 ADV: Sys=FFFFFFFF Dev=0 VBat=3956 Amp={63 63 63 63} Sched=00/FF Err=00 Col=02 Prg=F Ins=0 Post=0 Stim=1 LowP=0 LowB=0 Sess=1 BLE=1 Buzz=0&lt;br /&gt; 0&amp;gt; 0:00:01.573 STIM EVENT[01]: x0E &lt;br /&gt; 0&amp;gt; 0:00:01.574 STIM STATE: x03&lt;br /&gt; 0&amp;gt; SD: 26 BLE_GAP_EVT_ADV_SET_TERMINATED&lt;br /&gt; 0&amp;gt; 0:00:02.110 Detected ID x00000244 (Patient x00000244, Reference xFFFFFFFF)&lt;br /&gt; 0&amp;gt; 0:00:02.110 update_implant_trim_data&lt;br /&gt; 0&amp;gt; 0:00:02.111 Trim not found&lt;br /&gt; 0&amp;gt; 0:00:02.113 Connected to patient device x00000244&lt;br /&gt; 0&amp;gt; 0:00:02.113 STIM EVENT[02]: x0F &lt;br /&gt; 0&amp;gt; 0:00:02.114 STIM STATE: x0E&lt;br /&gt; 0&amp;gt; 0:00:02.119 STIM EVENT[03]: x2B &lt;br /&gt; 0&amp;gt; 0:00:02.119 STIM STATE: x06&lt;br /&gt; 0&amp;gt; 0:00:02.147 ADV: Sys=FFFFFFFF Dev=0 VBat=3956 Amp={63 63 63 63} Sched=00/FF Err=00 Col=02 Prg=F Ins=1 Post=0 Stim=2 LowP=0 LowB=0 Sess=1 BLE=1 Buzz=0&lt;br /&gt; 0&amp;gt; SD: 26 BLE_GAP_EVT_ADV_SET_TERMINATED&lt;br /&gt; 0&amp;gt; SD: 10 BLE_GAP_EVT_CONNECTED&lt;br /&gt; 0&amp;gt; BLE: Remote xD43B041E1733&lt;br /&gt; 0&amp;gt; NCE: bd_addr1 xE49C814C1039&lt;br /&gt; 0&amp;gt; NCE: bd_addr2 xD43B041E1733&lt;br /&gt; 0&amp;gt; PK: device passkey B2A6E8A253D24B8D&lt;br /&gt; 0&amp;gt; BLE: GAP connected. Unauthenticated timer restarted&lt;br /&gt; 0&amp;gt; 0:00:06.232 BLE terminated&lt;br /&gt; 0&amp;gt; SD: 55 BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST&lt;br /&gt; 0&amp;gt; SD: 24 BLE_GAP_EVT_DATA_LENGTH_UPDATE&lt;br /&gt; 0&amp;gt; SD: 3A SD_BLE_GATTC_EXCHANGE_MTU_REQUEST&lt;br /&gt; 0&amp;gt; 0:00:06.331 ADV: Sys=FFFFFFFF Dev=0 VBat=3956 Amp={63 63 63 63} Sched=00/FF Err=00 Col=02 Prg=F Ins=1 Post=0 Stim=2 LowP=0 LowB=0 Sess=1 BLE=0 Buzz=0&lt;br /&gt; 0&amp;gt; SD: 26 BLE_GAP_EVT_ADV_SET_TERMINATED&lt;br /&gt; 0&amp;gt; SD: 11 BLE_GAP_EVT_DISCONNECTED&lt;br /&gt; 0&amp;gt; 0:00:09.759 BLE: Disconnect Reason x0013 (TERM BY HOST)&lt;br /&gt; 0&amp;gt; PMM: DISCONNECTED, active 0xFFFFu keep_bond_state 186785&lt;br /&gt; 0&amp;gt; 0:00:09.817 ADV: Sys=FFFFFFFF Dev=0 VBat=3956 Amp={63 63 63 63} Sched=00/FF Err=00 Col=02 Prg=F Ins=1 Post=0 Stim=2 LowP=0 LowB=0 Sess=1 BLE=1 Buzz=0&lt;br /&gt; 0&amp;gt; SD: 26 BLE_GAP_EVT_ADV_SET_TERMINATED&lt;br /&gt; 0&amp;gt; SD: 10 BLE_GAP_EVT_CONNECTED&lt;br /&gt; 0&amp;gt; BLE: Remote xD43B041E1733&lt;br /&gt; 0&amp;gt; NCE: bd_addr1 xE49C814C1039&lt;br /&gt; 0&amp;gt; NCE: bd_addr2 xD43B041E1733&lt;br /&gt; 0&amp;gt; NONCE: rand_num 9445BE12&lt;br /&gt; 0&amp;gt; PK: device passkey B2A6E8A2524F381F&lt;br /&gt; 0&amp;gt; BLE: GAP connected. Unauthenticated timer restarted&lt;br /&gt; 0&amp;gt; 0:00:31.052 BLE terminated&lt;br /&gt; 0&amp;gt; SD: 55 BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST&lt;br /&gt; 0&amp;gt; 0:00:31.133 ADV: Sys=FFFFFFFF Dev=0 VBat=3956 Amp={63 63 63 63} Sched=00/FF Err=00 Col=02 Prg=F Ins=1 Post=0 Stim=2 LowP=0 LowB=0 Sess=1 BLE=0 Buzz=0&lt;br /&gt; 0&amp;gt; SD: 24 BLE_GAP_EVT_DATA_LENGTH_UPDATE&lt;br /&gt; 0&amp;gt; SD: 3A SD_BLE_GATTC_EXCHANGE_MTU_REQUEST&lt;br /&gt; 0&amp;gt; SD: 13 BLE_GAP_EVT_SEC_PARAMS_REQUEST&lt;br /&gt; 0&amp;gt; PM: PM_EVT_CONN_SEC_START&lt;br /&gt; 0&amp;gt; PM: PM_EVT_CONN_SEC_PARAMS_REQ&lt;br /&gt; 0&amp;gt; SD: 1A BLE_GAP_EVT_CONN_SEC_UPDATE&lt;br /&gt; 0&amp;gt; SD: 19 BLE_GAP_EVT_AUTH_STATUS&lt;br /&gt; 0&amp;gt; PM: PM_EVT_CONN_SEC_SUCCEEDED&lt;br /&gt; 0&amp;gt; PM: Connection secured. Procedure: 1 Role: 1 conn_handle: 0&lt;br /&gt; 0&amp;gt; PMM: CONNECTED, stored 1 peers&lt;br /&gt; 0&amp;gt; PM: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED&lt;br /&gt; 0&amp;gt; pdb_write_buf_get id=0 err=0&lt;br /&gt; 0&amp;gt; sd_ble_gatts_sys_attr_get id=0 err=0&lt;br /&gt; 0&amp;gt; pdb_write_buf_store id=0 err=0&lt;br /&gt; 0&amp;gt; local_db_update_in_evt err=0&lt;br /&gt; 0&amp;gt; PM: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED&lt;br /&gt; 0&amp;gt; PM: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED&lt;br /&gt; 0&amp;gt; SD: 35 SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ&lt;br /&gt; 0&amp;gt; SD: 12 BLE_GAP_EVT_CONN_PARAM_UPDATE&lt;br /&gt; 0&amp;gt; SD: 36 SD_BLE_GATTC_READ&lt;br /&gt; 0&amp;gt; PM: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED&lt;br /&gt; 0&amp;gt; SD: 26 BLE_GAP_EVT_ADV_SET_TERMINATED&lt;br /&gt; 0&amp;gt; SD: 52 BLE_GATTS_EVT_SYS_ATTR_MISSING&lt;br /&gt; 0&amp;gt; PM: PM_EVT_LOCAL_DB_CACHE_APPLIED&lt;br /&gt; 0&amp;gt; SD: 12 BLE_GAP_EVT_CONN_PARAM_UPDATE&lt;br /&gt; 0&amp;gt; SD: 50 BLE_GATTS_EVT_WRITE&lt;br /&gt; 0&amp;gt; B gcm_ble_evt_handler EVT_WRITE&lt;br /&gt; 0&amp;gt; pdb_write_buf_get id=0 err=0&lt;br /&gt; 0&amp;gt; sd_ble_gatts_sys_attr_get id=0 err=0&lt;br /&gt; 0&amp;gt; pdb_write_buf_store id=0 err=0&lt;br /&gt; 0&amp;gt; local_db_update_in_evt err=0&lt;br /&gt; 0&amp;gt; E gcm_ble_evt_handler EVT_WRITE&lt;br /&gt; 0&amp;gt; on_write:453 resp 0&lt;br /&gt; 0&amp;gt; on_write:561 resp 0&lt;br /&gt; 0&amp;gt; PM: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED&lt;br /&gt; 0&amp;gt; SD: 50 BLE_GATTS_EVT_WRITE&lt;br /&gt; 0&amp;gt; B gcm_ble_evt_handler EVT_WRITE&lt;br /&gt; 0&amp;gt; pdb_write_buf_get id=0 err=0&lt;br /&gt; 0&amp;gt; sd_ble_gatts_sys_attr_get id=0 err=0&lt;br /&gt; 0&amp;gt; pdb_write_buf_store id=0 err=0&lt;br /&gt; 0&amp;gt; local_db_update_in_evt err=0&lt;br /&gt; 0&amp;gt; E gcm_ble_evt_handler EVT_WRITE&lt;br /&gt; 0&amp;gt; on_write:453 resp 0&lt;br /&gt; 0&amp;gt; on_write:561 resp 0&lt;br /&gt; 0&amp;gt; PM: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED&lt;br /&gt; 0&amp;gt; SD: 51 BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST&lt;br /&gt; 0&amp;gt; on_write:453 resp 1&lt;br /&gt; 0&amp;gt; BLE_NUS_EVT_HOST_PASSKEY_DATA&lt;br /&gt; 0&amp;gt; BLE: ble_host_passkey[16]=B4 F7 72 7E FF 8C BF 32 0E AB 5A 7A 6F A9 B0 96 &lt;br /&gt; 0&amp;gt; NCE: bd_addr1 xD43B041E1733&lt;br /&gt; 0&amp;gt; NCE: bd_addr2 xE49C814C1039&lt;br /&gt; 0&amp;gt; PK: passkey 0EAB5A7A6FA9B096&lt;br /&gt; 0&amp;gt; PK: ptr 0EAB5A7A6FA9B096&lt;br /&gt; 0&amp;gt; CDB: oldest table[0].timestamp = 51&lt;br /&gt; 0&amp;gt; CDB: table[0].addr = 68EB8938A770, .timestamp = 38158&lt;br /&gt; 0&amp;gt; CDB: oldest table[1].timestamp = 4294967285&lt;br /&gt; 0&amp;gt; CDB: table[1].addr = 5A5F58810DBC, .timestamp = 23936&lt;br /&gt; 0&amp;gt; CDB: oldest table[2].timestamp = 4294967293&lt;br /&gt; 0&amp;gt; CDB: table[2].addr = 4ED340F5FCA343on_write:561 resp 1&lt;br /&gt; 0&amp;gt; status 0 err_code 0&lt;br /&gt; 0&amp;gt; SD: 50 BLE_GATTS_EVT_WRITE&lt;br /&gt; 0&amp;gt; B gcm_ble_evt_handler EVT_WRITE&lt;br /&gt; 0&amp;gt; E gcm_ble_evt_handler EVT_WRITE&lt;br /&gt; 0&amp;gt; on_write:453 resp 0&lt;br /&gt; 0&amp;gt; BLE_NUS_EVT_RX_DATA&lt;br /&gt; 0&amp;gt; 0:00:32.830 BLE detected&lt;br /&gt; 0&amp;gt; &lt;br /&gt; 0&amp;gt; &lt;br /&gt; 0&amp;gt; on_write:561 resp 0&lt;br /&gt; 0&amp;gt; 0:00:32.833 Sess Start&lt;br /&gt; 0&amp;gt; Session Type=Programming&lt;br /&gt; 0&amp;gt; BLE: Connection in session. Session timer restarted&lt;br /&gt; 0&amp;gt; 0:00:32.833 STIM EVENT[04]: x09 (255)&lt;br /&gt; 0&amp;gt; 0:00:32.833 ACK: 001000&lt;br /&gt; 0&amp;gt; &lt;br /&gt; 0&amp;gt; PMM: ENTER_UNPROTECTED, active id=x0000&lt;br /&gt; 0&amp;gt; PM_PEER_DATA_ID_APPLICATION 4&lt;br /&gt; 0&amp;gt; data_id 4&lt;br /&gt; 0&amp;gt; PM: PM_EVT_PEER_DATA_UPDATE_SUCCEEDED&lt;br /&gt; 0&amp;gt; SD: 57 BLE_GATTS_EVT_HVN_TX_COMPLETE&lt;br /&gt; 0&amp;gt; SD: 50 BLE_GATTS_EVT_WRITE&lt;br /&gt; 0&amp;gt; B gcm_ble_evt_handler EVT_WRITE&lt;br /&gt; 0&amp;gt; E gcm_ble_evt_handler EVT_WRITE&lt;br /&gt; 0&amp;gt; on_write:453 resp 0&lt;br /&gt; 0&amp;gt; BLE_NUS_EVT_RX_DATA&lt;br /&gt; 0&amp;gt; &lt;br /&gt; 0&amp;gt; on_write:561 resp 0&lt;br /&gt; 0&amp;gt; 0:00:32.921 Rd Ver&lt;br /&gt; 0&amp;gt; Firmware=2.1.399 SecurityVer=2 AdvertiseVer=4 UnrestictedVer=9 RemoteVer=4 ProgrammingVer=14 EngineeringVer=12 FPGAModel=4 FPGAVer=4 ImplantVer=1 Bootloader=7 SD_FWID=x0102 SD_Ver=7.2.0 Model=ETM Type=FIELD_BLE_UART&lt;br /&gt; 0&amp;gt; 0:00:32.921 ACK: 002016&lt;br /&gt; 0&amp;gt; &lt;br /&gt; 0&amp;gt; SD: 57 BLE_GATTS_EVT_HVN_TX_COMPLETE&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/273314?ContentTypeID=1</link><pubDate>Tue, 06 Oct 2020 19:14:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:258776fd-99c1-44dc-b22e-dca05bb59846</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="ajcurtis"]The PM library knows about the peer. pm_peer_id_get() returns the correct peer ID for the specified connection handle.[/quote]
&lt;p&gt;Yes the peer manager library knows about the peer and according to the log the connection is secured (which happens using the stored bondign information) also the first time, before the error happens.&amp;nbsp;&lt;/p&gt;
[quote user="ajcurtis"]The error isn&amp;#39;t identified until a&amp;nbsp;BLE_GATTS_EVT_WRITE event. The BLE event handler in gatt_cache_manager ultimately causes the error when updating the local DB.[/quote]
&lt;p&gt;&amp;nbsp;I see. So&amp;nbsp;pdb_write_buf_store() returns&amp;nbsp;NRF_ERROR_INVALID_PARAM (7) because the peer ID is not allocated, or so it seems. Is there a timing factor there? What happens if you delay the GATT write?&lt;/p&gt;
[quote user="ajcurtis"]It assumed that the bond used for the secure DFU is preserved and used when the new firmware loads.[/quote]
&lt;p&gt;Yes, the bond is preserved provided you have configured the application and bootloader correctly (so that the bootloader is configured to stay away of the FDS pages). This does not seem to be the problem though: the link is secured, so the boning information is clearly present.&lt;/p&gt;
&lt;p&gt;Do you have any code that can reproduce this on the DK?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/273312?ContentTypeID=1</link><pubDate>Tue, 06 Oct 2020 18:42:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:609a8dd1-cb1e-4099-8d20-5944b8714ffb</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;Yes, it is very strange.&lt;/p&gt;
&lt;p&gt;The PM library knows about the peer. pm_peer_id_get() returns the correct peer ID for the specified connection handle. My initial assumption was that this would fail and I would need to manually add the peer using pm_peer_new().&lt;/p&gt;
&lt;p&gt;The error isn&amp;#39;t identified until a&amp;nbsp;BLE_GATTS_EVT_WRITE event. The BLE event handler in gatt_cache_manager ultimately causes the error when updating the local DB.&lt;/p&gt;
&lt;p&gt;I should also note that this is on Android. It assumed that the bond used for the secure DFU is preserved and used when the new firmware loads.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: first secure connection after DFU fails. SDK17 S113</title><link>https://devzone.nordicsemi.com/thread/273235?ContentTypeID=1</link><pubDate>Tue, 06 Oct 2020 12:58:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:336f20b1-2243-4408-8d7f-2889e570635b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I do not have an explanation for this strange behaviour. There should not be any difference between the first and second time the application runs after reset, and it is odd that the peer manager does not find the bonding information in flash the first time but it suddenly reappears after a reset. Are you able to reproduce this on a DK? Can&amp;nbsp; you share the project so that I can have a look and test on my side?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>