<?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>BLE reconnect procedure</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/123078/ble-reconnect-procedure</link><description>Hello there, 
 
 I&amp;#39;m designing a set of devices composed of a remote and 2 peripheral. The remote&amp;#39;s job is to be connected to the 2 peripherals as a central and occasionnaly connect to a smartphone as a peripheral. 
 All of the devices are custom board</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 17 Sep 2025 13:00:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/123078/ble-reconnect-procedure" /><item><title>RE: BLE reconnect procedure</title><link>https://devzone.nordicsemi.com/thread/549035?ContentTypeID=1</link><pubDate>Wed, 17 Sep 2025 13:00:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96bc1004-50f0-4cf0-9276-dd6fe62cad30</guid><dc:creator>Nathan Bourgeois</dc:creator><description>&lt;p&gt;Hi everyone,&lt;/p&gt;
&lt;p&gt;I fix my issue. If someone got the same problem as me, the answer was to correctly use bt_conn_ref and bt_conn_unref at the right place. It is tricky and not well documented, i found out by try and retry many different combinaison until it work.&lt;/p&gt;
&lt;p&gt;Good luck&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE reconnect procedure</title><link>https://devzone.nordicsemi.com/thread/544245?ContentTypeID=1</link><pubDate>Thu, 31 Jul 2025 16:02:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8482720-807c-4f06-abf7-e3c8c4f032c9</guid><dc:creator>Nathan Bourgeois</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I had some breakthough today, some of my previous assumptions were wrong.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;From the central side :&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Start scanning&lt;/li&gt;
&lt;li&gt;Connect to 1st peripheral&lt;/li&gt;
&lt;li&gt;Bond&lt;/li&gt;
&lt;li&gt;Discovery&lt;/li&gt;
&lt;li&gt;Read, write and subscribe to some service while discovering&lt;/li&gt;
&lt;li&gt;Repeat for 2nd peripheral&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I make sure i&amp;#39;m not having errors and the indicate is working. Then, i move a peripheral until it disconnect and i can see the recycled callback being called. SUCCESS&lt;/p&gt;
&lt;p&gt;However, if i do a write operation (bt_gatt_write) with the help of connection context the disconnect event don&amp;#39;t trigger recycled callback anymore. FAILURE&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is very weird, i clean my code to limit every operation to the minimal and i can clearly say that it is the&amp;nbsp;&lt;span&gt;bt_gatt_write function that make my connection object ref wrong. I tried&amp;nbsp;bt_gatt_write_without_response, no luck.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is taking way more time than i expected, i need support.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards&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: BLE reconnect procedure</title><link>https://devzone.nordicsemi.com/thread/544133?ContentTypeID=1</link><pubDate>Wed, 30 Jul 2025 16:09:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2424eb90-1eec-41d4-a76d-a3befd7d49be</guid><dc:creator>Nathan Bourgeois</dc:creator><description>&lt;p&gt;Hello Vidar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I use&amp;nbsp;CONFIG_BT_CONN_LOG_LEVEL_DBG to see what&amp;#39;s going wrong during connection and i figure out that the conn-&amp;gt;ref is higher than expected when i disconnected (like #6 or #7 instead to go as low as #1 to trigger recycled callback)&lt;/p&gt;
&lt;p&gt;I did a lot of testing and the problem is in the discovering procedure. When i&amp;#39;m not doing the discovering, a disconnect trigger recycled callback as expected but as soon as i call&amp;nbsp;bt_gatt_dm_start with the srvc_uuid set to NULL it bug.&lt;/p&gt;
&lt;p&gt;Do you think that i should use zephyr native discovering or shoud i stick with the Nordic implementation?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE reconnect procedure</title><link>https://devzone.nordicsemi.com/thread/543985?ContentTypeID=1</link><pubDate>Tue, 29 Jul 2025 15:19:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5af4ac3-f9cd-4ddf-9223-04719616b4c4</guid><dc:creator>Nathan Bourgeois</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank for the advice, having this &amp;quot;recycled&amp;quot; callback help me to better understand when and how the bt_conn object are released.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I did succeed in avoiding &amp;quot;ghost&amp;quot; bt_conn alive in the ble controler by using bt_conn_ref and bt_con_unref at the right timing. That was tricky and i&amp;#39;m still unsure of what i&amp;#39;m doing but i&amp;#39;m making progress.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;I had comment a discovery procedure for debugging, and uncomment it now because i&amp;#39;m able to re-use bt_conn object. That show a new problem : &lt;strong&gt;the &amp;quot;recycled&amp;quot; callback is not called at disconnect + bt_conn_unref as before.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I dig a little, and found out that if i don&amp;#39;t subscribe to the CCC (i have 2) it work as expected. I found also those KConfig&amp;nbsp;which i play with without success&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_GATT_AUTO_RESUBSCRIBE
CONFIG_BT_SETTINGS_CCC_LAZY_LOADING &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I looked for flag in the&amp;nbsp;bt_gatt_subscribe_params such as&amp;nbsp;BT_GATT_SUBSCRIBE_FLAG_VOLATILE and&amp;nbsp;BT_GATT_SUBSCRIBE_FLAG_NO_RESUB but same as before. The only thing i could change was having a call to my indicate/notify callback when disconnect with data set to NULL.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;Do you have ideas on why the recycled callback is not called when CCC are involved ?&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE reconnect procedure</title><link>https://devzone.nordicsemi.com/thread/543601?ContentTypeID=1</link><pubDate>Fri, 25 Jul 2025 11:31:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86a5105a-9444-4e21-9306-64b7b47cb75d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Please try to register the &amp;quot;recycled&amp;quot; callback (&lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/cba9dceff4e42cf9993bb8c2f66726bb35b463b1/include/zephyr/bluetooth/conn.h#L1723"&gt;https://github.com/zephyrproject-rtos/zephyr/blob/cba9dceff4e42cf9993bb8c2f66726bb35b463b1/include/zephyr/bluetooth/conn.h#L1723&lt;/a&gt;) and submit your scan start work from that callback. To troubleshoot this further, you can also try increase the log level int he&amp;nbsp;&amp;nbsp;bt host. This will make it print out the reference count number every time it is updated for a connection object.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE reconnect procedure</title><link>https://devzone.nordicsemi.com/thread/543210?ContentTypeID=1</link><pubDate>Tue, 22 Jul 2025 13:38:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe6cb2d7-c5fc-4248-ab2f-bf3075df106c</guid><dc:creator>Nathan Bourgeois</dc:creator><description>&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;Hi Tesc,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;Here&amp;#39;s how my software works on the central side (my peripheral works as intended) :&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;1. At boot, i submit a task for handling reconnexion -&amp;nbsp;conn_procedure_work_handler (the same i will use when i disconnect or when i get error)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;2. It will check for existing bond in the ble controler and compare it to ble address i store in nvm&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;3. If there is a match, the central knows it need to reconnect to peripheral and continue. If not, the procedure end there.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;4.Then, it check for existing conn and check if the address of the conn is the same as the ble address in nvm AND if it is connected (i found out that reconnect can be done on already connected device)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;5. In between, i clear, add and remove ble address to accept list&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;6. Now that my accept list has only peripheral with whom i got bond information AND are not connected, i start the&amp;nbsp;bt_conn_le_create_auto.&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;The first reboot after bonding works well, here is the log :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;SEGGER J-Link V8.44a - Real time terminal output
SEGGER J-Link V9.6, SN=69657316
Process: JLink.exe
[00:00:00.003,540] &amp;lt;inf&amp;gt; spi_nor: ZD25WD40B: 512 kiBy flash
*** Booting My Application v0.1.0-d622f54111fe ***
*** Using nRF Connect SDK v3.0.1-9eb5615da66b ***
*** Using Zephyr OS v4.0.99-77f865b8f8d0 ***
[00:00:00.043,853] &amp;lt;dbg&amp;gt; fsm: init_entry: 
[00:00:00.050,567] &amp;lt;inf&amp;gt; fs_nvs: 2 Sectors of 4096 bytes
[00:00:00.050,598] &amp;lt;inf&amp;gt; fs_nvs: alloc wra: 0, fe0
[00:00:00.050,598] &amp;lt;inf&amp;gt; fs_nvs: data wra: 0, 10
[00:00:00.050,750] &amp;lt;dbg&amp;gt; settings_storage: storage_init: EF:30:83:A9:91:DC (random) ==&amp;gt; Right blinker
[00:00:00.050,872] &amp;lt;dbg&amp;gt; settings_storage: storage_init: ED:C1:3A:A4:98:53 (random) ==&amp;gt; Left blinker
[00:00:00.058,898] &amp;lt;inf&amp;gt; fs_nvs: 2 Sectors of 4096 bytes
[00:00:00.058,898] &amp;lt;inf&amp;gt; fs_nvs: alloc wra: 0, fa0
[00:00:00.058,898] &amp;lt;inf&amp;gt; fs_nvs: data wra: 0, bc
[00:00:00.059,020] &amp;lt;inf&amp;gt; bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                            89 9a 50 8a 95 01 9c 58  fc 39 d2 c1 10 04 ee 02 |..P....X .9......
                                            64 ce 25 be                                      |d.%.             
