BLE Bonding after power cycle

Product: nRF54L15DK, SDK V2.9.0

Application: Multi protocol (BLE + Matter/Thread) Door Lock

Issue: BLE bonding is not retained after power cycles. The mobile app requests pairing (pop-up window) confirmation from  the user.

Hi,

This can be a extension of Private ticket - Case ID: 341084. 

We discovered the issue and for ease of reproduction for nordic, we tried Matter Lock sample and confirmed the existence of the issues.  The SDK is V2.9.  We did not make any changes  except in prj.conf - we added the  CONFIG_CHIP_NUS, CONFIG_BT_ID_MAX, CONFIG_BT_BONDABLE etc. Please see the attached prj.conf. Built and programmed a nRF54L15DK.

We used nRFconnect App(IOS) to connect to the lock via BLE.

  1. The BLE  connection is successful and the debug info shows that the pairing and bonding occurs. The lock displays the passkey code  to enter into the mobile App (pop-up) window. After entering it connects and the debug locks shows the info (see attached logs from UART).
  2. Disconnect and reconnect - success. The pop-up windows in mobile app does not come up. 
  3. The phone's BLE setting shows the lock as paired and  bonded. See below the logs.
  4. uart:~$ *** Booting My Application v2.9.0-df345e4cda59 ***
    *** Using nRF Connect SDK v2.9.0-7787b2649840 ***
    *** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
    D: LE SC enabled
    I: 1412 [DL]BLE address: F5:13:36:B7:A4:8B
    D: NUS BLE advertising started
    I: No users indexes stored
    I: No stored indexes for credential of type: 1
    D: Cannot load RequirePINforRemoteOperation
    D: Registered new test event: 0xffffffff32774000
    I: 1436 [DL]CHIP task running
    I: Init CHIP stack
    I: 1441 [DL]OpenThread started: OK
    I: 1445 [DL]Setting OpenThread device type to SLEEPY END DEVICE
    I: 1451 [DL]Found DAC Private Key in factory data set. Copying to secure storage...
    I: 1463 [DL]The device does not support hardware protection against write.
    D: Registered new test event: 0xffffffff00000000
    D: Registered new test event: 0xffffffff10000000
    I: 1478 [SVR]Subscription persistence not supported
    I: 1482 [SVR]Server initializing...
    I: 1486 [TS]Last Known Good Time: [unknown]
    I: 1490 [TS]Setting Last Known Good Time to firmware build time 2023-10-14T01:16:48
    I: 1499 [DMG]AccessControl: initializing
    I: 1502 [DMG]Examples::AccessControlDelegate::Init
    I: 1507 [DMG]AccessControl: setting
    I: 1510 [DMG]DefaultAclStorage: initializing
    I: 1514 [DMG]DefaultAclStorage: 0 entries loaded
    D: 1518 [IN]UDP::Init bind&listen port=5540
    E: 1522 [IN]IPV6_PKTINFO failed: 109
    D: 1525 [IN]UDP::Init bound to port=5540
    D: 1529 [IN]BLEBase::Init - setting/overriding transport
    D: 1534 [IN]TransportMgr initialized
    D: 1540 [DL]Using Thread extended MAC for hostname.
    I: 1546 [ZCL]Using ZAP configuration...
    I: 1551 [DMG]AccessControlCluster: initializing
    D: 1555 [DL]Boot reason: 1
    I: 1557 [ZCL]Initiating Admin Commissioning cluster.
    I: 1562 [ZCL]Door Lock server initialized
    I: 1566 [ZCL]Door Lock cluster initialized at endpoint #1
    I: 1571 [ZCL]0xd2af9 ep 1 clus 0x0000_0101 attr 0x0000_0013 not supported
    E: 1577 [ZCL]Failed to set DoorLock number of RFID users: 86
    I: 1583 [DIS]Updating services using commissioning mode 0
    E: 1588 [DIS]Failed to remove advertised services: 3
    E: 1593 [DIS]Failed to finalize service update: 3
    I: 1597 [IN]CASE Server enabling CASE session setups
    D: 1602 [IN]SecureSession[0x200051b0]: Allocated Type:2 LSID:24960
    I: 1608 [SVR]Joining Multicast groups
    I: 1611 [SVR]Server Listening...
    I: 1614 [DL]Device Configuration:
    I: 1617 [DL]  Serial Number: 11223344556677889900
    I: 1622 [DL]  Vendor Id: 65521 (0xFFF1)
    I: 1625 [DL]  Product Id: 32774 (0x8006)
    I: 1629 [DL]  Product Name: not-specified
    I: 1633 [DL]  Hardware Version: 0
    I: 1636 [DL]  Setup Pin Code (0 for UNKNOWN/ERROR): 20202021
    I: 1641 [DL]  Setup Discriminator (0xFFFF for UNKNOWN/ERROR): 3840 (0xF00)
    I: 1648 [DL]  Manufacturing Date: 2022-01-01
    I: 1651 [DL]  Device Type: 65535 (0xFFFF)
    I: 1655 [SVR]SetupQRCode: [MT:8IXS142C00KA0648G00]
    I: 1660 [SVR]Copy/paste the below URL in a browser to see the QR Code:
    I: 1666 [SVR]https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT%3A8IXS142C00KA0648G00
    I: 1675 [SVR]Manual pairing code: [34970112332]
    E: 1679 [DL]Long dispatch time: 240 ms, for event type 2
    D: 
    D: 51:B8:8D:3C:77:32 (random)
    D: No IRK for 51:B8:8D:3C:77:32 (random)
    D: conn 0x20009ae0 handle 0
    D: chan 0x20009d7c cid 0x0006
    D: 51:B8:8D:3C:77:32 (random)
    I: 216628 [DL]Current number of connections: 1/1
    D: 
    D: 51:B8:8D:3C:77:32 (random)
    D: created 0x20019288 for 51:B8:8D:3C:77:32 (random)
    D: prnd 5888cca4b97f3ba5304b99b553f9e5ea
    D: 51:B8:8D:3C:77:32 (random)
    D: 51:B8:8D:3C:77:32 (random)
    D: Received SMP code 0x01 len 6
    D: req: io_capability 0x04, oob_flag 0x00, auth_req 0x0D, max_key_size 0x10, init_key_dist 0x0B, resp_key_dist 0x0B
    D: rsp: io_capability 0x00, oob_flag 0x00, auth_req 0x0D, max_key_size 0x10, init_key_dist 0x02, resp_key_dist 0x00
    D: Received SMP code 0x0c len 64
    D: 
    I: PROVIDE THE FOLLOWING CODE IN YOUR MOBILE APP: 833517
    D: 0x2002cfc5
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf e7ab6cdfb6d6157e2c206aeb5906aa21
    D: cfm e7ab6cdfb6d6157e2c206aeb5906aa21
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 64f21b21304d9bfe068d0610bf464b94
    D: cfm 64f21b21304d9bfe068d0610bf464b94
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 85fc8ef11c192d91423c960bac68b5ce
    D: cfm 85fc8ef11c192d91423c960bac68b5ce
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf cf95fa45a967cb4c8727def953698eb0
    D: cfm cf95fa45a967cb4c8727def953698eb0
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 5d9fcbdf8fbccdb3c3070b5c3390d68f
    D: cfm 5d9fcbdf8fbccdb3c3070b5c3390d68f
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 3e3edc509e6699060b60234b0adedf01
    D: cfm 3e3edc509e6699060b60234b0adedf01
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 41c2dfbffb0446efcaac433c1b4299bd
    D: cfm 41c2dfbffb0446efcaac433c1b4299bd
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 40a2459047701088e20ccaac512c5bfb
    D: cfm 40a2459047701088e20ccaac512c5bfb
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 06cd60d5804964d92001f8229913eefe
    D: cfm 06cd60d5804964d92001f8229913eefe
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 2598ce1e3071fda040014d90e73900be
    D: cfm 2598ce1e3071fda040014d90e73900be
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 239e06d374b7cc4d4c40763152ed1b6a
    D: cfm 239e06d374b7cc4d4c40763152ed1b6a
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf e65d5cb04f37de6c5e19c3d734a7e54d
    D: cfm e65d5cb04f37de6c5e19c3d734a7e54d
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 4e04eae3e69182d8b7489dc8178bb74d
    D: cfm 4e04eae3e69182d8b7489dc8178bb74d
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf b401020b7b7e6728f01b5c6c59d509bf
    D: cfm b401020b7b7e6728f01b5c6c59d509bf
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 4b0e69015ab3af0762999fc009816e7c
    D: cfm 4b0e69015ab3af0762999fc009816e7c
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 6caa4dd58eeb25b4baef40d22ee55e51
    D: cfm 6caa4dd58eeb25b4baef40d22ee55e51
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf f4e15d5bd451afcbc1667f875b01b65e
    D: cfm f4e15d5bd451afcbc1667f875b01b65e
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 8bc32cd20af165360ba2f4817601e3a3
    D: cfm 8bc32cd20af165360ba2f4817601e3a3
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 7478d114dc6d9e38a14d69ebd7c31423
    D: cfm 7478d114dc6d9e38a14d69ebd7c31423
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 64009935130541497889aadb46342e86
    D: cfm 64009935130541497889aadb46342e86
    D: Received SMP code 0x0d len 16
    D: 
    D: 
    D: 51:B8:8D:3C:77:32 (random) (keys 0x0000)
    D: 51:B8:8D:3C:77:32 (random)
    D: created 0x20019288 for 51:B8:8D:3C:77:32 (random)
    D: chan 0x20009d7c conn 0x20009ae0 handle 0 encrypt 0x01 hci status 0x00 
    D: NUS BT Security changed: 51:B8:8D:3C:77:32 (random) level 4
    D: 51:B8:8D:3C:77:32 (random)
    D: Received SMP code 0x08 len 16
    D: 
    D: type 2 51:B8:8D:3C:77:32 (random)
    D: type 2 51:B8:8D:3C:77:32 (random)
    D: 51:B8:8D:3C:77:32 (random)
    D: Received SMP code 0x09 len 7
    D: identity CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    D: type 2 51:B8:8D:3C:77:32 (random)
    D: type 2 51:B8:8D:3C:77:32 (random)
    D: CC:27:46:DF:BA:30 (public)
    D: got status 0x0
    I: SC LTK: 0x23b885003bcf6ddafbdd8d97a1abf3a0
    D: Stored keys for CC:27:46:DF:BA:30 (public)
    D: NUS BT Pairing completed: CC:27:46:DF:BA:30 (public), bonded: 1
    D: chan 0x20009d7c cid 0x0006
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    I: 247714 [DL]Current number of connections: 0/1
    D: conn 0x20009ae0 handle 1
    D: chan 0x20009d7c cid 0x0006
    D: CC:27:46:DF:BA:30 (public)
    I: 251812 [DL]Current number of connections: 1/1
    D: 
    D: CC:27:46:DF:BA:30 (public)
    D: prnd ac224a34751ee6d8fda7a3357c896daa
    D: chan 0x20009d7c conn 0x20009ae0 handle 1 encrypt 0x01 hci status 0x00 
    D: NUS BT Security changed: CC:27:46:DF:BA:30 (public) level 4
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    D: NUS received: 6 bytes
    D: Received UNLOCK command from NUS
    I: Unlock action initiated
    I: Updating LockState attribute
    I: Unlock action completed
    I: Updating LockState attribute
    D: NUS received: 4 bytes
    D: Received LOCK command from NUS
    I: Lock action initiated
    I: Updating LockState attribute
    I: Lock action completed
    I: Updating LockState attribute
    D: chan 0x20009d7c cid 0x0006
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    I: 288456 [DL]Current number of connections: 0/1
    

