<?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>Reload GATT Handlers after reboot when GATT caching is active</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/127196/reload-gatt-handlers-after-reboot-when-gatt-caching-is-active</link><description>Hi 
 I&amp;#39;m using two nRF52840 devices, one central and one peripheral, and sdk version 3.0.1. 
 On the central side I enabled: 
 
 
 
 
 
 
 
 
 
 
 
 CONFIG_BT_GATT_CACHING=y 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 So far GATT caching works as expected, on normal</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 02 Mar 2026 11:57:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/127196/reload-gatt-handlers-after-reboot-when-gatt-caching-is-active" /><item><title>RE: Reload GATT Handlers after reboot when GATT caching is active</title><link>https://devzone.nordicsemi.com/thread/562312?ContentTypeID=1</link><pubDate>Mon, 02 Mar 2026 11:57:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:954cfdd3-ef6c-42d5-a030-4ccdc871217b</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;If the central reboots and repopulates the attribute table there is no guarantee that the attribute handles stay the same I&amp;#39;m afraid. Using &lt;strong&gt;bt_gatt_resubscribe&lt;/strong&gt;() on the central side would be the recommended way to handle reboots by the central here I think. The&amp;nbsp;&lt;strong&gt;&lt;/strong&gt;the attribute handle you get from&amp;nbsp;&lt;strong&gt;attr_handle = load_handle_by_uuid(my_char_uuid)&lt;/strong&gt;&amp;nbsp;would be invalid after a server reboot as you are not getting the new handle from the central&amp;nbsp;. Invalid here meaning it most likely won&amp;#39;t point to the same attribute anymore. We cannot guarantee the central repopulates the attributes in the same order and the attribute of the interest is never guaranteed to have the same attribute handle after reboot on the server side.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reload GATT Handlers after reboot when GATT caching is active</title><link>https://devzone.nordicsemi.com/thread/562224?ContentTypeID=1</link><pubDate>Fri, 27 Feb 2026 14:00:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3038232e-43e9-4c31-b58f-1fc0ab6cea03</guid><dc:creator>daleonpz</dc:creator><description>&lt;p&gt;Thank you Simon for you reply.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I never call &lt;strong&gt;bt_gatt_service_register&lt;/strong&gt;() in either the central or peripheral code.&lt;br /&gt;&lt;br /&gt;In central I defined all uuid of all the services and characteristics of interest using&lt;br /&gt;&lt;br /&gt;&lt;code&gt;static const struct bt_uuid_128 my_char_uuid =&amp;nbsp;BT_UUID_INIT_128(XXX);&amp;nbsp;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;and then during discovery I call gatt_discover_by_uuid(..) to get the handle and store it in a variable.&lt;br /&gt;&lt;br /&gt;In peripheral I define the services and characteristics using BT_GATT_SERVICE_DEFINE, BT_GATT_PRIMARY_SERVICE and BT_GATT_CHARACTERISTIC.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;BT_GATT_SERVICE_DEFINE already registers the service, so bt_gatt_service_register() is not needed.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I reboot the central using the RST button. The bond information is stored in flash memory and loaded after rebooting, so no bonding information is erased.&lt;br /&gt;&lt;br /&gt;The only problem for me was the value of the attribute handles. I was wondering if there is a way to restore them. Something like this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;settings_load();&lt;/code&gt;&lt;br /&gt;&lt;code&gt;if ( central_bonded () ) {&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;attr_handle = load_handle_by_uuid(my_char_uuid);&lt;/code&gt;&lt;br /&gt;&lt;code&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;because at the end central needs the attr_handle value to write / read characteristics.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;So how can I get the attr_handle in central without rediscovering the characteristics?&amp;nbsp; Is that even possible with the GATT API?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reload GATT Handlers after reboot when GATT caching is active</title><link>https://devzone.nordicsemi.com/thread/562211?ContentTypeID=1</link><pubDate>Fri, 27 Feb 2026 12:48:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e9abc13-54e4-45cf-b62c-587eb7840845</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;This sounds like it&amp;#39;s set up correctly to me. One thing though, from the &lt;strong&gt;bt_gatt_service_register&lt;/strong&gt;() function in gatt.h. When using CONFIG_BT_GATT_CACHING and CONFIG_BT_SETTINGS, all services that are being included in the GATT database should be added before calling settings_load. All services registered after settings_load will trigger a new database hash calculation with a new hash stored. So where are you registering your services exactly?&lt;/p&gt;
&lt;p&gt;Can you also give some more information on how exactly the reboot in central is done. It doesn&amp;#39;t do any erasing of pairing/bonding information when turned off, right?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>