This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

peer_manager_handler: BLE_GAP_SEC_STATUS_AUTH_REQ at Re-pairing causes every following connection to fail until reset

Hi all,

I discovered that if I get BLE_GAP_SEC_STATUS_AUTH_REQ while pairing, the device is basically useless until a new reset. I would be extremely grateful for some help in understanding how to build a workaround as it seems coming from the softdevice.

The way I got this "bug" is by simply running a DEBUG version of our firmware, including the Nordic SDK, with the CLI open. I think the key of this error comes from the re-pairing process, which I rarely noticed in our logs.

```

[00003722] <info> BLEDriver: Bonding started.
[00003722] <info> SecurityService: Bonding in progress.
[00003723] <info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Bonding
[00003723] <info> BLEDriver: Connection secured: role: peripheral, conn_handle: 0x0, procedure: 1.
[00003723] <info> SecurityService: Secured.
[00003723] <info> BLEDriver: Bonding started.
[00003723] <info> SecurityService: Bonding in progress.
[00003723] <info> BLEDriver: Re-pairing requested. Will be allowed.
[00003723] <info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Bonding, error: 131
[00003723] <info> BLEDriver: Failed to secure connection!
[00003723] <info> SecurityService: Securing failed.
[00003941] <info> BLEDriver: Fast advertising.
[00003941] <info> BLEDriver: Disconnected.
[00003953] <info> BLEDriver: Connected.
[00003954] <info> BLEDriver: Encryption started.
[00003954] <info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Encryption, error: 4102
[00003954] <info> BLEDriver: Failed to secure connection!
[00003954] <info> SecurityService: Securing failed.
[00003954] <info> BLEDriver: Fast advertising.
[00003954] <info> BLEDriver: Disconnected.
[00003954] <info> SecurityService: Not bonded.

```

The reasons why I am reporting this are two: firstly, to let you know of the occurrence, given that coming from the SD is hardly debuggable by anyone outside Nordic, secondly because it really confuses(?) the PeerManager at the point where only a reset(software or hardware) is able to "fix" the issue. So I wonder if you could suggest any smart workaround maybe to avoid the reset.

I was connecting to the Nordic module using Bluetoothctl from a Linux machine. I don't manage to reproduce it.

Many thanks in advance.

SDK: 17.0.2
SD: s140 - 7.2.0
bluetoothctl: 5.48

  • Hi,

    I think the error is BLE_GAP_SEC_STATUS_AUTH_REQ(Authentication requirements not met.)

    https://devzone.nordicsemi.com/f/nordic-q-a/52166/nfc-pairing-failed-false-nfc-pairing-131-error-0x00083-error-how-to-modify-the-code

    Maybe there are some changes in the security requirements for the re-pairing that triggers this.

  • Hi Sigurd,

    Thanks for the reply. You are very right! Apologies for the mistake. Unfortunately this seems confusing a fair bit the PeerManager causing the following behaviour:

    BLEDriver 
      disconnect          delete-lowest-peer  peer-list
    BLEDriver 
      disconnect          delete-lowest-peer  peer-list
    BLEDriver peer-list 
    Number of peer : 4
    peer id #0: 0
    peer id #1: 1
    peer id #2: 2
    peer id #3: 3
    BLEDriver 
      disconnect          delete-lowest-peer  peer-list
    BLEDriver delete-lowest-peer 
    [00004310] <info> BLEDriver: Number of peer : 4
    [00004310] <info> BLEDriver: Deleting lowest ranked peer (peer_id: 0)
    BLEDriver peer-list
    Number of peer : 4
    peer id #0: 1
    peer id #1: 2
    peer id #2: 3
    BLEDriver delete-lowest-peer
    [00004323] <info> BLEDriver: Number of peer : 4
    [00004323] <info> BLEDriver: Deleting lowest ranked peer (peer_id: 1)
    BLEDriver peer-list
    Number of peer : 4
    peer id #0: 2
    peer id #1: 3
    BLEDriver delete-lowest-peer
    [00004341] <info> BLEDriver: Number of peer : 4
    [00004341] <error> BLEDriver: There are no peers to delete.
    BLEDriver peer-list
    Number of peer : 4
    peer id #0: 2
    peer id #1: 3

    Any clue on why is that happening following such failure?
    Until a reset is performed any new connection try will fail in:

    [00004230] <info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Encryption, error: 4102

  • Hi,

    This "BLEDriver", is it pc-ble-driver-py you are using?

    I don't manage to reproduce it.

    It only happened once, and you are no longer able to reproduce it?

  • Hi Sigurd,

    Thanks for the response.

    No it's not the pc-ble-driver-py, it's just one of our modules called that way, but it's basically a wrapper around the SDK APIs. I recognize that not being able to reproduce it means that it's hardly happening, but it really shouldn't freeze the peer manager in that way. Any device in the field, of any nature, that will have that error will become essentially useless, and if you deal with consumer electronics it's not something acceptable, even with small % of cases. I am sorry to not being able to provide you with more details for now, but please keep an eye open for this.

Related