This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to Implement Cable Replacement Service?

Hi Team,

Can anyone help regarding Cable Replacement service. Is this service is already supported in softdevices? What are the options if not supported?

  • Cable Replacement profile is a Bluegiga proprietary profile and is not a profile standardized by the Bluetooth SIG.

    We have an example project (w/ app on phone-side) in our SDK, called "ble_app_uart": developer.nordicsemi.com/.../a00072.html

    Please see this tutorial on how to use the example: devzone.nordicsemi.com/.../

    EDIT

    To show you how to change the UUIDs I have started out with the ble_app_uart example. In that example you have the ble_nus.c and ble_nus.h files which describes the UART service.

    First go to section 2.2.4 in the nAN-36 app note i linked to in the comment to see how UUIDs work.

    So, in the cable replacement service you have two base UUIDs. In the ble_crs.c the NUS_BASE_UUID is defined, which is the service UUID. You need to change this to the one you want to use. We also want to add a new base UUID for the TX characteristic. The values below are the ones described in the Cable Replacement service description.

    #define NUS_BASE_UUID    {{0xcc, 0x77, 0xba, 0xf1, 0x42, 0x27, 0x4d, 0x8e, 0x9b, 0x46, 0xcb, 0xe7, 0x66, 0x16, 0xd5, 0x0b}} /**< Used vendor specific UUID. */
    #define NUS_TX_BASE_UUID {{0xc1, 0x3c, 0x35, 0x55, 0x28, 0x11, 0xe1, 0xaa, 0x76, 0x48, 0x42, 0xb0, 0x80, 0xd7, 0xad, 0xe7}} /**< Used vendor specific UUID. */
    

    In ble_nus.h the 16 bit service UUID is defined, which is the 3rd and 4th byte in the base UUID. Change this to the one you want to use. In your case that would be the 0x1666 value in the base UUID

    #define BLE_UUID_NUS_SERVICE 0x1666  
    

    The 16 bit UUID for the tx characteristic is defined in ble_nus.c, and you want to change this to this:

    #define BLE_UUID_NUS_TX_CHARACTERISTIC 0xd780
    

    Now we would like the tx characteristic to use the NUS_TX_BASE_UUID we defined, not the NUS_BASE_UUID which is used by default. So, we need to add a the new base UUID in the tx characteristic. Go to nAN-36 section 4.4.3 to see how to add a new base UUID. In tx_char_add() in ble_nus.c add this to the code:

    uint32_t      err_code;
    ble_uuid128_t nus_tx_base_uuid = NUS_TX_BASE_UUID;  
    err_code = sd_ble_uuid_vs_add(&nus_tx_base_uuid, &p_nus->uuid_type);
    if (err_code != NRF_SUCCESS){return err_code;}
    

    You can add this at the top of the function.

    You can also remove the rx characteristic, since you don't need it. Go to the ble_nus_init() function in ble_nus.c and remove the block:

    // Add the RX Characteristic.
    err_code = rx_char_add(p_nus, p_nus_init);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    
  • Do I need to modify "ble_uart_app" such that it works like cable replacement profile of bluegiga? Can you guide or any tutorial available which may help in this? Right now I don't have clarity like where to provide bluegigia uuid - 0bd51666-e7cb-469b-e84d-2742f1ba77cc in "ble_uart_app" during modification.

  • We have the nAN-36 document that shows how to set up a custom characteristic with a custom UUID: www.nordicsemi.com/.../6058527

    The app note is written for an older SDK, but you can find the updated code here: github.com/.../nrf51-ble-app-lbs

    I would recommend to download the SDK from here: developer.nordicsemi.com/.../ (not packs), and unzip the github example into the 'ble_peripheral' folder in the SDK.

  • You may can refer to our "2-1. Make your own RC App" for the bleServiceUART.

  • Thanks Stian and Jason!!

    I have started working on this but seems difficult. See the image. These is what I need to implement in NORDIC Soc. image description

    I have successfully set Service UUID.

    I am unable to set 128-bit characteristic UUID and listed descriptors.

    I also want to change MAC address which is sent in advertising. Guide me at what point this could be done.

    Please help ASAP!!

Related