<?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>Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45817/issue-with-resetting-ble-peripheral-device-after-bonding-pm_evt_local_db_cache_apply_failed</link><description>Hi, 
 I have an issue with bonding and resetting my BLE Peripheral device (NRF52832) after the bonding process is complete. Currently I press a button that initiates the bonding procedure, after that the central device (e.g my smartphone) bonds with the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Apr 2019 15:29:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45817/issue-with-resetting-ble-peripheral-device-after-bonding-pm_evt_local_db_cache_apply_failed" /><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/181686?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2019 15:29:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:305f1905-03e0-4a13-aa6f-2593faea82ee</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Yes, it looks OK to me. As mentioned earlier this is not really critical, just the system attribute need to be updated after you change the attribute table, and it&amp;#39;s updated&amp;nbsp;on the first connection after the change.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/181667?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2019 14:20:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:803da26a-9f70-4669-89ce-946fb462530e</guid><dc:creator>AntonHellbe</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Can you take a look at my reply?&lt;br /&gt;&lt;br /&gt;Br,&lt;br /&gt;Anton&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/181216?ContentTypeID=1</link><pubDate>Wed, 10 Apr 2019 06:35:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4e7ea5f-5948-4050-8ed7-e38de8c18ede</guid><dc:creator>AntonHellbe</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;So If I understand you correctly this would be the sequence you are describing:&lt;/p&gt;
