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

Instead of octets 12-13 of 128-bit UUID can we use octets 1-2

Hi,

I've defined a base uuid 455449424C5545544845524DB87AD700 

For adding the service to the database CUS_SERVICE_UUID = 0x4942 which alters my 12th and 13 octets 

Instead I wan use 0xD700 to alter 1st and 2nd octets.

so I need UUID as follow

PS 455449424C5545544845524DB87AD700

PC-1  455449424C5545544845524DB87AD701 

PC-2  455449424C5545544845524DB87AD702

PC-3  455449424C5545544845524DB87AD703

PC-4  455449424C5545544845524DB87AD704

How can I do this....?

Parents
  • Hi Einar,


    }

    uint32_t ble_cus_init(ble_cus_t * p_cus, const ble_cus_init_t * p_cus_init)
    {
    
        uint32_t                  err_code;
        ble_uuid_t                ble_uuid;
        ble_add_char_params_t     add_char_params;
    
    /* Adding the service */
    
        // Initialize service structure.
        p_cus->evt_handler               = p_cus_init->evt_handler;
        p_cus->conn_handle               = BLE_CONN_HANDLE_INVALID;
    
        // Add the Custom ble Service UUID
        ble_uuid128_t base_uuid =  CUS_SERVICE_UUID_BASE;
        err_code =  sd_ble_uuid_vs_add(&base_uuid, &p_cus->uuid_type);
        if (err_code != NRF_SUCCESS)
        {
            return err_code;
        }
        
        ble_uuid.type = p_cus->uuid_type;
        ble_uuid.uuid = CUS_SERVICE_UUID;
    
        // Add the service to the database
        err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_cus->service_handle);
        if (err_code != NRF_SUCCESS)
        {
            return err_code;
        }
    
    
    // Add the Custom ble Service UUID
        ble_uuid128_t base_uuid1 =  CUS_SERVICE_UUID_BAS1;
        err_code =  sd_ble_uuid_vs_add(&base_uuid1, &p_cus->uuid_type);
        NRF_LOG_INFO("003 %d", err_code);
        if (err_code != NRF_SUCCESS)
        {
            return err_code;
        }
    /* Adding the service characteristics */
    
        // Add the buttons characteristic.
    
        uint8_t buttons_char_init_value [4] = {0};
    
        memset(&add_char_params, 0, sizeof(add_char_params));
        add_char_params.uuid              = BUTTONS_STATES_CHAR_UUID;
        add_char_params.uuid_type         = p_cus->uuid_type;
    
        add_char_params.init_len          = 4;
        add_char_params.max_len           = 4;
        add_char_params.p_init_value      = buttons_char_init_value;
    
        add_char_params.char_props.read   = 1;
        add_char_params.char_props.notify = 1;
        add_char_params.char_props.write_wo_resp = 1;
    
        add_char_params.read_access       = SEC_OPEN;
        add_char_params.cccd_write_access = SEC_OPEN;
    
        err_code = characteristic_add(p_cus->service_handle,
                                      &add_char_params,
                                      &p_cus->buttons_states_char_handles);
        if (err_code != NRF_SUCCESS)
        {
            return err_code;
        }
        NRF_LOG_INFO("003 ");
    
        // Add the potentio characteristic.
    
        uint8_t pot_char_init_value [4] = {0};
    
        memset(&add_char_params, 0, sizeof(add_char_params));
        add_char_params.uuid              = POTENTIO_LEVEL_CHAR_UUID;
        add_char_params.uuid_type         = BLE_UUID_TYPE_VENDOR_BEGIN;   //p_cus->uuid_typ2;
    
        add_char_params.init_len          = 4;// (in bytes)
        add_char_params.max_len           = 4;
        add_char_params.p_init_value      = pot_char_init_value;
    
        add_char_params.char_props.read   = 1;
        add_char_params.char_props.notify = 1;
    
        add_char_params.read_access       = SEC_OPEN;
        add_char_params.cccd_write_access = SEC_OPEN;
    
        err_code = characteristic_add(p_cus->service_handle,
                                      &add_char_params,
                                      &p_cus->potentio_level_char_handles);
        if (err_code != NRF_SUCCESS)
        {
            return err_code;
        }
    
        // Add the leds characteristic.
    
        uint8_t leds_char_init_value [2] = {0};
    
        memset(&add_char_params, 0, sizeof(add_char_params));
        add_char_params.uuid             = LEDS_STATES_CHAR_UUID;
        add_char_params.uuid_type        = BLE_UUID_TYPE_VENDOR_BEGIN;    //p_cus->uuid_typ3;
    
        add_char_params.init_len         = 2; // (in bytes)
        add_char_params.max_len          = 2;
       add_char_params.p_init_value      = leds_char_init_value;
    
        add_char_params.char_props.read  = 1;
        add_char_params.char_props.write = 1;
    
        add_char_params.read_access  = SEC_OPEN;
        add_char_params.write_access = SEC_OPEN;
    
        err_code = characteristic_add(p_cus->service_handle, 
                                      &add_char_params, 
                                      &p_cus->leds_states_char_handles);
    
        if (err_code != NRF_SUCCESS)
        {
            return err_code;
        }
    
        return NRF_SUCCESS;
    }
    .

    When I try to add a base uuid 2nd time I getting a app: Fatal error. 

    I even changed number of vendor-specific UUID from 0-->2

    #define NRF_SDH_BLE_VS_UUID_COUNT 2

  • Hi,

    Please make a debug build (if using SES, then just select the build target "Debug". If using another toolchain, then define "DEBUG" and "DEBUG_NRF" for the project. That way you will easily see in the log in which file, and which line number you got which error code. Which function call returns which error code?

  • following the below macro

    ***Try-2 Flash Macro***

    FLASH_PH_START=0x0
    FLASH_PH_SIZE=0x100000
    RAM_PH_START=0x20000000
    RAM_PH_SIZE=0x40000
    FLASH_START=0x27000
    FLASH_SIZE=0xd9000
    RAM_START=0x20002ce0
    RAM_SIZE=0x3d320

    NRF_SDH_BLE_VS_UUID_COUNT Count value was 0(Zero) initially 

    I tried changing the value with 1, 2, 3, 10, 20(I tried them one by one individually

    But all the time it was returning same error code. 

  • I see. Can you upload your complete project here so that I can have a look at it?

Reply Children
Related