This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

LESC Numeric comparison

I am trying to implement the LESC + numeric comparison using the multi-role lesc as reference. I am using nRF52840 and SDK 14.2.0 with soft device 5.0.0-2_alpha.

My central device is also nRF52840 DK. I am seeing that the peripheral gets into hard fault and does not complete pairing. Central device gets hard fault, but not always. I am not able to get a sniffer log, but this is a serial log messages.

Following is the log when central does not get a hard fault, but peripheral still gets a hard fault:

[CENTRAL_CLIENT]:~$ scan
[00000003] <info> app: Starting scan.
[00000849] <info> app: Device "NRF_XXXX_DEMO" found, sending a connection request.
[00002289] <info> app: Connected as a central.
[00002289] <info> app: conn_handle:0
[00002290] <info> app: Discovering GATT database...
[00002832] <info> app: ATT MTU exchange completed. MTU set to 247 bytes.
[00003079] <info> app: Data length updated to 251 bytes.
[00002730] <info> FCS: Comm service discovered at peer.
[00002731] <info> FCS: FCS discovered at peer.
[00002731] <info> app: PM_EVT_CONN_SEC_PARAMS_REQ
[00002998] <info> app: PM_EVT_CONN_SEC_PARAMS_REQ
[00003002] <info> app: CENTRAL: BLE_GAP_EVT_SEC_PARAMS_REQUEST
[00000191] <info> app: CENTRAL: BLE_GAP_EVT_LESC_DHKEY_REQUEST
[00000192] <info> app: Building public key!
[00000198] <info> app: Finished building public key: 0x00000000!
[00000198] <info> app: Key build result successful!
[00000813] <info> app: Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 0
[00002900] <info> app: Disconnected: reason 0x8.
[00002900] <info> app: Test terminated...
[CENTRAL_CLIENT]:~$

[PERIPH_SERVER]:~$
[00000000] <info> app: Initializing nrf_crypto.
[00000000] <info> app: Initialized nrf_crypto.
[00000000] <info> app: Generating key-pair
[00000000] <info> app: Converting to raw type
[00000000] <info> app: Key build result successful!
[00000003] <info> app: Starting peripheral device...
[PERIPH_SERVER]:~$ advon
[00000002] <info> app: Starting advertising.
[00000921] <info> app: Connected as a peripheral.
[00000921] <info> app: conn_handle:0
[00000942] <info> app: PHY update accepted. PHY set to 1 Mbps.
[00001462] <info> app: Data length updated to 251 bytes.
[00001697] <info> app: ATT MTU exchange completed. MTU set to 247 bytes.
[00001600] <info> app: PM_EVT_CONN_SEC_PARAMS_REQ
[00001603] <info> app: PERIPHERAL: BLE_GAP_EVT_SEC_PARAMS_REQUEST
[PERIPH_SERVER]:~

Following is the log when both central and peripheral gets a hard fault:

[CENTRAL_CLIENT]:~$
00000002] <info> app: Starting scan.
[00000708] <info> app: Device "NRF_XXXX_DEMO" found, sending a connection request.
[00002046] <info> app: Connected as a central.
[00002046] <info> app: conn_handle:0
[00002047] <info> app: Discovering GATT database...
[00002589] <info> app: ATT MTU exchange completed. MTU set to 247 bytes.
[00002836] <info> app: Data length updated to 251 bytes.
[00002488] <info> FCS: Comm service discovered at peer.
[00002488] <info> FCS: FCS discovered at peer.
[00002488] <info> app: PM_EVT_CONN_SEC_PARAMS_REQ
[00002756] <info> app: PM_EVT_CONN_SEC_PARAMS_REQ
[CENTRAL_CLIENT]:~$

[00000003] <info> app: Starting advertising.
[00000651] <info> app: Connected as a peripheral.
[00000652] <info> app: conn_handle:0
[00000673] <info> app: PHY update accepted. PHY set to 1 Mbps.
[00001193] <info> app: Data length updated to 251 bytes.
[00001428] <info> app: ATT MTU exchange completed. MTU set to 247 bytes.
[00001331] <info> app: PM_EVT_CONN_SEC_PARAMS_REQ
[00001334] <info> app: PERIPHERAL: BLE_GAP_EVT_SEC_PARAMS_REQUEST
[PERIPH_SERVER]:~$

Can you suggest what might be going wrong?

The peer_manager_init is same as in multi-role lesc example, except bonding is not enabled. The HW crypto is enabled in sdk_config.h

  • I have to ask. You are sure you are getting a hard fault? It is a bit difficult to know what is going on by only looking at the logs. Have you tried to debug? Narrow down when this hard fault actually happens? Did you use this as a starting point?

  • When this happens, resetting the processor is the only option. My CLI does not respond and when I pause the debugger, I see Hard fault exception as below: (I am using IAR IDE).

    HardFault exception. The processor has escalated a configurable-priority exception to HardFault. An instruction executed with an invalid EPSR.T or EPSR.IT field. Exception occurred at: 0x2000009c8

    Address at which exception occurred is different each time. May be the hard fault happened because I paused the debugger. The breakpoint in app_error_fault_handler was not hit during the execution.

    I have created a case ID 41028 with attached sources. I followed the multi role lesc example as reference for this application. The only difference is I am enabling the HW crypto. There was no multi role lesc example for nRF52840 and IAR.

  • I have tried my peripheral application with nRF Connect desktop app (Windows) also. As soon as I confirm the numeric pass code (pressing match button on the nRF connect), the board connected to my PC gets disconnected.

Related