Then, reboot the lock:

  1. Reboot the lock. The logs shows that the BLE bond settings are loaded. See below for the logs.
  2. Connect to the lock using nRFconnect(the same phone/mobile app).
  3. The lock displays the code and the mobile app displays the pop-up windows. Enter the code and connection is made. 
  4. The BLE settings in the iphone shows 2nd entry. 
  5. It shows that bonding is not restored after power cycles. 
  6. *** Booting My Application v2.9.0-df345e4cda59 ***
    *** Using nRF Connect SDK v2.9.0-7787b2649840 ***
    *** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
    
    D: LE SC enabled
    D: name cc2746dfba300/1 val 1011220000000000000000000000a0f3aba1978dddfbda6dcf3b0085b82382feeb6b8fa0507f090984e214b695d632773c8db851000000000000000000000000
    D: CC:27:46:DF:BA:30 (public)
    D: created 0x20019288 for CC:27:46:DF:BA:30 (public)
    D: Successfully restored keys for CC:27:46:DF:BA:30 (public)
    I: SC LTK: 0x23b885003bcf6ddafbdd8d97a1abf3a0
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public) (keys 0x0022)
    I: 365789 [DL]BLE address: D9:3F:38:51:31:8C
    D: NUS BLE advertising started
    I: No users indexes stored
    I: No stored indexes for credential of type: 1
    D: Cannot load RequirePINforRemoteOperation
    D: Registered new test event: 0xffffffff32774000
    I: 365815 [DL]CHIP task running
    I: Init CHIP stack
    I: 365820 [DL]OpenThread started: OK
    I: 365823 [DL]Setting OpenThread device type to SLEEPY END DEVICE
    I: 365830 [DL]The device does not support hardware protection against write.
    D: Registered new test event: 0xffffffff00000000
    D: Registered new test event: 0xffffffff10000000
    I: 365845 [SVR]Subscription persistence not supported
    I: 365850 [SVR]Server initializing...
    I: 365853 [TS]Last Known Good Time: 2023-10-14T01:16:48
    I: 365859 [DMG]AccessControl: initializing
    I: 365862 [DMG]Examples::AccessControlDelegate::Init
    I: 365867 [DMG]AccessControl: setting
    I: 365871 [DMG]DefaultAclStorage: initializing
    I: 365875 [DMG]DefaultAclStorage: 0 entries loaded
    D: 365879 [IN]UDP::Init bind&listen port=5540
    E: 365883 [IN]IPV6_PKTINFO failed: 109
    D: 365887 [IN]UDP::Init bound to port=5540
    D: 365891 [IN]BLEBase::Init - setting/overriding transport
    D: 365896 [IN]TransportMgr initialized
    D: 365901 [DL]Using Thread extended MAC for hostname.
    I: 365906 [ZCL]Using ZAP configuration...
    I: 365910 [DMG]AccessControlCluster: initializing
    D: 365915 [DL]Boot reason: 6
    I: 365917 [ZCL]Initiating Admin Commissioning cluster.
    I: 365922 [ZCL]Door Lock server initialized
    I: 365926 [ZCL]Door Lock cluster initialized at endpoint #1
    I: 365932 [ZCL]0xd2af9 ep 1 clus 0x0000_0101 attr 0x0000_0013 not supported
    E: 365938 [ZCL]Failed to set DoorLock number of RFID users: 86
    I: 365944 [DIS]Updating services using commissioning mode 0
    E: 365949 [DIS]Failed to remove advertised services: 3
    E: 365954 [DIS]Failed to finalize service update: 3
    I: 365958 [IN]CASE Server enabling CASE session setups
    D: 365963 [IN]SecureSession[0x200051b0]: Allocated Type:2 LSID:31044
    I: 365970 [SVR]Joining Multicast groups
    I: 365973 [SVR]Server Listening...
    I: 365976 [DL]Device Configuration:
    I: 365979 [DL]  Serial Number: 11223344556677889900
    I: 365984 [DL]  Vendor Id: 65521 (0xFFF1)
    I: 365988 [DL]  Product Id: 32774 (0x8006)
    I: 365992 [DL]  Product Name: not-specified
    I: 365995 [DL]  Hardware Version: 0
    I: 365999 [DL]  Setup Pin Code (0 for UNKNOWN/ERROR): 20202021
    I: 366004 [DL]  Setup Discriminator (0xFFFF for UNKNOWN/ERROR): 3840 (0xF00)
    I: 366011 [DL]  Manufacturing Date: 2022-01-01
    I: 366015 [DL]  Device Type: 65535 (0xFFFF)
    I: 366019 [SVR]SetupQRCode: [MT:8IXS142C00KA0648G00]
    I: 366024 [SVR]Copy/paste the below URL in a browser to see the QR Code:
    I: 366030 [SVR]https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT%3A8IXS142C00KA0648G00
    I: 366039 [SVR]Manual pairing code: [34970112332]
    E: 366044 [DL]Long dispatch time: 227 ms, for event type 2
    D: 
    uart:~$ D: 51:B8:8D:3C:77:32 (random)
    D: No IRK for 51:B8:8D:3C:77:32 (random)
    D: conn 0x20009ae0 handle 0
    D: chan 0x20009d7c cid 0x0006
    D: 51:B8:8D:3C:77:32 (random)
    I: 441237 [DL]Current number of connections: 1/1
    D: 
    D: 51:B8:8D:3C:77:32 (random)
    D: created 0x20019288 for 51:B8:8D:3C:77:32 (random)
    D: prnd 39f116cddba2331394f921e4f1cf4b3b
    D: 51:B8:8D:3C:77:32 (random)
    D: 51:B8:8D:3C:77:32 (random)
    D: Received SMP code 0x01 len 6
    D: req: io_capability 0x04, oob_flag 0x00, auth_req 0x0D, max_key_size 0x10, init_key_dist 0x0B, resp_key_dist 0x0B
    D: rsp: io_capability 0x00, oob_flag 0x00, auth_req 0x0D, max_key_size 0x10, init_key_dist 0x02, resp_key_dist 0x00
    D: Received SMP code 0x0c len 64
    D: 
    I: PROVIDE THE FOLLOWING CODE IN YOUR MOBILE APP: 660247
    D: 0x2002cfc5
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 1bfd1fdb2fc2c1af05d4d4c505045e93
    D: cfm 1bfd1fdb2fc2c1af05d4d4c505045e93
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 2ba05512d8cb8301fcd059755557750d
    D: cfm 2ba05512d8cb8301fcd059755557750d
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 3a6865fbd4f68884da54f31f2994807a
    D: cfm 3a6865fbd4f68884da54f31f2994807a
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 65f1a8356839ffc1b4a270cdd3faec85
    D: cfm 65f1a8356839ffc1b4a270cdd3faec85
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf fbcb4ea69c242b03c02b8013bf339499
    D: cfm fbcb4ea69c242b03c02b8013bf339499
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 9bfabf4184dae0c8744874c5a7dfcfe7
    D: cfm 9bfabf4184dae0c8744874c5a7dfcfe7
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf f6bfe1f98a147a0d1fca41927e61941a
    D: cfm f6bfe1f98a147a0d1fca41927e61941a
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 702178fa4ac98632f50efa6a35acba85
    D: cfm 702178fa4ac98632f50efa6a35acba85
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 105c912f8afaabbe2769cb17211762ba
    D: cfm 105c912f8afaabbe2769cb17211762ba
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf de000b5a178d33fb932f4f7541d9d9bf
    D: cfm de000b5a178d33fb932f4f7541d9d9bf
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 13a5528a446bd4b1fb8c3d5b5cabd7d0
    D: cfm 13a5528a446bd4b1fb8c3d5b5cabd7d0
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf d969223aa443836a1cf120afc7c89a5d
    D: cfm d969223aa443836a1cf120afc7c89a5d
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 8a11233ea0e299337fb8c3ad47a3be51
    D: cfm 8a11233ea0e299337fb8c3ad47a3be51
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf ce6687f95ed397f01c36836dcc991c75
    D: cfm ce6687f95ed397f01c36836dcc991c75
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 31048d02f51871e243438709d338a676
    D: cfm 31048d02f51871e243438709d338a676
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 5a8d6ca62fd083b517287bad606b18c6
    D: cfm 5a8d6ca62fd083b517287bad606b18c6
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 41fbb6428a6fe811a3bc28e90e03c3b1
    D: cfm 41fbb6428a6fe811a3bc28e90e03c3b1
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf a8a033b4832c28bd02e4d4df38a2e5eb
    D: cfm a8a033b4832c28bd02e4d4df38a2e5eb
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf 3be5cd26f6957534fb72d8f1530698e3
    D: cfm 3be5cd26f6957534fb72d8f1530698e3
    D: Received SMP code 0x03 len 16
    D: 
    D: Received SMP code 0x04 len 16
    D: 
    D: pcnf b45c9e1a00042463e1d059810d2d55b4
    D: cfm b45c9e1a00042463e1d059810d2d55b4
    D: Received SMP code 0x0d len 16
    D: 
    D: 
    D: 51:B8:8D:3C:77:32 (random) (keys 0x0000)
    D: 51:B8:8D:3C:77:32 (random)
    D: created 0x20019288 for 51:B8:8D:3C:77:32 (random)
    D: chan 0x20009d7c conn 0x20009ae0 handle 0 encrypt 0x01 hci status 0x00 
    D: NUS BT Security changed: 51:B8:8D:3C:77:32 (random) level 4
    D: 51:B8:8D:3C:77:32 (random)
    D: Received SMP code 0x08 len 16
    D: 
    D: type 2 51:B8:8D:3C:77:32 (random)
    D: type 2 51:B8:8D:3C:77:32 (random)
    D: 51:B8:8D:3C:77:32 (random)
    D: Received SMP code 0x09 len 7
    D: identity CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    D: type 2 51:B8:8D:3C:77:32 (random)
    D: type 2 51:B8:8D:3C:77:32 (random)
    D: CC:27:46:DF:BA:30 (public)
    D: got status 0x0
    I: SC LTK: 0x1a7794b9a5d0cf763840605c3c8e1d86
    D: Stored keys for CC:27:46:DF:BA:30 (public)
    D: NUS BT Pairing completed: CC:27:46:DF:BA:30 (public), bonded: 1
    D: chan 0x20009d7c cid 0x0006
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    I: 461805 [DL]Current number of connections: 0/1
    D: conn 0x20009ae0 handle 1
    D: chan 0x20009d7c cid 0x0006
    D: CC:27:46:DF:BA:30 (public)
    I: 462841 [DL]Current number of connections: 1/1
    D: 
    D: CC:27:46:DF:BA:30 (public)
    D: prnd d328a34d784a72ffb6a1fa9bc97154f5
    D: chan 0x20009d7c conn 0x20009ae0 handle 1 encrypt 0x01 hci status 0x00 
    D: NUS BT Security changed: CC:27:46:DF:BA:30 (public) level 4
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    D: chan 0x20009d7c cid 0x0006
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    I: 464925 [DL]Current number of connections: 0/1
    D: conn 0x20009ae0 handle 2
    D: chan 0x20009d7c cid 0x0006
    D: CC:27:46:DF:BA:30 (public)
    I: 472588 [DL]Current number of connections: 1/1
    D: 
    D: CC:27:46:DF:BA:30 (public)
    D: prnd a5a471ebad73520b7fe7d3a5a3f09b05
    D: chan 0x20009d7c conn 0x20009ae0 handle 2 encrypt 0x01 hci status 0x00 
    D: NUS BT Security changed: CC:27:46:DF:BA:30 (public) level 4
    D: CC:27:46:DF:BA:30 (public)
    D: CC:27:46:DF:BA:30 (public)
    

