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.

https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-30a089ec70b24d119d2c0d35547f7d8d/prj.conf

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. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    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
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    *** 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
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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)

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
#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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

Fullscreen
1
2
3
4
5
6
7
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);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

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.