This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

recover from BLE_GATTC_EVT_TIMEOUT

I have an nrf51822 S110 based application that tries to discover the primary services on the GATT server at every connection of a central.

Unfortunately, the central does not always have a GATT server to respond to the service discovery and this ends up with a BLE_GATTC_EVT_TIMEOUT.

What I experience is that after this timeout event, all the write requests to the peripheral characteristics from the central are not reported by the S110 softdevice.

To get it back to a normal state, I have to disconnect the central and reconnect which triggers the services discovery again.

Is there anything to do to clear this GATT client failing procedure and not have to disconnect the link?

Thanks

  • No, this is required per spec.

    Bluetooth Spec 4.1, Volume 3, Part F, Chapter 2:

    "A transaction not completed within 30 seconds shall time out. Such a transaction shall be considered to have failed and the local higher layers shall be informed of this failure. No more attribute protocol requests, commands, indications or notifications shall be sent to the target device on this ATT Bearer."

    This rule is usually applied to many of the different protocol channels, but with varying timeouts. The only way to reset this state is to set up a new connection to the device, as this creates a new ATT Bearer.

    When you mention that the central does not always have a GATT server, do you mean that it sometimes does not have the time or resources to respond to the request - or that there simply is nothing to discover? In the latter case, the central device would be lacking mandatory services and break the spec. If it is not able to respond in a timely manner, it should tear down the link and set it back up when it has the resources to do so.

  • Ulrich, Thanks for the quick answer.

    The central that connects to my nrf51822 is a bluez based application. It does not respond to the primary service discovery because it does not have the gatt server compiled in (I suppose).

    Is it mandatory for a central that only wants to use the gatt client procedures to reply to the gatt client procedures initiated by the peripheral?

    Otherwise, is there a way on the device to check that the central that connected has a gatt server?

    Thanks

  • It is mandatory to at least be able to respond with an error response, so you might need to compile in the GATT Server for that. If the central responds with e.g Error 0x06 (Request Not Supported), the transaction is marked as completed, and the discovery procedure will stop.

Related