This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Create custom service from ble_app_uart_c example

Hello, I would like to make changes in ble_app_uart_c example for connecting to a custom peripheral.

Service Uuid of my peripheral is as follows : 99aa0001-d0e3-44ce-a306-ba057b9b25a7 Characteristic1 uuid of this service : 99aa0002-d0e3-44ce-a306-ba057b9b25a7 Characteristic2 uuid of this service : 99aa0003-d0e3-44ce-a306-ba057b9b25a7

I made following change according to NUS_BASE_UUID variable #define NUS_BASE_UUID {{0xA7, 0x25, 0x9B, 0x7B, 0x05, 0xBA, 0x06, 0xA3, 0xCE, 0x44, 0xE3, 0xD0, 0x00, 0x00, 0xAA, 0x99}} #define BLE_UUID_NUS_SERVICE 0x0001
#define BLE_UUID_NUS_TX_CHARACTERISTIC 0x0002
#define BLE_UUID_NUS_RX_CHARACTERISTIC 0x0003

By doing so I am unable to connect my central to peripheral. Are there any other variables need to be changed? Please help me in this regard

  • Hi SajTeja!

    I tested this with the ble_app_uart example and the ble_app_uart_c example in SDK 14.1, and it works fine.

    Did you remember to change the UUID in both the peripheral and the central?

    In the ble_app_uart example I changed the NUS_BASE_UUID in ble_nus.c to the following:

    #define NUS_BASE_UUID  {{0xA7, 0x25, 0x9B, 0x7B, 0x05, 0xBA, 0x06, 0xA3, 0xCE, 0x44, 0xE3, 0xD0, 0x00, 0x00, 0xAA, 0x99}}
    

    And in the ble_app_uart_c example I change the NUS_BASE_UUID in ble_nus_c.h to the following:

    #define NUS_BASE_UUID  {{0xA7, 0x25, 0x9B, 0x7B, 0x05, 0xBA, 0x06, 0xA3, 0xCE, 0x44, 0xE3, 0xD0, 0x00, 0x00, 0xAA, 0x99}}
    

    When I build and flash the example the devices automatically connect.
    Did you remember to flash the correct versions of the softdevice?

    Best regards.
    Joakim.

  • Thank you for your time Joakim.

    I am using SDK 12.2.0. And I am using correct version of software. For peripheral, I am using arduino core developed by sandeep Mistry . github.com/.../arduino-BLEPeripheral For central, I am using the example code provided in SDK.

    I am able to achieve the data transmission between central and peripheral with NUS servive UUID. But with my custom UUID, I am not able to achieve communication between peripheral and central. I am using same UUID in central and peripheral. What might be the possible issue?

Related