BLE Bonding Issue with DA14531 as BLE Central Device

**Hi Support Team,**

I am working on a project that uses the DA14531 as a BLE Central Device. We are planning to use the BLE Bonding feature, leveraging the BLE Security Layer to ensure secure data transmission. The user callback configuration events are set up as follows:

```c
static const struct app_callbacks user_app_callbacks = {
.app_on_connection = user_on_connection,
.app_on_disconnect = user_on_disconnect,
.app_on_update_params_rejected = NULL,
.app_on_update_params_complete = NULL,
.app_on_set_dev_config_complete = user_on_set_dev_config_complete,
.app_on_adv_nonconn_complete = NULL,
.app_on_adv_undirect_complete = NULL,
.app_on_adv_direct_complete = NULL,
.app_on_db_init_complete = user_on_db_init_complete,
.app_on_scanning_completed = user_on_scanning_completed,
.app_on_adv_report_ind = user_on_adv_report_ind,
.app_on_connect_failed = user_on_connect_failed,
.app_on_get_dev_name = default_app_on_get_dev_name,
.app_on_get_dev_appearance = default_app_on_get_dev_appearance,
.app_on_get_dev_slv_pref_params = default_app_on_get_dev_slv_pref_params,
.app_on_set_dev_info = default_app_on_set_dev_info,
.app_on_data_length_change = NULL,
.app_on_update_params_request = user_gapc_param_update_req_ind_handler,
.app_on_generate_static_random_addr = NULL,
.app_on_svc_changed_cfg_ind = NULL,
.app_on_get_peer_features = NULL,
#if (BLE_APP_SEC)
.app_on_pairing_request = default_app_on_pairing_request,
.app_on_tk_exch = user_app_on_tk_exch,
.app_on_irk_exch = NULL,
.app_on_csrk_exch = default_app_on_csrk_exch,
.app_on_ltk_exch = default_app_on_ltk_exch,
.app_on_pairing_succeeded = user_app_on_pairing_succeeded,
.app_on_encrypt_ind = NULL,
.app_on_encrypt_req_ind = default_app_on_encrypt_req_ind,
.app_on_security_req_ind = NULL,
.app_on_addr_solved_ind = default_app_on_addr_solved_ind,
.app_on_addr_resolve_failed = default_app_on_addr_resolve_failed,
.app_on_ral_cmp_evt = default_app_on_ral_cmp_evt,
.app_on_ral_size_ind = NULL,
.app_on_ral_addr_ind = NULL,
#endif // (BLE_APP_SEC)
};

#if (BLE_APP_SEC)
static const struct app_bond_db_callbacks user_app_bond_db_callbacks = {
.app_bdb_init = NULL,
.app_bdb_get_size = remote_bdb_get_size,
.app_bdb_add_entry = remote_bdb_add_entry,
.app_bdb_remove_entry = NULL,
.app_bdb_search_entry = remote_bdb_search_entry,
.app_bdb_get_number_of_stored_irks = remote_bdb_get_number_of_stored_irks,
.app_bdb_get_stored_irks = remote_bdb_get_stored_irks,
.app_bdb_get_device_info_from_slot = remote_bdb_get_device_info_from_slot,
};
#endif // (BLE_APP_SEC)
```

We have a BLE Peripheral device that also uses the DA14531, and we have successfully tested the BLE Bonding functionality with a mobile app.

**Testing Issue:**

I tested the bonding connection on the BLE Central device. It successfully connected and bonded with the BLE Peripheral device on the first BLE connection, triggering the **app_bdb_add_entry** event. However, during the subsequent disconnect/connection cycle (without resetting or power cycling the BLE Peripheral), it still requested the bonding event again, triggering the **app_bdb_add_entry** event. This behavior is unexpected as it should remember the bonding information.

Upon further investigation and debugging, I found that it does not trigger events to check the existing bonding information in RAM memory (such as **app_bdb_search_entry**, **app_bdb_get_number_of_stored_irks**, and **app_bdb_get_stored_irks** function callbacks). Instead, it only requests bonding from the SDK.

Can you provide guidance on how to resolve this issue so that the bonding information is correctly remembered across connections?

Thank you for your assistance.

Parents Reply
  • Hi Quoc,

    Thank you for the reply.

    I tried to use the central_Security_Demo example that you suggested and encountered an issue with the UART log. I used the Dialog SDK 6.0.18, as mentioned in the Readme.md file for this example. After following the guideline for 'Linking the project environment and the Dialog 6.0.18 SDK', I tried to build the project and encountered an issue with linking to the hex file. I am aware that the Dialog 6.0.18 SDK requires using ARM Compiler Version 6, but I am unsure if this is causing the issue.

    Could you please share the issues/errors you faced during compilation?
    On my side, I tested with SDK v6.0.18 and SDK v6.0.22 and it worked as expected.
    You will need ARM Compiler v6 and Link Time Optimization enabled. For LTO enabled a license is required, if you do not have a license please refer here: (+) Link-Time optimization error - Bluetooth Low Energy - Wireless Connectivity - Renesas Engineering Community



    Therefore, there is a high possibility that there are some missing UART configurations in the central_Security_Demo example, which prevent it from sending out the log. Could you please help me take a look at that?

    Could you please zip and attach the project here so I can take a look?
    Please include the python script you used to fix the paths.

    Best Regards,
    OV_Renesas

Children