[00:00:00.062,286] &amp;lt;inf&amp;gt; bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.062,316] &amp;lt;inf&amp;gt; bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.062,347] &amp;lt;inf&amp;gt; bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 137.20634 Build 2617349514
[00:00:00.062,622] &amp;lt;inf&amp;gt; bt_hci_core: No ID address. App must call settings_load()
[00:00:00.063,568] &amp;lt;inf&amp;gt; bt_hci_core: Identity: D5:A2:66:B6:4C:6D (random)
[00:00:00.063,598] &amp;lt;inf&amp;gt; bt_hci_core: HCI: version 6.0 (0x0e) revision 0x10f3, manufacturer 0x0059
[00:00:00.063,629] &amp;lt;inf&amp;gt; bt_hci_core: LMP: version 6.0 (0x0e) subver 0x10f3
[00:00:00.066,955] &amp;lt;dbg&amp;gt; fsm: idle_entry: 
[00:00:01.068,328] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection started
[00:00:01.137,512] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 (random) connected
[00:00:01.488,739] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 security changed level 2
[00:00:01.488,861] &amp;lt;dbg&amp;gt; ble: gatt_discover: Discovering started
[00:00:06.238,555] &amp;lt;inf&amp;gt; ble: Discovery completed
[00:00:06.239,929] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection started
[00:00:06.357,818] &amp;lt;inf&amp;gt; ble: EF:30:83:A9:91:DC (random) connected
[00:00:06.746,215] &amp;lt;inf&amp;gt; ble: EF:30:83:A9:91:DC security changed level 2
[00:00:06.746,307] &amp;lt;dbg&amp;gt; ble: gatt_discover: Discovering started
[00:00:11.746,063] &amp;lt;inf&amp;gt; ble: Discovery completed
[00:00:11.747,314] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection stopped (enought connection count)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;The 1st disconnect of one peripheral is also good, i can reconnect to it without issue.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;SEGGER J-Link V8.44a - Real time terminal output
SEGGER J-Link V9.6, SN=69657316
Process: JLink.exe
[00:00:00.003,540] &amp;lt;inf&amp;gt; spi_nor: ZD25WD40B: 512 kiBy flash
*** Booting My Application v0.1.0-d622f54111fe ***
*** Using nRF Connect SDK v3.0.1-9eb5615da66b ***
*** Using Zephyr OS v4.0.99-77f865b8f8d0 ***
[00:00:00.043,853] &amp;lt;dbg&amp;gt; fsm: init_entry: 
[00:00:00.050,567] &amp;lt;inf&amp;gt; fs_nvs: 2 Sectors of 4096 bytes
[00:00:00.050,598] &amp;lt;inf&amp;gt; fs_nvs: alloc wra: 0, fe0
[00:00:00.050,598] &amp;lt;inf&amp;gt; fs_nvs: data wra: 0, 10
[00:00:00.050,750] &amp;lt;dbg&amp;gt; settings_storage: storage_init: EF:30:83:A9:91:DC (random) ==&amp;gt; Right blinker
[00:00:00.050,872] &amp;lt;dbg&amp;gt; settings_storage: storage_init: ED:C1:3A:A4:98:53 (random) ==&amp;gt; Left blinker
[00:00:00.058,898] &amp;lt;inf&amp;gt; fs_nvs: 2 Sectors of 4096 bytes
[00:00:00.058,898] &amp;lt;inf&amp;gt; fs_nvs: alloc wra: 0, fa0
[00:00:00.058,898] &amp;lt;inf&amp;gt; fs_nvs: data wra: 0, bc
[00:00:00.059,020] &amp;lt;inf&amp;gt; bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                            89 9a 50 8a 95 01 9c 58  fc 39 d2 c1 10 04 ee 02 |..P....X .9......
                                            64 ce 25 be                                      |d.%.             
