CC3000 调用send函数后,中发出HCI_EVENT_CC3000_CAN_SHUT_DOWN异步事件?
开启socket后,TCP 客户端,用send()函数发送数据,服务端能接收到数据,但是程序却循环卡死了,
不久便收到HCI_EVENT_CC3000_CAN_SHUT_DOWN事件,点电重启了?
已经花了3天跟踪调试了,发现在调用send()后,模块返回了HCI_EVNT_DATA_UNSOL_FREE_BUFF事件,使得
tSLInformation.usEventOrDataReceived =0; 而SimpleLinkWaitEvent(HCI_EVNT_SEND, &tSocketSendEvent); 里面需要tSLInformation.usEventOrDataReceived !=0,才执行解事件,所以卡死在这里。
也正是因为收到HCI_EVNT_DATA_UNSOL_FREE_BUFF事件,才会有HCI_EVENT_CC3000_CAN_SHUT_DOWN,官方的代码如下:
case HCI_EVNT_DATA_UNSOL_FREE_BUFF:
{
hci_event_unsol_flowcontrol_handler(event_hdr); //
NumberOfReleasedPackets = tSLInformation.NumberOfReleasedPackets;
NumberOfSentPackets = tSLInformation.NumberOfSentPackets; //01
if (NumberOfReleasedPackets == NumberOfSentPackets)
{
if (tSLInformation.InformHostOnTxComplete)
{
tSLInformation.sWlanCB(HCI_EVENT_CC3000_CAN_SHUT_DOWN, NULL, 0);
}
}
return 1;
}
所以很奇怪,调用send()后,为什么会返回 HCI_EVNT_DATA_UNSOL_FREE_BUFF事件,而且我读了模块内部的缓存序列,是有6个为空的,应该不会有溢出之类的啊?
其他初始化和配置都很正常,
请问你用的是TI的参考板吗? 这个问题是发第一个数据包就会出现吗?
您好,这个问题已经解决了,是我的模块固件版本太低,升级一下就OK了
可是在我调用Send()函数后数据能正常发送,也不会卡死,可是模块依然会发一个HCI_EVENT_CC3000_CAN_SHUT_DOWN(0x99)异步事件给我
请问这是正常的吗?
你忽略掉它好,它只是告诉你发送完了,你如果有需要可以shut down CC3000. 你可以在启动的时候就用wlan_set_event_mask把这个事件mask掉就好了。
好的,非常感谢。解决问题了
https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc3000/f/851/t/339046
You cannot mask HCI_EVENT_CC3000_CAN_SHUT_DOWN.
You are only allowed to mask the below events as mentioned in the API documentation.
//! HCI_EVNT_WLAN_UNSOL_CONNECT connect event
//! HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event
//! HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE smart config done
//! HCI_EVNT_WLAN_UNSOL_INIT init done
//! HCI_EVNT_WLAN_UNSOL_DHCP dhcp event report
//! HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report
//! HCI_EVNT_WLAN_KEEPALIVE keepalive
//! HCI_EVNT_WLAN_TX_COMPLETE - disable information on end of transmission
好像只可以忽略上述几个,HCI_EVNT_DATA_UNSOL_FREE_BUFF即使调用wlan_set_event_mask也没有用,发送完毕还是会异步受到的。