How to verify BLE response was actually sent to write request?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
EyGe_3183606
Level 4
Level 4
25 replies posted 10 sign-ins 10 replies posted

Hello, 

I have a PSOC 4 MCU with BLE 4.1

I would like to understand if there is a way to verify a write response was actually sent to a write request?

Today, I use this API function provided by cypress: 

 

 

CyBle_GattsWriteRsp(cyBle_connHandle)

 

 

The function is said to return the following options:

 

 

* \return
*  CYBLE_API_RESULT_T : Return value indicates if the function succeeded or
*  failed. Following are the possible error codes.
*
*  Errors codes                          | Description
*  ------------                          | -----------
*   CYBLE_ERROR_OK                       | On successful operation
*   CYBLE_ERROR_INVALID_PARAMETER        | 'connHandle' value does not represent any existing entry in the Stack
*   CYBLE_ERROR_INVALID_OPERATION        | This operation is not permitted
*   CYBLE_ERROR_MEMORY_ALLOCATION_FAILED | Memory allocation failed

 

 

So even if I get CYBLE_ERROR_OK returned, it doesn't necessarily mean that the response was sent yet. I understand that it just means that the request to send a response has been received successfully by the stack and it will now take care of it asynchronously. This is a problem for us because we need to reset the MCU immediately after receiving a specific write request. But we need to send a response before the reset, otherwise, it will cause a problem in the device that had sent the write request.

So we need to be able to know that the response has actually been sent. How can we know this?

Thanks,

Eyal

0 Likes
1 Solution

Hello,

You can check for CYBLE_EVT_TIMEOUT event at the server side. If a write response is not sent to the client side, then CYBLE_EVT_TIMEOUT event will occurs at the server side(after 30 seconds) with a Timeout reason CYBLE_GATT_RSP_TO.
Please refer to this event in the BLE component datasheet for more information.

Thanks,
P Yugandhar.

View solution in original post

5 Replies