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

nrf52 Ble Bonding fail - BLE_GAP_EVT_CONN_SEC_UPDATE

Hi, DevZone, thanks for help : )

I'm try to porting DK Board's Ble Bonding function to Target Board.

TARGET : nRF52840

SD: s140_nRF52_v7.0.1

SDK: nRF5_v16.0.0

1st_question <- this is my first question links

2nd_question <- this is my second question links

The First cause was a mutex error that occurred while using RTOS, and

The second cause has not yet been clearly identified, but it seems that we have found a possible cause,

so we request an update and new help.

i'm looking this site also, check procedure JustWork method

in this procedure, sd_ble_gap_lesc_dhkey_reply(p_dhkey) works well,

(DK board debug log)                                                                                                  (my board debug log)

<info> app: BLE_GAP_EVT_LESC_DHKEY_REQUEST
<info> nrf_ble_lesc:  && compute_and_give_dhkey
<info> nrf_ble_lesc: Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 0
handler_ble_evt BLE_GAP_EVT_LESC_DHKEY_REQUEST
 && compute_and_give_dhkey
Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 0

and after that procedure, 

(DK board debug log)  - DK board call same as procedure                                       (my board debug log)

<info> peer_manager_smd: @@ BLE_GAP_EVT_CONN_SEC_UPDATE in 

<info> peer_manager_smd:  && conn_sec_update_process
<info> peer_manager_smd:  && pairing
<info> peer_manager_smd: @@ smd_ble_evt_handler out 

...
...
..

<info> peer_manager_smd: @@ BLE_GAP_EVT_AUTH_STATUS in 

<info> peer_manager_smd:  && auth_status_process
<info> peer_manager_smd:  && auth_status_failure_process
<info> peer_manager_smd:  && pairing_success_evt_send
<info> peer_manager_smd:  && evt_send
<info> peer_manager_handler: Connection secured: role: Peripheral, conn_handle: 0, procedure: Bonding
handler_ble_evt BLE_GAP_EVT_LESC_DHKEY_REQUEST
    && compute_and_give_dhkey

Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 0

BLE event: 0x19.


@@ ble_conn_state.c ble_evt_handler in
@@ ble_conn_state.c BLE_GAP_EVT_AUTH_STATUS in
@@ ble_conn_state.c ble_evt_handler out

@@ im_ble_evt_handler in
@@ evt_id != BLE_GAP_EVT_CONNECTED

@@ sm_ble_evt_handler in
    @@ smd_ble_evt_handler in
        @@ BLE_GAP_EVT_AUTH_STATUS in
             && auth_status_process
             && auth_status_failure_process
             && link_secure_failure
             && sec_procedure
             && pairing
             && encryption_failure
             && bonding
             && conn_sec_failure
             && evt_send

board skip check BLE_GAP_EVT_CONN_SEC_UPDATE procedure.

I wonder where the function that sets the event flag to "BLE_GAP_EVT_CONN_SEC_UPDATE" is called.

Are there any possible causes of the problem?

and please let me know if there is another simple way to check "SMP_Pairing_DHKey_Check" in the previous process other than sniffing.

Thanks,

Best Regards

#Ble #Ble_Bonding #Bonding

  • Hi,

    Vidar is answered you in your 2nd Question is on summer break and is coming back on Monday. So hopefully you get a response soon after that and I appreciate your patience.

    BLE_GAP_EVT_CONN_SEC_UPDATE is an event coming from the GAP module inside the softdevice. I would suggest you to start your application in debugger in debug mode and put a breakpoint in components\ble\peer_manager\security_dispatcher.c->link_secure_failure to see the function call stack to understand why it failed. Even better would be to collect the air traffic logs using BLE sniffer. It seems like there are differences in the code path between your board and the DK, not sure why based on the the info you provided.

  • Hi, Thanks for reply

    ummer break and is coming back on Monday.

    thanks for information

    \ble\peer_manager\security_dispatcher.c-

    today i was add some delay code in ecdh_compute and dhkey_reply and that part also 

    and now my code call next state list procedure, I think my mcu was a little hard : ) 

    like this, is working out, same as DK board and after end of gcm_ble_evt_handler 

    LE_GAP_EVT_LESC_DHKEY_REQUEST
    p_peer_public_key->is_valid     valid Error 0
    nrf_crypto_ecc_byte_order_invert        valid Error 0
    Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 0
    sd_ble_gap_lesc_dhkey_reply     valid Error 0
    BLE event: 0x12 (BLE_GAP_EVT_CONN_PARAM_UPDATE)
    
    ....
    
    BLE event: 0x1a. (BLE_GAP_EVT_CONN_SEC_UPDATE)
    
    ...
    
    BLE event: 0x19. (BLE_GAP_EVT_AUTH_STATUS)

    but after "BLE_GAP_EVT_AUTH_STATUS" evt get 

    freezing issue became again,

    i can check that call peer_manager.c \ bel_evt_handler

    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {
        VERIFY_MODULE_INITIALIZED_VOID();
    
        im_ble_evt_handler(p_ble_evt);
        sm_ble_evt_handler(p_ble_evt);
        gcm_ble_evt_handler(p_ble_evt);
    }

    Can you tell which function the process jumps to after handling "gcm_ble_evt_handler "?

    try to track stuck point, but it looks hard

    Thanks,

    Best Regards, Empe

Related