Hellow, I am trying to add different UUID bases for every characteristic. I add the service like this:
uint32_t ble_service_init(ble_t * p, ble_write_handler_t write_handler)
{
uint32_t err_code;
ble_uuid_t ble_uuid;
// Initialize service structure.
p->conn_handle = BLE_CONN_HANDLE_INVALID;
p->data_write_handler = write_handler;
// Add service.
ble_uuid128_t base_uuid = {UUID_BASE};
err_code = sd_ble_uuid_vs_add(&base_uuid, &p->uuid_type);
VERIFY_SUCCESS(err_code);
ble_uuid.type = p->uuid_type;
ble_uuid.uuid = UUID_SERVICE;
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p->service_handle);
VERIFY_SUCCESS(err_code);
return NRF_SUCCESS;
}
After this, i add different base UUID to every characteristic, like this:
ble_uuid128_t base_uuid1 = {UUID_BASE1};
ble_uuid128_t base_uuid2 = {UUID_BASE2};
ble_uuid1.uuid = 0x0000;
err_code = sd_ble_uuid_vs_add(&base_uuid1, &ble_uuid1.type);
VERIFY_SUCCESS(err_code);
ble_uuid2.uuid = 0x0000;
err_code = sd_ble_uuid_vs_add(&base_uuid2, &ble_uuid2.type);
VERIFY_SUCCESS(err_code);
.
.
.
attr_char_value1.p_uuid = &ble_uuid1;
attr_char_value2.p_uuid = &ble_uuid2;
sd_ble_gatts_characteristic_add(p->service_handle, &char_md, &attr_char_value1,&p->characteristics.char_handle);
sd_ble_gatts_characteristic_add(p->service_handle, &char_md, &attr_char_value2,&p->characteristics.char_handle);
The problem is that the output of the sd_ble_uuid_vs_add() function in this part is 4(NRF_ERROR_NO_MEM). What i did for resolve this problem :
-
In the main, before the softdevice_enable_get_default_config() function, ble_enable_params.common_enable_params.vs_uuid_count = 3;
-
I checked with the softdevice_enable() function, how much RAM i need to increase. app_ram_base equal to 0x20001FE8, and when i check the ram memory in the properties of keil, i see 0x20002080. I guess that means there is enough RAM memory.
I still have the same error: NRF_ERROR_NO_MEM is the output of sd_ble_uuid_vs_add(). Can you help me please avoid this error? Thank you.