[00:00:00.062,286] &amp;lt;inf&amp;gt; bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.062,316] &amp;lt;inf&amp;gt; bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.062,347] &amp;lt;inf&amp;gt; bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 137.20634 Build 2617349514
[00:00:00.062,622] &amp;lt;inf&amp;gt; bt_hci_core: No ID address. App must call settings_load()
[00:00:00.063,568] &amp;lt;inf&amp;gt; bt_hci_core: Identity: D5:A2:66:B6:4C:6D (random)
[00:00:00.063,598] &amp;lt;inf&amp;gt; bt_hci_core: HCI: version 6.0 (0x0e) revision 0x10f3, manufacturer 0x0059
[00:00:00.063,629] &amp;lt;inf&amp;gt; bt_hci_core: LMP: version 6.0 (0x0e) subver 0x10f3
[00:00:00.066,955] &amp;lt;dbg&amp;gt; fsm: idle_entry: 
[00:00:01.068,328] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection started
[00:00:01.137,512] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 (random) connected
[00:00:01.488,739] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 security changed level 2
[00:00:01.488,861] &amp;lt;dbg&amp;gt; ble: gatt_discover: Discovering started
[00:00:06.238,555] &amp;lt;inf&amp;gt; ble: Discovery completed
[00:00:06.239,929] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection started
[00:00:06.357,818] &amp;lt;inf&amp;gt; ble: EF:30:83:A9:91:DC (random) connected
[00:00:06.746,215] &amp;lt;inf&amp;gt; ble: EF:30:83:A9:91:DC security changed level 2
[00:00:06.746,307] &amp;lt;dbg&amp;gt; ble: gatt_discover: Discovering started
[00:00:11.746,063] &amp;lt;inf&amp;gt; ble: Discovery completed
[00:00:11.747,314] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection stopped (enought connection count)
[00:00:30.788,787] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 (random) disconnected (reason 8)
[00:00:30.790,283] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection started
[00:00:43.892,791] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 (random) connected
[00:00:44.853,698] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 security changed level 2
[00:00:44.853,790] &amp;lt;dbg&amp;gt; ble: gatt_discover: Discovering started
[00:00:51.953,491] &amp;lt;inf&amp;gt; ble: Discovery completed
[00:00:51.954,833] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection stopped (enought connection count)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;However, the 2nd disconnect don&amp;#39;t work and i get an error when i call&amp;nbsp;bt_conn_le_create_auto (error ENOMEM ==&amp;gt; &amp;quot;Not enough core.&amp;quot;).&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;SEGGER J-Link V8.44a - Real time terminal output
SEGGER J-Link V9.6, SN=69657316
Process: JLink.exe
[00:00:00.003,540] &amp;lt;inf&amp;gt; spi_nor: ZD25WD40B: 512 kiBy flash
*** Booting My Application v0.1.0-d622f54111fe ***
*** Using nRF Connect SDK v3.0.1-9eb5615da66b ***
*** Using Zephyr OS v4.0.99-77f865b8f8d0 ***
[00:00:00.043,853] &amp;lt;dbg&amp;gt; fsm: init_entry: 
[00:00:00.050,567] &amp;lt;inf&amp;gt; fs_nvs: 2 Sectors of 4096 bytes
[00:00:00.050,598] &amp;lt;inf&amp;gt; fs_nvs: alloc wra: 0, fe0
[00:00:00.050,598] &amp;lt;inf&amp;gt; fs_nvs: data wra: 0, 10
[00:00:00.050,750] &amp;lt;dbg&amp;gt; settings_storage: storage_init: EF:30:83:A9:91:DC (random) ==&amp;gt; Right blinker
[00:00:00.050,872] &amp;lt;dbg&amp;gt; settings_storage: storage_init: ED:C1:3A:A4:98:53 (random) ==&amp;gt; Left blinker
[00:00:00.058,898] &amp;lt;inf&amp;gt; fs_nvs: 2 Sectors of 4096 bytes
[00:00:00.058,898] &amp;lt;inf&amp;gt; fs_nvs: alloc wra: 0, fa0
[00:00:00.058,898] &amp;lt;inf&amp;gt; fs_nvs: data wra: 0, bc
[00:00:00.059,020] &amp;lt;inf&amp;gt; bt_sdc_hci_driver: SoftDevice Controller build revision: 
                                            89 9a 50 8a 95 01 9c 58  fc 39 d2 c1 10 04 ee 02 |..P....X .9......
                                            64 ce 25 be                                      |d.%.             
