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.

Parents
  • 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.

  • Glad to hear that it is working. To answer your question:

     

    Thiru said:
    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?

     You can enable the logging to use the RTT backend instead of the UART backend. In sdk_config.h, please set:

    NRF_LOG_BACKEND_UART_ENABLED to 0

    NRF_LOG_BACKEND_RTT_ENABLED to 1

    Some examples doesn't have both of these mentioned in sdk_config.h, but I believe the ble_app_template example does. The ble_app_uart doesn't have the UART option, as the UART is used by the application.

  • Hello  ,

    I am having the same requirement as you where I'm trying to add support of pairing in ble_app_uart_c example... so far I have integrated the peer_manager APIs but coudn't get through as I am facing nrf getting crash after connecting BLE sensor (which can be access after pairing)...

    since you have achieved pairing and bonding it would be great if you can share the changes required on top of ble_app_uart_c example to resolve all the mentioned issues...

    Thanks,

    Ankit

Reply
  • Hello  ,

    I am having the same requirement as you where I'm trying to add support of pairing in ble_app_uart_c example... so far I have integrated the peer_manager APIs but coudn't get through as I am facing nrf getting crash after connecting BLE sensor (which can be access after pairing)...

    since you have achieved pairing and bonding it would be great if you can share the changes required on top of ble_app_uart_c example to resolve all the mentioned issues...

    Thanks,

    Ankit

Children
No Data
Related