Hi,
I add the SPS profile to BLE example ANCS to send data over TX attribute when button is pressed. I use the "sps_tx_data" function to send data.
The data is correctly receive on an android device connected to BLE. But after few transfers (not a fix number of send and not dependent of the number of byte sent) no more data are sent with the "sps_tx_data" function. The function "sps_tx_data" return before sending data because the function "get_tx_lenght" differ from 0.
The last sent before blocking, the tx done callback is called with 0 bytes sent. This is caused by an error in "handle_event_sent" function, the "get_tx_lenght" function return error because the function "generic_get_cmd" return BLE_ERROR_NOT_FOUND.
I found a temporary workaround : In function "sps_tx_data", i moved the call to function "set_tx_lenght" before the call of "send_tx_data".
This seems to be timing issue, do you have any clues of miss configurations that could lead to such error ?
Hi Joffrey COFFINEAU,
I ve placed an internal ticket on that, the team is checking the issue.
Thanks MT_dialog
Hi Joffrey COFFINEAU,
The purpose of set_tx_length and get_tx_length is to store the length of last TX and to act as a flag indicating TX in progress. If you see get_tx_length always returns 0, it means that you are sending data much faster than the BLE speed. So try to lower your data rate or increase your BLE throughput, the issue should not happen.
You can adapt the position of these two API to send aggressively the TX data. Then the stack is at the risk of overloading.
Thanks MT_dialog