Hello,
I have a standalone application which incorporates 3 public BLE services and 2 services with custom UUIDs. Today I tried to extend the buttonless DFU example with these services. Everything works fine unless I try to add my custom services. I get "APP_ERROR:ERROR:Fatal" in UART Log. Is there some kind of switch to make the softdevice only accept public UUIDs? Unfortunately I had no luck debugging the application since the secure bootloader is involved. The application without booloader/buttonless DFU service works just fine.
I use SDK 12.1.0 on nRF51.
Here is my init function of one of my custom services:
void lum_service_init(ble_lum_t * p_our_service)
{
/* Service */
uint32_t err_code;
ble_uuid_t service_uuid;
ble_uuid128_t base_uuid = BLE_UUID_OUR_BASE_UUID;
service_uuid.uuid = BLE_UUID_LUM_SERVICE;
err_code = sd_ble_uuid_vs_add(&base_uuid, &service_uuid.type);
APP_ERROR_CHECK(err_code);
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
&service_uuid,
&p_our_service->service_handle);
APP_ERROR_CHECK(err_code);
ble_uuid_t char_uuid;
char_uuid.uuid = BLE_UUID_LUM_CHARACTERISTC_UUID;
err_code = sd_ble_uuid_vs_add(&base_uuid, &char_uuid.type);
APP_ERROR_CHECK(err_code);
/* Characteristic */
ble_gatts_attr_md_t attr_md;
memset(&attr_md, 0, sizeof(attr_md));
attr_md.vloc = BLE_GATTS_VLOC_STACK; /* store metadata in SoftDevice */
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); /* allow reading of values */
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); /* allow writing of values */
/* Characteristic Value Attribute */
ble_gatts_attr_t attr_char_value;
memset(&attr_char_value, 0, sizeof(attr_char_value));
attr_char_value.p_uuid = &char_uuid;
attr_char_value.p_attr_md = &attr_md; /* assign attribute metadata to characteristic value attribute */
attr_char_value.max_len = 4; /* max value length */
attr_char_value.init_len = 4; /* initial value length */
attr_char_value.p_value = (uint8_t*)&Luminosity; /* ptr to actual value */
/* Characteristic Metadata */
ble_gatts_char_md_t char_md;
memset(&char_md, 0, sizeof(char_md));
char_md.char_props.read = 1; /* set read property */
char_md.char_props.write = 0; /* set write proper */
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);
}
And here is my ble_lum_t typedef:
typedef struct
{
uint16_t conn_handle; /* handle to keep track of the current connection */
uint16_t service_handle; /**< Handle of Our Service (as provided by the BLE stack). */
ble_gatts_char_handles_t char_handles; /* characteristics handle */
}ble_lum_t;
I use
#define BLE_UUID_OUR_BASE_UUID {0x23, 0xD1, 0x13, 0xEF, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00} // 128-bit base UUID
as base UUID for all custom services and a random 16-Bit value for the service itself:
#define BLE_UUID_LUM_SERVICE 0xABCE // Just a random, but recognizable value
and for the characteristics:
#define BLE_UUID_LUM_CHARACTERISTC_UUID 0xBEF0
Can you tell me whats wrong?
Thank you very much!