Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Regarding bond/pair option for NUS type BLE connection

Hi,

I am using "ble_app_uart" example application, This doen't have the pairing/Bonding options, 

If i add the "peer_manager.c" and iits dependencies, NUS(UART) service not working, 

is it possible to make the Bonding option for NUS based BLE connection?

If Possible, How can i modify the "ble_app_uart" application to achieve this.

Thanks in advance.

Kind Regards,

Thiru.

  • Hello,

    It should be possible to add the peer manager to the ble_app_uart example. You would need to add the peer manager, and all it's dependencies. 

    What do you intend to connect with? 

    Do you want to require encryption to use the ble_app_uart example's services? If so, you should change e.g. the add_char_params.cccd_write_access = SEC_JUST_WORKS in ble_nus.c, before adding the TX characteristic using characteristic_add().

    That means that it would require JUST_WORKS pairing before enabling the notifications.

    Depending on your central, it may or may not initiate pairing when it sees that one of the services requires this.

    Best regards,

    Edvin

  • Hi Edvin,

    Thank you for the perfect explanation, I have integrated the peer manager like from "ble_app_template" application. but i'm not able to make it bond, when i click pair option from discovered list in mobile, firmware is crashed in SDH (nrf_sdh_ble_evts_poll()), if i change the NRF_SDH_BLE_SERVICE_CHANGED macro to 1 in sdk_config.h any additional configuration or modification need to do?

    When i try to change add_char_params.cccd_write_access=SEC_JUST_WORKS from SEC_OPEN, my UART communication is crashed.

    Please help to achieve the pairing/bonding for the secure communication.

    Thankk you,

    Kind Regards,

    Thiru.

  • Hello Thiru,

    Do you see any logging from your project? I see that you use Segger Embedded Studio. Try adding DEBUG to your preprocessor definitions:

    Then you should monitor your log (everything printed by NRF_LOG_INFO()). By default, this is printed on the UART backend. After you added DEBUG to your preprocessor definitions, you should see the log pointing at an APP_ERROR_CHECK(err_code) in your project. What was the err_code, and what function returned that value?

    Best regards,

    Edvin

  • Hi Edvin,

    I got your point, But i have used the UART for some other purpose, i cannot redirect the debug logs into UART. is there any other way to see the logs?

    Thank you.

    Kind Regards,

    Thiru.

  • Hi Edvin,

    Pairing & Bonding option is working along with Nordic UART Service.

    Thank you for your best support.

    Kind Regards,

    Thiru.

Related