Hi I have this piece of code which works in SDK 12 but when I port it to SDK 15 the sd_ble_gatts_characteristic_add function would fail with an error code of 7. No change seems to be working. Any help is appreciated,.
uint32_t err_code; ble_gatts_char_md_t char_md; ble_gatts_attr_md_t cccd_md; ble_gatts_attr_t attr_char_value; ble_uuid_t char_uuid; ble_gatts_attr_md_t attr_md; NRF_LOG_INFO("Resetting Characteristics security\r\n") memset(&cccd_md, 0, sizeof(ble_gatts_char_md_t)); cccd_md.vloc = BLE_GATTS_VLOC_STACK; /* * The access must be open for both read and write for * the Client Characteristic Configuration descriptor */ BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm); BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm); NRF_LOG_INFO("Resetting Characteristics\r\n") memset(&char_md, 0, sizeof(ble_gatts_char_md_t)); char_md.char_props.read = 1; char_md.char_props.notify = 1; char_md.char_props.write = 1; char_md.p_char_user_desc = NULL; char_md.p_char_pf = NULL; char_md.p_user_desc_md = NULL; char_md.p_cccd_md = &cccd_md; char_md.p_sccd_md = NULL; char_uuid.uuid = UUID_CHAR_0_0; char_uuid.type = p_service->uuid_type; NRF_LOG_INFO("Resetting Attribute\r\n") memset(&attr_md, 0, sizeof(ble_gatts_attr_md_t)); BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm); BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); attr_md.vloc = BLE_GATTS_VLOC_USER; NRF_LOG_INFO("Resetting value\r\n") memset(&attr_char_value, 0, sizeof(ble_gatts_attr_t)); attr_char_value.p_uuid = &char_uuid; attr_char_value.p_attr_md = &attr_md; attr_char_value.init_len = MAX_CHANNELS * SAMPLES_IN_BUFFER; attr_char_value.init_offs = 0; attr_char_value.max_len = MAX_CHANNELS * SAMPLES_IN_BUFFER; attr_char_value.p_value = m_char_buf; NRF_LOG_INFO("Adding new characteristics\r\n") err_code = sd_ble_gatts_characteristic_add(p_service->service_handle, &char_md, &attr_char_value, &p_service->char_handles); APP_ERROR_CHECK(err_code); NRF_LOG_INFO("Added new characteristics\r\n");