Hi,
As the title states when I try to add characteristic to my custom service the function returns error 16.
I have set NRF_SDH_BLE_VS_UUID_COUNT and adjusted the linker accordingly.
The offending code:uint8_t dfu_encoded_value = 0;
//memset(dfu_encoded_value, 0,sizeof(ble_dfu_service_t));
ble_add_char_params_t add_dfu_params;
memset(&add_dfu_params, 0,sizeof(ble_dfu_service_t));
SEGGER_RTT_printf(0, "[%s %s %d]dfu_encoded_value ptr: %p\n\r",__FILE__,__func__,__LINE__,&dfu_encoded_value);
add_dfu_params.uuid = CHARACTERISTIC_DFU_UUID;
add_dfu_params.uuid_type = ble_uuid.type;
add_dfu_params.max_len = sizeof(ble_dfu_service_t);
add_dfu_params.init_len = sizeof(ble_dfu_service_t);
add_dfu_params.p_init_value = &dfu_encoded_value;
add_dfu_params.char_props.read = 1;
add_dfu_params.char_props.write = 1;
add_dfu_params.read_access = SEC_OPEN;
add_dfu_params.write_access = SEC_OPEN;
// 1 for variable length and 0 for fixed length.
add_dfu_params.is_var_len = 1;
SEGGER_RTT_printf(0, "[%s %s %d]add_dfu_params.p_init_value ptr: %p\n\r",__FILE__,__func__,__LINE__,add_dfu_params.p_init_value);
err_code = characteristic_add(p_service->service_handle,&add_dfu_params,&(p_service->dfu));
if (err_code != NRF_SUCCESS) {
SEGGER_RTT_printf(0, "%s %d error: %d\n\r",__FILE__,__LINE__,err_code);
return err_code;
}
debug print 0> [../main.c main 372]Program Start
0> [../svr/service.c ble_name_service_init 631]dfu_encoded_value ptr: 2000FEEB
0> [../svr/service.c ble_name_service_init 643]add_dfu_params.p_init_value ptr: 2000FEEB
0> ../svr/service.c 648 error: 16
0> [../svr/nrf_ble_es.c services_init 476]error 16
Suspecting an invalid pointer at add_dfu_params.p_init_value but have try multiple different methods of declaring the pointer with no luck.
Have gotten it to print error 12 at times.
This is code ported from a NRF52840 to a NRF52832.
Started the make file of the NRF52832 from example code.
The base example is ble_app_eddystone.
The service add just fine if I remove the code.
Using SDK15.3
Compiler GNU Tools ARM Embedded/ 2018-q2-update
Regards