Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What causes "Error (0x80) GATT NO RESOURCES"?

I send a sequence of characteristic writes to my device, in code based on the nRF Toolbox. Sometimes I see this error message. Why does it happen and what steps can I take to avoid it?

More specifically: who lacks resources: the phone or the device?

I am using this kind of code:

writeCharacteristic(<characteristic>, <data>)
                    .with((device, data) -> log(LogContract.Log.Level.APPLICATION, <message_ok>))
                    .fail((device, status) -> log(LogContract.Log.Level.APPLICATION, "error " + status ))
                    .enqueue();

and the error message is printed immediately after the code in the .fail() callback (which prints "error 128" - the same value). If I see the fail() callback then the with() callback is not called, and the "Data written to..." message that comes from BleManager onCharacteristicWriteSafe() is not printed.

Also - is there any documentation on the usage of this writeCharacteristic().with().fail().enqueue() construction?

Parents
  • Hello!

    To be honest I've never seen error 0x80. You may try looking for this error on Android source code. It's for sure about resources on the phone. It may be that you had to many connections open, tried to enable notifications on more then 7/8/15 characteristics using a single BluetoothGatt object (depending on Android version), etc.

    Regarding the BLE Library, with() and done() are called only if there was no error. Fail() is called only on error. Doc is only in the code, but should be quite a lot of it. Is there anything not clear?

Reply
  • Hello!

    To be honest I've never seen error 0x80. You may try looking for this error on Android source code. It's for sure about resources on the phone. It may be that you had to many connections open, tried to enable notifications on more then 7/8/15 characteristics using a single BluetoothGatt object (depending on Android version), etc.

    Regarding the BLE Library, with() and done() are called only if there was no error. Fail() is called only on error. Doc is only in the code, but should be quite a lot of it. Is there anything not clear?

Children
  • I just saw this while running the nRF Connect app on an Android phone.  It seems to occur if I try to send a large block of data from the phone to my nRF52 application.  In my case, I was using the UART over BLE peripheral example, and I think that it's happening when the data I want to send from the phone is larger than the MTU size.  The UART example appears to set the maximum data size to 244 bytes.  It's smaller than that in other examples.

    I hope this helps, but I'd also love to know a way to use the existing Android apps to send large blocks of data.  Any feedback on whether this is limited to the MTU size would also be appreciated; I have had no time to dig through the Android source code.

  • I assume the nRF Connect app works in a similar way as the nRF softdevice. You can't queue too much data. If it returns something suggesting "Not enough resources" it is probably because it either tries to queue something larger than the MTU size, or several packets who's size together exceeds the buffer size.

    BR,

    Edvin

  • For my own part, the problem was a bug of my own. I don't even recall now what it was, but I was asking the device and app to do something inappropriate - something like sending characteristic read/write requests before a previous read had returned data. I am sorry for not closing off this ticket.

Related