蓝牙技术
直播中

李敏

8年用户 1444经验值
私信 关注
[问答]

求助,关于CYW20820 spp问题求解

我正在使用 CYW20820spp Bluetooth®发送数据。 目前每20ms发送512字节的数据。我使用函数wiced_bt_spp_send_session_data(spp_handle, p_data, len);并且在调用发送函数之前调用iced_bt_spp_can_send_more_data(spp_handle)以确保可以发送下一个数据包。主机是手机SPP Bluetooth®调试助手。 我发现 SPP 缓冲区偶尔会满。我通过wiced_bt_spp_port_purge(spp_handle, PORT_PURGE_TXCLEAR)释放了缓冲区,但是没有办法解决这个问题。如何解决这个问题?CYW20820不支持这么快的传输吗?
uint8_t app_send_data(uint8_t *p_data, uint32_t len){    int i;    wiced_bool_t ret;    static int spp_send_fail_count = 0;    static int spp_send_success_count = 0;    static int count=0,disconnect_count=0;    wiced_result_t  result;    if(count>20)    {            count=0;            error[0]= (spp_send_fail_count * 100) / (spp_send_success_count + spp_send_fail_count);            if(spp_send_fail_count>20)            {                    fail_to_reset++;                    if(fail_to_reset>=5)                    {                            fail_to_reset=0;flag_spp_error=1;                   wiced_bt_spp_port_purge(spp_handle,PORT_PURGE_TXCLEAR);                    }            }            else            {                    flag_spp_error=0;                    fail_to_reset=0;            }            spp_send_fail_count=0;spp_send_success_count=0;   }    flag_spp_autoconnect=1;    if (spp_handle == 0)    {        return 0;    }    ret = wiced_bt_spp_can_send_more_data(spp_handle);    if (!ret)    {            spp_send_fail_count++;            count++;            wiced_rtos_delay_milliseconds(2, ALLOW_THREAD_TO_SLEEP);        return 0;    }    ret = wiced_bt_spp_send_session_data(spp_handle, p_data, len);    if (!ret)    {            spp_send_fail_count++;            count++;        return 0;    }    spp_send_success_count++;    count++;    return 1;}
                                                                                                                                                                                                                                                                                                                                                                                                      

更多回帖

发帖
×
20
完善资料,
赚取积分