Hello, after successfully calling sd_softdevice_enable(), I call ble_cscs_init() and that function returns with error code 7, which means NRF_ERROR_INVALID_PARAM. I've tracked this return value down to call into the softdevice -> sd_ble_gatts_characteristic_add() in the function csc_measurement_char_add().
The first parameter to sd_ble_gatts_characteristic_add() is p_cscs->service_handle, where p_cscs is the first parameter to ble_cscs_init() and documented as output parameter. So the value is set by the API.
The second parameter is char_md, wich is initialized by memset followd by some assignments in csc_feature_char_add(), so this value is defined by the API too.
The third parameter is attr_char_value which seems to be derived from p_cscs_init->feature (0) and p_cscs_init->csc_feature_attr_md.read_perm ({sm = 0 '\000', lv = 0 '\000'}) and has the following value:
{p_uuid = 0x20003f08, p_attr_md = 0x20003f04, init_len = 1, init_offs = 0, max_len = 20, p_value = 0x20003ee0 ""}
with p_uuid = {uuid = 10843, type = 1 '\001'}
and p_attr_md = `{read_perm = {sm = 0 '\000', lv = 0 '\000'}, write_perm = {sm = 0 '\000', lv = 0 '\000'}, vlen = 1 '\001', vloc = 1 '\001',
rd_auth = 0 '\000', wr_auth = 0 '\000'}
The last parameter is &p_cscs->feature_handles and is an output parameter.
So the invalid parameter must be the third parameter. Can someone of you see what's wrong here? BTW: are there othere documentation sources beside the SDK?
Edit: I've tracked this down to the ble_cscs_init_t not beeing initialized. I've declared the structure to be a C++ static const
and I would expect the structure to be mapped into ROM, but the address is 0x20002400 and the structure seems to be all zero initialized. So this seems to be a bug in the used startup files and linker scripts, right?
Kind regards, Torsten