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

BAS Update Error

Hi,

I am trying to update the battery level of my Battery Service but get keep getting an error. The error code is : 0x00003002. I cannot find any mention of what this error means though.

From stepping through my code I have found that the function causing the error is:

err_code = sd_ble_gatts_value_set(p_bas->conn_handle,
                                          p_bas->battery_level_handles.value_handle,
                                          &gatts_value);

My first guess is that I am not initialising something correctly. However, I cannot figure out what this might be after extensive looking.

Does anybody know what could cause this error to occur?

Thanks,

Parents
  • 0x00003002 is BLE_ERROR_INVALID_CONN_HANDLE.

    Have a look at ble_err.h.

    NRF_ERROR_STK_BASE_NUM is 0x00003000, and adding 0x002 to it gives 0x00003002 -> BLE_ERROR_INVALID_CONN_HANDLE

    Edit: If you call sd_ble_gatts_value_set() and you are not in a connection, you must use BLE_CONN_HANDLE_INVALID, or it will return BLE_ERROR_INVALID_CONN_HANDLE. If you are in a connection and you use a connection handle that is not valid, it will return BLE_ERROR_INVALID_CONN_HANDLE. The valid connection handle can found in p_ble_evt->evt.gap_evt.conn_handle when you get the BLE_GAP_EVT_CONNECTED event. There could be multiple valid connection handles, if you have multiple connections.

Reply
  • 0x00003002 is BLE_ERROR_INVALID_CONN_HANDLE.

    Have a look at ble_err.h.

    NRF_ERROR_STK_BASE_NUM is 0x00003000, and adding 0x002 to it gives 0x00003002 -> BLE_ERROR_INVALID_CONN_HANDLE

    Edit: If you call sd_ble_gatts_value_set() and you are not in a connection, you must use BLE_CONN_HANDLE_INVALID, or it will return BLE_ERROR_INVALID_CONN_HANDLE. If you are in a connection and you use a connection handle that is not valid, it will return BLE_ERROR_INVALID_CONN_HANDLE. The valid connection handle can found in p_ble_evt->evt.gap_evt.conn_handle when you get the BLE_GAP_EVT_CONNECTED event. There could be multiple valid connection handles, if you have multiple connections.

Children
No Data
Related