arduino / arduino/ArduinoCore-mbed

BLE pairing protocol allways ends up with SEC_STATUS_UNSPECIFIED

Open
#376 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
C
Stars
411
Forks
225
PR merge metrics
No merged PRs in 30d

Description

No matter how you configure the SecurityManager, the pairing protocol ends up with **"SEC_STATUS_UNSPECIFIED"** (0x88) at the "pairingResult" event, in the peripheral's side (Mbed API). On the central's side, it ends up with a timeout.

Board: Arduino Nano 33 BLE.
Tested both in Android (nRF app) and Windows 10 (with BT 5.0 radio).
Core version: tested both 2.6.1 and current master branch (downloaded FEATURE_BLE and BLE driver folders, only)

Pairing is mandatory in Windows 10 API in order to retrieve services and characteristics, so this is a blocking issue.

This is the involved code (not the full code):
```c++
// Stack initialization
BLE& ble = BLE::Instance();
ble_error_t error = ble.init();
ERRORCHECK(error,nullptr);
while (!ble.hasInitialized())
ble.processEvents();
// Security Manager initialization
error = ble.securityManager().init(
/* enableBonding */ true,
/* requireMITM */ false,
/* iocaps */ SecurityManager::IO_CAPS_NONE,
/* passkey */ nullptr,
/* signing */ false,
/* dbFilepath */ nullptr);
ERRORCHECK(error,nullptr);
error = ble.securityManager().setPairingRequestAuthorisation(true);
ERRORCHECK(error,nullptr);
error = ble.securityManager().allowLegacyPairing(true);
ERRORCHECK(error,nullptr);

// GAP initialization
error = ble.gap().enablePrivacy(false);
ERRORCHECK(error,nullptr);
error = DeviceInformationService::add_service(ble,
BLE_MANUFACTURER,
BLE_DEVICE_NAME,
nullptr, // Serial number
BLE_HW_REV,
BLE_FW_REV
);
ERRORCHECK(error,nullptr);
...
```
and the event handler:

```c++
void pairingRequest (ble::connection_handle_t connectionHandle)
{
Serial.println("PAIRING REQUEST");
BLE& ble = BLE::Instance();
ble_error_t error;
error = ble.securityManager().acceptPairingRequest(connectionHandle);
if (error) {
Serial.print("acceptPairingRequest failed with code ");
Serial.println(error);
}
}

void pairingResult (
ble::connection_handle_t connectionHandle,
ble::SecurityManager::SecurityCompletionStatus_t result)
{
Serial.println("PAIRING RESULT");
Serial.println(result);
if (result== ble::SecurityManager::SecurityCompletionStatus_t::SEC_STATUS_SUCCESS) {

} else {
start_advertising();
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided BLE initialization, SecurityManager configuration, pairingRequest handler, and pairingResult handler, then reproduce the failure on an Arduino Nano 33 BLE using Android or Windows 10. Trace the pairing status and central-side timeout through the BLE driver and FEATURE_BLE code; done means pairing completes successfully and the pairingResult event reports success.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.