[00:00:00.062,286] &amp;lt;inf&amp;gt; bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.062,316] &amp;lt;inf&amp;gt; bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.062,347] &amp;lt;inf&amp;gt; bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 137.20634 Build 2617349514
[00:00:00.062,622] &amp;lt;inf&amp;gt; bt_hci_core: No ID address. App must call settings_load()
[00:00:00.063,568] &amp;lt;inf&amp;gt; bt_hci_core: Identity: D5:A2:66:B6:4C:6D (random)
[00:00:00.063,598] &amp;lt;inf&amp;gt; bt_hci_core: HCI: version 6.0 (0x0e) revision 0x10f3, manufacturer 0x0059
[00:00:00.063,629] &amp;lt;inf&amp;gt; bt_hci_core: LMP: version 6.0 (0x0e) subver 0x10f3
[00:00:00.066,955] &amp;lt;dbg&amp;gt; fsm: idle_entry: 
[00:00:01.068,328] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection started
[00:00:01.137,512] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 (random) connected
[00:00:01.488,739] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 security changed level 2
[00:00:01.488,861] &amp;lt;dbg&amp;gt; ble: gatt_discover: Discovering started
[00:00:06.238,555] &amp;lt;inf&amp;gt; ble: Discovery completed
[00:00:06.239,929] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection started
[00:00:06.357,818] &amp;lt;inf&amp;gt; ble: EF:30:83:A9:91:DC (random) connected
[00:00:06.746,215] &amp;lt;inf&amp;gt; ble: EF:30:83:A9:91:DC security changed level 2
[00:00:06.746,307] &amp;lt;dbg&amp;gt; ble: gatt_discover: Discovering started
[00:00:11.746,063] &amp;lt;inf&amp;gt; ble: Discovery completed
[00:00:11.747,314] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection stopped (enought connection count)
[00:00:30.788,787] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 (random) disconnected (reason 8)
[00:00:30.790,283] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection started
[00:00:43.892,791] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 (random) connected
[00:00:44.853,698] &amp;lt;inf&amp;gt; ble: ED:C1:3A:A4:98:53 security changed level 2
[00:00:44.853,790] &amp;lt;dbg&amp;gt; ble: gatt_discover: Discovering started
[00:00:51.953,491] &amp;lt;inf&amp;gt; ble: Discovery completed
[00:00:51.954,833] &amp;lt;dbg&amp;gt; ble: auto_conn_procedure: Auto connection stopped (enought connection count)
[00:01:12.896,301] &amp;lt;inf&amp;gt; ble: EF:30:83:A9:91:DC (random) disconnected (reason 8)
[00:01:12.897,521] &amp;lt;err&amp;gt; ble: Auto connection start failed (err -12)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;According to comment, this error mean that the controler BLE has not enough free connection object. In my prj.conf, i set&amp;nbsp;&lt;/span&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;CONFIG_BT_MAX_CONN to 3 which make sense with the 1st reconnection working and not the 2nd. What trouble me is that the ble controler should free the bt_conn object at the disconnect callback when i call&amp;nbsp;bt_conn_unref and it seems it don&amp;#39;t.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;hr /&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-family:arial, helvetica, sans-serif;font-size:inherit;"&gt;Here&amp;#39;s my connect and disconnect callback :&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void connected(struct bt_conn *conn, uint8_t conn_err)
{
	int err = 0;
	struct bt_conn_info info;

	char addr[BT_ADDR_LE_STR_LEN];
	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	if (conn_err) {
		LOG_ERR(&amp;quot;%s failed to connect (err %u)&amp;quot;, addr, conn_err);

		bt_conn_unref(conn);

		k_work_schedule(&amp;amp;conn_procedure_work, K_NO_WAIT);
		return;
	}

	LOG_INF(&amp;quot;%s connected&amp;quot;, addr);

	/* Exit here if the remote is acting as a peripheral */
	bt_conn_get_info(conn, &amp;amp;info);
	if (info.role == BT_CONN_ROLE_PERIPHERAL) {
		return;
	}

	/* Pairing */
	err = bt_conn_set_security(conn, BT_SECURITY_L2);
	if (err) {
		LOG_ERR(&amp;quot;%s failed to set security (err %d)&amp;quot;, addr, err);
	}
}

