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

How do I add 2nd base UUID for Service and Characteristic?

Hello, i try to get a service with base_uuid1 and to this service a characteristic with the base_uuid2. I am trying to implement BLE MIDI, the BLE_MIDI Specs:

  1. BLE Service and Characteristics Definitions The following service and characteristic are defined:
  • MIDI Service (UUID: 03B80E5A-EDE8-4B33-A751-6CE34EC4C700)
  • MIDI Data I/O Characteristic (UUID: 7772E5DB-3868-4112-A1A9-F2669D106BF3)

I did the tutorials and created my service ID like the MIDI SERVICE UUID from the specs. The Characteristic tutorial just let me add a custom 16bit UUID but i need to change the complete base_uuid. But when i am changing the base_uuid in the our_service.c the nrf52 DK is not advertising anymore and all four leds light up.

This is from the our_service.h

// FROM_SERVICE_TUTORIAL: Defining 16-bit service and 128-bit base UUIDs
#define BLE_UUID_OUR_BASE_UUID              {{0x00, 0xC7, 0xC4, 0x4E, 0xE3, 0x6C, 0x51, 0xA7, 0x33, 0x4B, 0xE8, 0xED, 0x5A, 0x0E, 0xB8, 0x03}} // 128-bit base UUID
#define BLE_UUID_OUR_SERVICE_UUID                0x0E5A // Just a random, but recognizable value

// ALREADY_DONE_FOR_YOU: Defining 16-bit characteristic UUID
#define BLE_UUID_OUR_BASE_CHAR_UUID              {{0xF3, 0x6B, 0x10, 0x9D, 0x66, 0xF2, 0xA9, 0xA1, 0x12, 0x41, 0x68, 0x38, 0xDB, 0xE5, 0x72, 0x77}} // 128-bit base UUID
#define BLE_UUID_OUR_CHARACTERISTC_UUID          0xE5DB 

from the our_service.h

static uint32_t our_char_add(ble_os_t * p_our_service)
{
    uint32_t   err_code = 0; // Variable to hold return codes from library and softdevice functions
 
    // OUR_JOB: Step 2.A, Add a custom characteristic UUID
    ble_uuid_t          char_uuid;
    ble_uuid128_t       base_uuid = BLE_UUID_OUR_BASE_CHAR_UUID;
    char_uuid.uuid      = BLE_UUID_OUR_CHARACTERISTC_UUID;

																		
	sd_ble_uuid_vs_add(&base_uuid, &char_uuid.type);
    APP_ERROR_CHECK(err_code);

...

err_code = sd_ble_gatts_characteristic_add(p_our_service->service_handle,
                                   &char_md,
                                   &attr_char_value,
                                   &p_our_service->char_handles);
APP_ERROR_CHECK(err_code);

return NRF_SUCCESS;
}

And i Didint do anything to the our_service_init().

I hope someone can help my i am a little confused and new working with the nrf. Thank you. I probably forgot the most things so please ask.

Related