- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Labels:
-
PSoC 4 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Write Response(CyBle_GattsWriteRsp api) from a GATT Server results in CYBLE_EVT_GATTC_WRITE_RSP event at the client side. Please check this event at the client side which indicates that the write operation is succeeded.
Thanks,
P Yugandhar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @Yugandhar .
However, isn't there a way to do this on the server side?
For example, similarly, there is a way to know when a broadcast transmission has taken place by assigning a callback function to a relevant BLESS event.
Isn't there something similar we can do on the server side? I don't want to necessarily know that the client received my transmission. I just want to know that I had sent it.
Thanks,
Eyal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @Yugandhar .
That is indeed a possible solution.
The downside of it, is that if the response was sent successfully I would have to wait 30 seconds to verify this event didn't occur before I can reset the MCU. I mean, in order to verify the response was sent, I would need to verify that something doens't happen.
Isn't there something else, more effective, that I could do that wouldn't require me to wait so long?
I mean, I would just want to send the response, and as soon as possible verify it was sent so that I could reset the MCU as fast as possible.
Thanks,
Eyal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Could you please explain more on your application ? If you use the 'WriteWithoutResponse' property instead of 'Write' property at the server side, then you don't need to send a write response for a write request. For more information, you can refer to the DAY020_BLE_UART code example from the GitHub, where this project uses 'WriteWithoutResponse' property in a custom service for sending data from central.
Please let me know if this helps.
Thanks,
P Yugandhar.