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

Adding NUS to existing profile - how to get a 'link context' ?

Hi, 

I'm trying to add the NUS service to an existing application (freertos based, SDK15.2, already use a custom service)

  • I copied the relevant code snippets from the example
  • Modified the project setup - Add ble_nus.c & ble_link_ctx_manager.c, increased start address + 0x10 bytes (for the additional service uuid)
  • Updated sdk_config.h - increased NRF_SDH_BLE_VS_UUID_COUNT to 2 (was 1 for the prev proprietary service), BLE_NUS_ENABLED = 1

The app builds and runs to the point where I do BLE connect.

The program crash when ble_nus.c on_connect() function calls blcm_link_ctx_get(), as the 1st parameters p_nus->p_link_ctx_storage == NULL.

I had to add ble_link_ctx_manager.c to the project following the example project. However, I couldn't find what it does and how it is used/initialized

Any advice will be appreciated.

Thanks

Related