This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Getting NRF_ERROR_INVALID_DATA when calling sd_ble_gattc_read

Hello,

I'm working with a nrf51822, SoftDevice S120 v2.0 and SDK v9.0 platform.

Specifically using it a Central role to connect to a Blood Pressure peripheral.

I'm trying to read the Battery Level (BLE_UUID_BATTERY_LEVEL_CHAR) char.

When I initially send the sd_ble_gattc_read() command I get a BLE_GATTC_EVT_READ_RSP but the peripheral complains I don't have BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION. (this is a seperate issue I need to work out myself)

I then call dm_security_setup_req() again which results DM_EVT_LINK_SECURED.

After which I call sd_ble_gattc_read() read again on BLE_UUID_BATTERY_LEVEL_CHAR.

This BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION + DM_EVT_LINK_SECURED + sd_ble_gattc_read() loop continues for around 23 times and then suddenly sd_ble_gattc_read() results in a NRF_ERROR_INVALID_DATA (0x011) error and the loop stops.

Is this some kind of protection to prevent loops? or something else?

Thanks very much, Mark

Related