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

ble_nus_string_send error codes

Hi all,

I'm sending data with ble_nus_string_send() in a loop as shown below. If it returns an error it retries until it gets NRF_SUCCESS. I'm getting an error code 0x0013. Does anyone know what this means or where in the documentation this is stated? Thanks.

			for (int i=0; i<11; i++)
			{
				err = ble_nus_string_send(&m_nus, testData, &testDataLength);
				while (err != NRF_SUCCESS)
				{
					errorCounter++;
					err = ble_nus_string_send(&m_nus, testData, &testDataLength);
					SEGGER_RTT_printf(0, "Error encountered: %04x\n", err);
				}
			}
Parents
  • Hi,

    If you are using SDK v14.x.0, and Softdevice s132 v5.0.0, you can find Global Error Codes documentation here.

    The error code 0x0013 (decimal 19) corresponds to NRF_ERROR_RESOURCES. In the source code of ble_nus_string_send(), you can see that the return value is either NRF_ERROR_INVALID_STATE. NRF_ERROR_INVALID_PARAM, or the return value from call to sd_ble_gatts_hvx().

    The documentation give the following reason for the error code:

    NRF_ERROR_RESOURCES Too many notifications queued. Wait for a BLE_GATTS_EVT_HVN_TX_COMPLETE event and retry.

    Best regards,

    Jørgen

  • Just to add, I actually am already implementing the BLE_GATTS_EVT_HVN_TX_COMPLETE in my handler. I simply increment a counter to check that the number of packets I tried to send have sent regardless of errors. I do see the correct number the way I'm doing it now, but as I said, perhaps there is some unwanted overhead in calling the function so many times.

Reply Children
No Data
Related