<?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>Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/56766/buttonless-dfu-with-bonding</link><description>Good afternoon, 
 I first devoloped my app based on the nRF52840 (SDK 15.2; S140 V.6.1.0) and it was perfectly working with or without bonds. 
 After that, and following what it is shown in this link ( https://devzone.nordicsemi.com/nordic/nordic-blog</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 06 Feb 2020 11:38:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/56766/buttonless-dfu-with-bonding" /><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/233031?ContentTypeID=1</link><pubDate>Thu, 06 Feb 2020 11:38:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f93d464-2cf0-4172-b606-fd96af98c13b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Dani,&lt;/p&gt;
&lt;p&gt;Yes, I would like the full project folders, so that it includes the toolchain/IDE configuration, main.c file, sdk_config.h file etc. (for example everything within &amp;lt;SDK&amp;gt;/examples/ble_peripheral/ble_app_template/ if that was the example, and same with DFU bootloader).&lt;/p&gt;
&lt;p&gt;Can you make a new private case and upload it there if you do not want the code to be public? Please refer to this thread when doing so.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/232959?ContentTypeID=1</link><pubDate>Thu, 06 Feb 2020 07:59:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8b7564e-d681-4151-b80e-bfa993206f2a</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Can I send a private message directly to you?&lt;/p&gt;
&lt;p&gt;Do you need the full folder?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/232958?ContentTypeID=1</link><pubDate>Thu, 06 Feb 2020 07:55:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ec00681-4dd9-4585-a73b-7c595c5444dc</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Dani,&lt;/p&gt;
&lt;p&gt;That should not be the case when using service changed. Can you upload your complete bootloader project and application project here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/232843?ContentTypeID=1</link><pubDate>Wed, 05 Feb 2020 13:01:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b61c5171-096c-4373-be12-98545d1b67a3</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Is the same: DFU works correctly but if I do not select a &amp;#39;manual refresh&amp;#39;, I&amp;#39;m back to same situation: only DFU services are shown.&lt;/p&gt;
&lt;p&gt;Dani&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/232838?ContentTypeID=1</link><pubDate>Wed, 05 Feb 2020 12:56:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4db1e12-1b9a-4e9b-92ac-fea929c03109</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Dani,&lt;/p&gt;
[quote user="dtarrago"]Before implementing fix suggested by Vidar, I have directly gone to first point you have suggested in last answer: now, nRFToolbox is crashing but I have succeeded with nRF Connect application. After DFU update, the situation was the same (only DFU services were observed) but after selecting and connecting again to the bonded device, all application services appear again after going to options and selecting &amp;#39;Refresh Services&amp;#39;.[/quote]
&lt;p&gt;That is good. It is expected that the phone can discover all the services when you tell it to do service discovery. The problem is that this should have been automatic when you issue a service changed. What happens if you do DFU again at this point, but not &amp;quot;manually&amp;quot; select refresh service when entering the application again. Do the application&amp;#39;s services appear then, or is it back to the old behavior?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/232796?ContentTypeID=1</link><pubDate>Wed, 05 Feb 2020 11:28:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:719811df-be22-4a11-83a8-1e88a535958d</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Some new information for you:&lt;/p&gt;
&lt;p&gt;Before implementing fix suggested by Vidar, I have directly gone to first point you have suggested in last answer: now, nRFToolbox is crashing but I have succeeded with nRF Connect application. After DFU update, the situation was the same (only DFU services were observed) but after selecting and connecting again to the bonded device, all application services appear again after going to options and selecting &amp;#39;Refresh Services&amp;#39;.&lt;/p&gt;
&lt;p&gt;Dani.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/232051?ContentTypeID=1</link><pubDate>Fri, 31 Jan 2020 10:32:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb86daf8-b3cf-4ffd-99f8-9658baafd964</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Dani,&lt;/p&gt;
&lt;p&gt;I did not remember that issue, but yes, this could very well be the problem. You can check if the same thing happens in your case using a sniffer, or simply implement the fix as suggested by Vidar in that thread (which you should do anyway).&lt;/p&gt;
&lt;p&gt;With the that fixed I cannot think of any likely reasons for this issue, but if you are still stuck, there are a few things worth doing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Could it be that the phone has cached the services form before you added service changed characteristic to both the bootloader and application (if ever)? If so, then you should remove the bonding information and toggle BLE off and on on the phone to clear it&amp;#39;s cache.&amp;nbsp;Then fully erase the nRF and program the bootloader and application again. In this case, the phone should be aware of the issue&lt;/li&gt;
&lt;li&gt;If still not sure if the phone could have cached something from before service changed characteristic was added, you could change the MAC address of the nRF (remember to do so both in app and bootloader in that case), or simply test with a new phone.&lt;/li&gt;
&lt;li&gt;If the above also doe snot work, then it would be useful with a sniffer trace to see what is actually happening on-air (is the service change indication sent, ...?)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/231887?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 12:51:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c62ef45b-93c4-47ce-9d94-edfb4ec40886</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I have implemented what you have suggested:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Function for handling Peer Manager events.
 *
 * @param[in] p_evt  Peer Manager event.
 */
static void pm_evt_handler(pm_evt_t const * p_evt)
{
    pm_conn_sec_config_t config;
	
	pm_handler_on_pm_evt(p_evt);
    pm_handler_flash_clean(p_evt);

    switch (p_evt-&amp;gt;evt_id)
    {
        case PM_EVT_PEERS_DELETE_SUCCEEDED:
            advertising_start();
            break;
				
		case PM_EVT_CONN_SEC_CONFIG_REQ:
			config.allow_repairing = true;
			pm_conn_sec_config_reply(p_evt-&amp;gt;conn_handle, &amp;amp;config);
			break;
				
		case PM_EVT_BONDED_PEER_CONNECTED:
			pm_local_database_has_changed();
			break;

        default:
            break;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And the result is the same.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using SDK 15.2.0. I do not know if there is any issue related with this and with also what is commented in this thread (&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/46633/peer-manager-silently-drop-service-changed-indications-if-an-att-mtu-exchange-was-happening/204968#204968"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/46633/peer-manager-silently-drop-service-changed-indications-if-an-att-mtu-exchange-was-happening/204968#204968&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dani&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/231818?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 09:42:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64459889-94ec-4910-ac94-f64ca9421fb8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi dani,&lt;/p&gt;
&lt;p&gt;You can for instance call&amp;nbsp;pm_local_database_has_changed() when you get the&amp;nbsp;PM_EVT_BONDED_PEER_CONNECTED event, but the timing is not critical since it is buffered ant sent when the peer connects if called &amp;quot;too&amp;quot; early. See &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__peer__manager.html"&gt;API doc for&amp;nbsp;pm_local_database_has_changed()&lt;/a&gt;&amp;nbsp;for details.&lt;/p&gt;
&lt;p&gt;(Ideally, you should only call&amp;nbsp;pm_local_database_has_changed() the first time the bonded peer connects after a DFU, though the only consequence of calling every time is that the center will perform service discovery every time, which may not be a problem).&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/231796?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 08:18:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:460fc282-af5c-4ee5-9637-00235a79864f</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;In my application, at which point should I call &amp;#39;pm_local_database_has_changed&amp;#39;?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Dani&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230898?ContentTypeID=1</link><pubDate>Fri, 24 Jan 2020 14:31:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f89cfadb-f0fa-480c-8756-622e8cd5db63</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Dani,&lt;/p&gt;
[quote user="dtarrago"]So, how can we go ahead?[/quote]
&lt;p&gt;Summing up:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The remaining issue is that you only see the DFU service after entering the application after a DFU upgrade.&lt;/li&gt;
&lt;li&gt;You have verified that the application and not bootloader is running.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If the application is running and you know it has other BLE services but these are not shown on the central side, this must be because the central has not done service discovery, which it should have if you have service changed. Can you try to call&amp;nbsp;pm_local_database_has_changed() in your application? If you do not have any progress it would be good if you could upload your completed application project and bootloader project so that I can see (you can upload it in a private case if you don&amp;#39;t want it public).&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230783?ContentTypeID=1</link><pubDate>Fri, 24 Jan 2020 08:06:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89367a9a-fe31-4d99-9d48-f030ff618af4</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Eimar,&lt;/p&gt;
&lt;p&gt;You said..&lt;/p&gt;
&lt;p&gt;&lt;em&gt;As I understand, you have verified that the device is in the application and not in the bootloader?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Yes, as the device is perfectly working in what regards functionality.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You said..&lt;/p&gt;
&lt;p&gt;&lt;em&gt;But you only see the DFU service on the phone, and not any of the services in your application?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Yes, after DFU is performed, device works perfectly but I only see DFU service.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You said...&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp;If so, the problem is that the phone have not done a service discovery, which it should have done automatically if you use service changed properly. Is that enabled in both the application and bootloader?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Yes. I have set&amp;nbsp;NRF_SDH_BLE_SERVICE_CHANGED to 1 in both application and bootloader.&lt;/p&gt;
&lt;p&gt;So, how can we go ahead?&lt;/p&gt;
&lt;p&gt;All the best,&lt;/p&gt;
&lt;p&gt;Dani.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230730?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2020 18:22:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:230feca5-6f11-4893-8fb8-51cb6254f61f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Dani,&lt;/p&gt;
&lt;p&gt;What we have discussed in the last days should hopefully solve this part of the problem:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;But I have more information: up to now I was doing all the tests with the LG K4 (Android 6.0.1). I have just tested the same process with a Xiami Mi6 and now the DFU process is perfectly working. But...&lt;/em&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;What does it happen with bonding after application update? After DFU, an as it should be, my module is reseted and starts working again but, when I try to connect again with it with BLE (using the same app I normally use), it is not possible to succeed. In order to correctly connect again with it, I have to erase bonding information from the Smartphone, and then everything works. How can I manage bonding in order to avoid this situation to happen after DFU?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;But not this part:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;I have also tried to check behavior with &amp;#39;nRF Connect&amp;#39; tool after this succesful DFU process: as the device is already bonded, it appears in bonded list, and when I try to connect, I only am able to see the characteristics related to DFU service (but device is not working in DFU mode, as apart of BLE connection, it is perfectly working).&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;..which is the same you see now. As I understand, you have verified that the device is in the application and not in the bootloader? But you only see the DFU service on the phone, and not any of the services in your application? If so, the problem is that the phone have not done a service discovery, which it should have done automatically if you use service changed properly. Is that enabled in both the application and bootloader?&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230685?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2020 15:00:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12338b59-eb0d-4092-943b-4a5b918ce987</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;As described by you, I have done the following settings:&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;Aplication:&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;FDS_VIRTUAL_PAGES 6 (bonding info, garbage,...)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Flash (Data):&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;/em&gt;&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;//Preserved data blocks address:&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;#define FLASH_ADR_FINAL_FLASH&amp;nbsp;(u32) 0x000f2000&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;#define FLASH_ADR_INI_PAGE_1 (u32)(FLASH_ADR_FINAL_FLASH-0x1000)&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;#define FLASH_ADR_INI_PAGE_2 (u32)(FLASH_ADR_INI_PAGE_1-0x1000) &lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;#define FLASH_ADR_INI_PAGE_3 (u32)(FLASH_ADR_INI_PAGE_2-0x1000) &lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;#define FLASH_ADR_INI_PAGE_4 (u32)(FLASH_ADR_INI_PAGE_3-0x1000) &lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NRF_FSTORAGE_DEF:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;.start_addr = FLASH_ADR_INI_PAGE_4&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;.end_addr = FLASH_ADR_FINAL_FLASH&lt;/strong&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;Bootloader:&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;NRF_DFU_APP_DATA_AREA_SIZE 40960 (10 pages: 6 VIRTUAL + 4 data)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I use fstorage API (as before) in order to manage data writing and reading (preserved data)&lt;/p&gt;
&lt;p&gt;DFU process is succesful, but after this, the problem is the same: when I try to connect again with same device (already bonded in my smartphone), it connects but services that are shown belong to DFU service:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Screenshot_5F00_2020_2D00_01_2D00_23_2D00_15_2D00_56_2D00_04_2D00_023_5F00_no.nordicsemi.android.mcp.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;Only if I desynchronize device in my smartphone and pair/bond it again is when I can normally connect again.&lt;/p&gt;
&lt;p&gt;So, which is the problem? Have I been wrong?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dani.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230581?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2020 11:48:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68ef01dc-4c43-43f4-9989-ae7491eb4cb0</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Dani,&lt;/p&gt;
&lt;p&gt;If you have not considered it, you can store other application data using FDS as well. If you do, you do not need to touch any fstorage API. In many cases, FDS is a better choice, but not always. It depends on what you are doing. But it is key to understand what you are doing, so that the memory layout makes sense and there is no overlapping, and that the bootloader is configured accordingly.&lt;/p&gt;
&lt;p&gt;A bond is typically about&amp;nbsp;104 bytes (26 words), but it can vary a bit. So you can fit quite a few bonds per flash page.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230540?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2020 10:18:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c631ca15-ca67-47d4-9f10-2c23ae70026e</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;First of all, thank you so much for your answers.&lt;/p&gt;
&lt;p&gt;First, I think that I was a bit confused with FDS and fstorage.&lt;/p&gt;
&lt;p&gt;Now, I use NRF_FSTORAGE_DEF in my application in the way I sent you. Do I need to do this? Do I need to define this boundaries?&lt;/p&gt;
&lt;p&gt;In fact, what I really want is:&lt;/p&gt;
&lt;p&gt;- To have 4 pages (or more) in order to preserve my application data: here I have already implemented this in order to write and read equipment parameters using functions as: nrf_fstorage_erase, nrf_fstorage_write, nrf_fstorage_read,...&lt;/p&gt;
&lt;p&gt;- To have enough space to save bonding information allowing the device to save bonding information for several devices to which my device is able to connect to. How can I determine how much space is required for a bonding set? How can I know the number of connections (bondings) that can be saved?&lt;/p&gt;
&lt;p&gt;Taking into account this information, which implementation do you reccommend me to follow in my application?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dani.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230528?ContentTypeID=1</link><pubDate>Thu, 23 Jan 2020 09:52:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ea9089e-ec2d-4eaa-a552-7e3a37c495fa</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Dani,&lt;/p&gt;
&lt;p&gt;The key here is to have a full overview of your memory layout, and once you do, the configuration becomes obvious.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You write that your bootloader starts at&amp;nbsp;0x000f8000. So everything above there is off limits.&lt;/li&gt;
&lt;li&gt;Immediately below the bootloader, you find the FDS pages, (which use fstorage for low-level flash accesss). Is this the&amp;nbsp;NRF_FSTORAGE_DEF you refer to, or do you also use this in your application directly? If so, this overlaps with the FDS pages and will cause problems.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you use both fstorage directly (4 pages) and FDS (6 pages) via peer manager for storing bonds, then your memory layout should look something like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-689cc93d98be4694b6aad257f977d24c/mem_5F00_layout.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;If this is the case and you indeed use fstorage directly, you must modify it so that it does not overlap with FDS by changing your code like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;NRF_FSTORAGE_DEF(nrf_fstorage_t fstorage) =
{
    /* Set a handler for fstorage events. */
    .evt_handler = fstorage_evt_handler,

    /* These below are the boundaries of the flash space assigned to this instance of fstorage.
    * You must set these manually, even at runtime, before nrf_fstorage_init() is called.
    * The function nrf5_flash_end_addr_get() can be used to retrieve the last address on the
    * last page of flash available to write data. */
    .start_addr = 0x000ee000,
    .end_addr = 0x000f2000,
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And this means that your bootloader needs to stay away from 10 pages, so&amp;nbsp;NRF_DFU_APP_DATA_AREA_SIZE = 10*1024*4 = 40960.&lt;/p&gt;
&lt;p&gt;Regarding the bootloader start address, it is whatever you set it to be in the linker settings, just as the application. And then there are a few tricks that is used to put this into the UICR register that the MBR checks. This is all done for you though, so you normally do not need to care about the details. If you are interested, you can search for &amp;quot;uicr_bootloader_start_address&amp;quot; through the SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230397?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2020 14:47:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d62cde8f-cafc-4ceb-bf25-ac268b0aa4ec</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using 4 pages in flash in order to preserve some application data.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;In what regards Application I have the following definitions:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;-&amp;nbsp;FDS_VIRTUAL_PAGES 6&lt;/p&gt;
&lt;p&gt;- Definition of the pages where I&amp;#39;m saving data (I have defined 6 pages but I&amp;#39;m only using 4. And I think there is one page that is used by the system, right?):&lt;/p&gt;
&lt;p&gt;NRF_FSTORAGE_DEF(nrf_fstorage_t fstorage) =&lt;br /&gt;{&lt;br /&gt; /* Set a handler for fstorage events. */&lt;br /&gt; .evt_handler = fstorage_evt_handler,&lt;/p&gt;
&lt;p&gt;/* These below are the boundaries of the flash space assigned to this instance of fstorage.&lt;br /&gt; * You must set these manually, even at runtime, before nrf_fstorage_init() is called.&lt;br /&gt; * The function nrf5_flash_end_addr_get() can be used to retrieve the last address on the&lt;br /&gt; * last page of flash available to write data. */&lt;br /&gt; .start_addr = 0x000f4000,&lt;br /&gt; .end_addr = 0x000f8000,&lt;br /&gt;};&lt;/p&gt;
&lt;p&gt;Should I consider the other pages I&amp;#39;m not using in this NRF_FSTORAGE_DEF call?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;And in what regards bootloader I have:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;- NRF_DFU_APP_DATA_AREA_SIZE 24576&amp;nbsp; &amp;nbsp;(6 pages)&lt;/p&gt;
&lt;p&gt;I have stated that Bootloader starting address is&amp;nbsp;0x000f8000. I have fixed this value but, is there any function that gives this address? (This is to have this well managed, as a problem would raise when updating softdevice and Bootloader address changes)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, where can I have my problem?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dani&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230315?ContentTypeID=1</link><pubDate>Wed, 22 Jan 2020 11:41:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8577400b-0e9c-4dc1-9a11-dbc97a2d2b62</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Dani,&lt;/p&gt;
&lt;p&gt;Based on what you write here, it seems that the bonding information is overwritten when you do DFU. This can happen if the bootloader configuration does not match your applicaiton&amp;#39;s configuration.&lt;/p&gt;
&lt;p&gt;Bonding information is handled by the peer manager library, which stores it using FDS. The FDS pages are always located immediately below the bootloader in the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/lib_bootloader.html"&gt;memory layout&lt;/a&gt;. The application&amp;#39;s sdk_config.h file has a FDS_VIRTUAL_PAGES, which is typically set to 3, but you may have modified it? A page is 4 kB.&lt;/p&gt;
&lt;p&gt;The bootloader on the other hand, needs to be told to stay away from this memory, and not use it for temporarily storing update images (when doing dual bank updates). The bootloader&amp;#39;s sdk_config.h file use NRF_DFU_APP_DATA_AREA_SIZE for this. This is in bytes rather than pages, so the default value of 12288 corresponds to 3 pages. If you for insstance use 5 pages in your application, the NRF_DFU_APP_DATA_AREA_SIZE should instead be set to 5*1024*4= 20480.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230108?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2020 14:30:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c297f51e-e1d6-4a8b-bc6d-4035ae1c6569</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Yes, I have the device bonded first...&lt;/p&gt;
&lt;p&gt;But I have more information: up to now I was doing all the tests with the LG K4 (Android 6.0.1). I have just tested the same process with a Xiami Mi6 and now the DFU process is perfectly working. But...&lt;/p&gt;
&lt;p&gt;What does it happen with bonding after application update? After DFU, an as it should be, my module is reseted and starts working again but, when I try to connect again with it with BLE (using the same app I normally use), it is not possible to succeed. In order to correctly connect again with it, I have to erase bonding information from the Smartphone, and then everything works. How can I manage bonding in order to avoid this situation to happen after DFU?&lt;/p&gt;
&lt;p&gt;I have also tried to check behavior with &amp;#39;nRF Connect&amp;#39; tool after this succesful DFU process: as the device is already bonded, it appears in bonded list, and when I try to connect, I only am able to see the characteristics related to DFU service (but device is not working in DFU mode, as apart of BLE connection, it is perfectly working).&lt;/p&gt;
&lt;p&gt;Any suggestion?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dani.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230064?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2020 12:35:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07d502fe-a056-43d2-84be-82df868d5b4d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Dani,&lt;/p&gt;
&lt;p&gt;As you noted, you must check the &amp;quot;bond&amp;quot; button since you are sharing the bond with the bootloader (if just pairing without bonding, the kets etc. are&amp;nbsp;just valid for the current connection).&lt;/p&gt;
&lt;p&gt;From where do you get&amp;nbsp;GATT_INVALID_HANDLE when using nRFToolbox on the Android phone? Have you made sure to bond first, not just pair?&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/230017?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2020 09:31:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebef3d29-8e90-431f-a9d1-b6db9454b88b</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi again,&lt;/p&gt;
&lt;p&gt;Now, with nRFConnect (desktop app) is working but I need to select the following option when pairing:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/DFU_5F00_nRFConnect_5F00_5.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;And with the nRFToolbox (Android app), it does not work: I get the message GATT_INVALID_HANDLE when starting DFU, and device gets stuck in DFU mode...&lt;/p&gt;
&lt;p&gt;Hope you can give me any answer with all this information.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dani.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/229998?ContentTypeID=1</link><pubDate>Tue, 21 Jan 2020 08:20:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:752cff8c-aa89-4822-9a49-8a398844c48d</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;I found I was getting this message because device was in debug mode. Now, it is not in debug mode but I&amp;#39;m getting a different message:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/DFU_5F00_nRFConnect_5F00_4.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;Trying to guess which is the problem....&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/229934?ContentTypeID=1</link><pubDate>Mon, 20 Jan 2020 16:39:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48fa002f-bcda-4937-ad51-41f9d8e650c6</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Now, the application is working but when carrying out DFU process, it does not work --&amp;gt; when using &amp;#39;nRF Connect&amp;#39; desktop application, I get the following message:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/DFU_5F00_nRFConnect_5F00_3.JPG" /&gt;&lt;/p&gt;
&lt;p&gt;Any suggestion?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dani&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless DFU with bonding</title><link>https://devzone.nordicsemi.com/thread/229932?ContentTypeID=1</link><pubDate>Mon, 20 Jan 2020 16:26:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4edcf2e4-b902-46f5-b176-eaf78d0289f4</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi again!!!!&lt;/p&gt;
&lt;p&gt;Seems to be solved by placing &amp;#39;peer_manager_init&amp;#39; before &amp;#39;services_init&amp;#39; in the main menu.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dani.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>