We confirmed with Android also. 

Nordic has recommended that we add settings_save and settings_load. We tried here (i don't it is needed since it is loaded by Matter services, but is a Nordic recommendation for BLE bonding)

#ifdef CONFIG_CHIP_NUS
	/* Initialize Nordic UART Service for Lock purposes */
	if (!Nrf::GetNUSService().Init(kLockNUSPriority, kAdvertisingIntervalMin, kAdvertisingIntervalMax)) {
		ChipLogError(Zcl, "Cannot initialize NUS service");
	}
	settings_load();
	
	Nrf::GetNUSService().RegisterCommand("Lock", sizeof("Lock"), NUSLockCallback, nullptr);
	Nrf::GetNUSService().RegisterCommand("Unlock", sizeof("Unlock"), NUSUnlockCallback, nullptr);
	if (!Nrf::GetNUSService().StartServer()) {
		LOG_ERR("GetNUSService().StartServer() failed");
	}
#endif

 

void NUSService::PairingComplete(bt_conn *conn, bool bonded)
{
	if (!GetNUSService().mIsStarted)
		return;
	settings_save();
	LOG_DBG("NUS BT Pairing completed: %s, bonded: %d", LogAddress(conn), bonded);
}

 

The above do not make any impact.

We played with changing various configuration parameters without any success. 

 

Please let us know the solution to retain the bonding information, specifically not make the Mobile App to put out the pop-up windows, pair and bond again after lock reboot (power cycle).

In this example, we used NUS services so that you can reproduce.  We are using BLE Security Level 2: Encrypted with unauthenticated pairing i.e. we are not using passkey or code since the door lock lacks IO.

 

Parents
  • Hi Subu Muthu, 
    If you take a look at this ticket: RE: Adding custom BLE services to Matter 

    You can find that "Bonding cannot be enabled for Matter BLE services, as this makes it non-compliant with the Matter specification due to the requirement that a static random address shall be used for Matter BLE service advertising purposes."

    So when you reset your device the address (static random address) will be changed and the phone won't be able to detect the board as previously bonded and will make a new bond as you already noticed. 

    One option to solve the issue is not to use the Matter's arbiter; instead, you can handle the advertisement yourself directly in the service using the extended advertisement API. You would need to create one extra Bluetooth ID and use this Bluetooth ID to do advertising with the address that the peer can recognize (either static address or resolvable random address. 

Reply
  • Hi Subu Muthu, 
    If you take a look at this ticket: RE: Adding custom BLE services to Matter 

    You can find that "Bonding cannot be enabled for Matter BLE services, as this makes it non-compliant with the Matter specification due to the requirement that a static random address shall be used for Matter BLE service advertising purposes."

    So when you reset your device the address (static random address) will be changed and the phone won't be able to detect the board as previously bonded and will make a new bond as you already noticed. 

    One option to solve the issue is not to use the Matter's arbiter; instead, you can handle the advertisement yourself directly in the service using the extended advertisement API. You would need to create one extra Bluetooth ID and use this Bluetooth ID to do advertising with the address that the peer can recognize (either static address or resolvable random address. 

Children
No Data
Related