Hello Cypress WICED Studio Support team,
I found unexpected behavior of WICED Studio 6.2.1.2.
At the following environment, SPP data transfer isn't completed.
[Environment]
ClientControl----CYW20706 <-----> CYW20706---ClientControl
CYW920706WCDEVAL or CYBT-343026-EVAL
WICED Studio 6.2.1.2
apps/demo/hci_audio_gateway
SPP profile (hci_control_spp.c)
[Test procedure]
1. build and download "apps/demo/hci_audio_gateway" on WICED Studio.
2. Select SPP tab, "Connect" to peer and "Send" large file on Client Control.
[Attached file]
log/ log files
sent_data.txt
-> sent data
Orig_ClientControl_log_master.txt
Orig_ClientControl_log_slave.txt
-> log of ClientControl. Master device sent data to slave device.
Orig_BTSpy.txt
-> log of BTSpy
Orig_received_data.txt
-> received data. It should be same with sent_data.txt, but it is too short.
Fixed_ClientControl_log_master.txt
Fixed_ClientControl_log_slave.txt
Fixed_received_data.txt
-> log files when the following patch is applied.
patch/ patch files
client_control_spp_patch.txt
-> patch file for spp.cpp in common/client_control/source/.
hci_control_spp_patch.txt
-> patch file for hci_control_spp.c in apps/demp/hci_audio_gateway/.
[My investigation]
wiced_bt_rfcomm_write_data() returns WICED_BT_RFCOMM_CMD_PENDING.
But hci_control_cpp and ClientControl couldn't handle it correctly.
The WICED_BT_RFCOMM_CMD_PENDING is not a critical error.
So, it would be better to be handled same as WICED_BT_RFCOMM_SUCCESS.
Could you double check my investigation ?
And, if it is correct, please fix this issue at the next release.
Solved! Go to Solution.
Hi,
We have escalated this issue to our stack team.
Regards,
Anjana
Hi Anjana,
Thank you for updating your status.
Please share the result when investigation will be done.
Best regards,
Mizuno
Hello,
The problem was that the SPP app was entering flow control. The attached 2 files correctly handle flow control "on and off" when notified by the BT stack and properly notify "Clientcontrol" with the proper event.
Please replace the existing "hci_control.h" and "hci_control_spp.c" with the attached.
The folder is : "C...\WICED-Studio-6.21.2\common\apps\demo\hci_audio_gateway\"
Could you please test it at your side and let us know ?
Thanks,
Anjana
Hello Anjana,
I found two issues about your patches.
1) Some data was lost.
Please see the attached file, "log.zip".
I sent "log.txt". The received data is log_recv.txt.
When wiced_bt_rfcomm_write_data() returns WICED_BT_RFCOMM_CMD_PENDING, hci_spp_write() also returns WICED_BT_RFCOMM_CMD_PENDING.
In this case,
hci_spp_send()
{
result = hci_spp_write( handle, p_data, length, &bytes_written ); ---> "result == WICED_BT_RFCOMM_CMD_PENDING"
---> NOTE: At this point, some data might be queued but not all data. i.e. bytes_written < length.
is_an_error = ! (( result == WICED_BT_RFCOMM_SUCCESS ) || ( result == WICED_BT_RFCOMM_NO_MEM )); ---> "is_an_error == TRUE"
if( ( bytes_written != length ) && ( !is_an_error ) ) ---> "goto else"
if ( !is_an_error ) ---> "goto else"
p_scb->tx_complete_pending = 1;
hci_control_port_event_cback()
if ( ( event & PORT_EV_FCS ) && ( p_scb->flow_control ) )
if (hci_control_cb.spp_scb.tx_complete_pending)
hci_spp_send_tx_complete( handle, WICED_BT_RFCOMM_SUCCESS );
---> !!! Although some data was not queued, but hci_spp_send_tx_complete() returns SUCCESS.
i.e. DATA was LOST.
We have to store unsent data to p_scb->pending_buffer.
2) Sending didn't terminated even if SPP link was disconnected.
Please see the followings.
This is a case which SPP link was disconnected by a peer device during SPP sending.
In this case, hci_spp_write() returns ERROR.
is_an_error = ! (( result == WICED_BT_RFCOMM_SUCCESS ) || ( result == WICED_BT_RFCOMM_NO_MEM )); ---> "is_an_error == TRUE"
if ( !is_an_error ) ---> "goto else"
p_scb->tx_complete_pending = 1;
i.e. hci_spp_send_tx_complete() is never called. So, ClientControl shows "Wait failed".
Could you double check them ?
Best regards,
Mizuno
Hello,
Thanks for your results. Will check it and update you.
Regards,
Anjana
Can you confirm what application is on the "CYBT_343026_EVAL(UART=1Mbps): received data"
Is it the same application running in this environment? Client Control -> SPP -> Receive Data?
Does this application have fixes / changes to "hci_control_spp.c" and "hci_control.h"?
Hello Anjana,
> Is it the same application running in this environment? Client Control -> SPP -> Receive Data?
Yes. I used ClientControl for both evaluation boards.
I rebuilt ClientControl to support 1Mbps. (add 1000000 to as32BaudRate in device_manager.cpp)
Client Control -> SPP -> Receive -> Receive to file.
> Does this application have fixes / changes to "hci_control_spp.c" and "hci_control.h"?
Yes. Both FW for CYW920706 and CYBT-343026 are applied your patches, hci_control_spp.c and hci_control.h.
Best regards,
Mizuno