static void disconnected(struct bt_conn *conn, uint8_t reason)
{
	int err = 0;

	char addr[BT_ADDR_LE_STR_LEN];
	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	LOG_INF(&amp;quot;%s disconnected (reason %u)&amp;quot;, addr, reason);
	if (reason == BT_HCI_ERR_CONN_FAIL_TO_ESTAB) {
		/* Delete all possible connection */
		bt_conn_disconnect(conn, BT_HCI_ERR_REMOTE_USER_TERM_CONN);
		k_work_schedule(&amp;amp;conn_procedure_work, K_NO_WAIT);
		return;
	}
	k_event_post(&amp;amp;event, EVENT_BLE_DISCONNECT);

	/* If there is connection context, update state and then release it */
	struct blinker_client_s *blinker_client = bt_conn_ctx_get(&amp;amp;conns_ctx_lib, conn);
	if (blinker_client) {
		bt_si_blinker_set_state(blinker_client-&amp;gt;blinker, STATE_DISCONNECTED);
		bt_conn_ctx_release(&amp;amp;conns_ctx_lib, (void *)blinker_client);
		err = bt_conn_ctx_free(&amp;amp;conns_ctx_lib, conn);
		if (err) {
			LOG_ERR(&amp;quot;%s free connection context failed (err %d)&amp;quot;, addr, err);
		}
	}

	bt_conn_unref(conn);

	k_work_schedule(&amp;amp;conn_procedure_work, K_NO_WAIT);
}&lt;/pre&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE reconnect procedure</title><link>https://devzone.nordicsemi.com/thread/543160?ContentTypeID=1</link><pubDate>Tue, 22 Jul 2025 11:44:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ccc118b-2fb3-45a6-a8e6-50c73037dc00</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]However, i find some issue such as connection to the same device or hci error because no ressource are available. I need help to better understand this procedure and help me make it work.[/quote]
&lt;p&gt;Can you please share the exact error messages that you see, as well as provide a full description of when they are happening?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>