&lt;p&gt;Enable Pairing/Bonding (No NUS enabled) -&amp;gt; Connect with Central device -&amp;gt; Bond -&amp;gt; Disconnect and reset nRF5832 into mode with NUS -&amp;gt; Connect with Central -&amp;gt; Re-enable CCCDs -&amp;gt; Disconnect -&amp;gt; Connect.&lt;br /&gt;&lt;br /&gt;This above sequence works for me. At first reconnect after bonding and resetting I get PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED. Enabling the CCCDs triggers update of the Peer Data (PM_EVT_PEER_DATA_UPDATE_SUCCEEDED). Disconnecting and reconnecting after enabling the CCCDs now gives the event PM_EVT_LOCAL_DB_CACHE_APPLIED.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/181127?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 15:12:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2e4c8af-a182-468e-8f5f-c165cbbc8fbd</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I&amp;#39;m not so sure, but if you add the NUS&amp;nbsp;at the bottom of the attribute table shouldn&amp;#39;t cause an issue. Anyway I don&amp;#39;t think this would be a serious bug. If you can check and verify that you have your CCCDs re-enabled after you disconnect and reconnect (not the first time) then it&amp;#39;s fine.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/180899?ContentTypeID=1</link><pubDate>Tue, 09 Apr 2019 06:18:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd116efe-1ea9-4125-b41f-4c089b417b00</guid><dc:creator>AntonHellbe</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I have not found any assertion regarding to this, I just noticed this by having a log statement inside some of the events in the PM event handler. &lt;br /&gt;&lt;br /&gt;One thing that I noticed that I found strange is that I dont receive the error (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED) If I have NUS enabled during pairing, then resetting into a mode that does not have NUS enabled. So it seems like removing CCCD:s after pairing/bonding is OK but adding CCCD:s triggers PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED.&lt;br /&gt;&lt;br /&gt;So where do we land on this issue? Can it be just ignored since it&amp;#39;s just a warning, or can it have any consequences for the application?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/180835?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2019 15:31:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:900322b3-3a5e-464b-83e5-ee74e9eeebc0</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I think your theory is correct. When you change the attribute table, and then you want to apply the system attribute from the old attribute table, the softdevice will complain.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t looked into how to properly solve this , but as far as I know this is just a warning , so it&amp;#39;s not an assert if softdevice return PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED. It&amp;#39;s just some CCCD can&amp;#39;t be restored. And it will be stored correctly next time you reconnect (if you don&amp;#39;t continue to change the attribute table again).&lt;/p&gt;
&lt;p&gt;Where did you find the assertion when you receive this&amp;nbsp;PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/180644?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2019 07:04:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c78c8567-3817-491d-8416-a32b05b5c251</guid><dc:creator>AntonHellbe</dc:creator><description>&lt;p&gt;Hi Hung,&lt;br /&gt;&lt;br /&gt;I have an idea why it might I&amp;#39;m getting &lt;span&gt;PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED&lt;/span&gt;. Perhaps you can confirm or deny it.&lt;br /&gt;&lt;br /&gt;As I have explained in one of my previous comments the nRF52832 is a slave device that has different modes. The mode when the nRF5832 accepts pairing/bonding does not have NUS/QWR enabled. However the mode that it gets put in after pairing/bonding does have NUS/QWR enabled.&lt;br /&gt;&lt;br /&gt;So my theory about this issue is that when the nRF52832 resets after pairing/bonding and we initialize NUS which changes the attribute table has changed (because we have added NUS) and therefor Peer Manager is unable to apply the Local DB cache. What do you think?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/180640?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2019 06:39:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68de4b3d-1e40-4e4e-a657-ff30521dc06c</guid><dc:creator>AntonHellbe</dc:creator><description>&lt;p&gt;Another observation is that It does not seem to matter if I wait a long time before doing the reset (I.e the time between bonding and resetting the device is not the issue?) Because I&amp;#39;ve tried doing it with doing a manual reset and waiting &amp;gt;10s after bonding and the issue still persist.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/180639?ContentTypeID=1</link><pubDate>Mon, 08 Apr 2019 06:34:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30d9e83b-c2a7-4f0f-bb7d-6f0e172a9218</guid><dc:creator>AntonHellbe</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I tried what you suggested, in &lt;span&gt;PM_EVT_PEER_DATA_UPDATE_SUCCEEDED&lt;/span&gt; I disconnect the Central device using sd_ble_gap_disconnect and when I receive the disconnect event in the BLE event handler I perform the reset. I still get the &lt;span&gt;PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Why a reset after bonding?&lt;br /&gt;It&amp;#39;s quite hard to explain but the short version is that the nRF52832 is a slave device that has different modes, another MCU (master device) controls it and the transitions between different modes is done through resetting the nRF52832 and initializing only the components needed for that mode.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/180551?ContentTypeID=1</link><pubDate>Fri, 05 Apr 2019 15:39:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bce51b70-a1c7-4568-9bc4-125e2d03866c</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I don&amp;#39;t think NUS or QWR has anything to do with flash.&lt;/p&gt;
&lt;p&gt;More likely since you comment out NUS, you don&amp;#39;t have any CCCD value in your attribute table, so&amp;nbsp;&lt;span&gt;PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED won&amp;#39;t appear.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I don&amp;#39;t think doing a reset inside&amp;nbsp;PM_EVT_PEER_DATA_UPDATE_SUCCEEDED&amp;nbsp;event handler is the best way. I would suggest to do a disconnect, and when you have Disconnected event, you can trigger a reset in main.c&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;May I ask why you want to do a reset after a bonding?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/180490?ContentTypeID=1</link><pubDate>Fri, 05 Apr 2019 12:20:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8159b358-5226-4242-b3a7-1676079a10cf</guid><dc:creator>AntonHellbe</dc:creator><description>&lt;p&gt;I do the reset of the nRF52832 inside the PM_EVT_PEER_DATA_UPDATE_SUCCEEDED event with the two following preconditions&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;p_evt-&amp;gt;params.peer_data_update_succeeded.flash_changed
&amp;amp;&amp;amp; p_evt-&amp;gt;params.peer_data_update_succeeded.data_id == PM_PEER_DATA_ID_BONDING
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/180486?ContentTypeID=1</link><pubDate>Fri, 05 Apr 2019 12:07:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf5051d3-3a31-4e73-a21b-d9609e4915bc</guid><dc:creator>AntonHellbe</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I trigger the reset after the first connection after the bond.&lt;/p&gt;
&lt;p&gt;I have done some research and I think I have found the cause. I removed the initialization of Nordic UART Service (which also uses the QWR-module. After that I dont receive the error &lt;span&gt;PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED after connecting after a reset.&lt;br /&gt;&lt;br /&gt;Can QWR or NUS interfere with writing to the flash?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with resetting BLE Peripheral device after bonding (PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED)</title><link>https://devzone.nordicsemi.com/thread/180478?ContentTypeID=1</link><pubDate>Fri, 05 Apr 2019 11:27:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52eb1261-560d-45db-bef2-94f27653014f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Anton,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please clarify, you mentioned this sequence &amp;quot;&lt;span&gt;connect-&amp;gt; bond -&amp;gt; disconnect -&amp;gt; connect -&amp;gt; reset -&amp;gt; connect &amp;quot; showed the error. But when exactly you trigger the reset ? On the first connection after bond or on the second ? In the sequence above, it&amp;#39;s the second re-connection after bonding.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do you see the same problem if you test using ble_app_proximity (adding code to do a reset) ? Which phone did you use for testing ?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The&amp;nbsp;PM_EVT_LOCAL_DB_CACHE_APPLY_FAILED error happens when we try to apply the system attribute (CCCD value) on a saved connection but it doesn&amp;#39;t match with the attribute table. Suspecting corrupted flash operation. We need to find the place where we store the system attribute and try to avoid resetting before it&amp;#39;s finished flashing.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>