单片机。在我的项目中,该cyble单片机的Android装置进行通信,发送25-30字节的数据每250毫秒。但是如果我让Android设备上,cyble测试更长一段时间,我的联系被几个小时后无故掉线。
用这个BLE API发送数据,
空隙sDeDATA(空隙*有效载荷,int siZeOffSeaLoad)
{
CyBLY-GATSH-HANDLY ValueEntfft瞬变;
temphandle.attrhandle = cyble_tapservice_tapdata_char_handle;
TyPHANDEL.ValueVal=(Uti8*)有效载荷;
TyPHANDEL.Value.Le= SiZeFoePosiLoad;
cyble_gattswriteattributevalue(&;temphandle,0,&;cyble_connhandle,cyble_gatt_db_locally_initiated);
/ *发送通知客户如果通知启用和手指的位置改变了*/
CyBLY-GATS通知(CysLyCon句柄,and MAMPANDLE);
}
这是我所面对的日志,
在0:初始化的硬件/ / T = 0秒,我打开的硬件
在0:CyBLY-EVTH Staskon
在0:CyLay-EvtggppiAdvultEngStestStut-Sturt
在46:CyBLY-EVTGGATTA连接器
46:cyble_evt_gap_device_connected / / 46秒钟后,它被连接到Android设备
20600:cyble_evt_gatt_disconnect_ind /后20600秒以后的正常运行时间,它断开,当可断开,首先给堆栈忙
在20600:CyBeLyEvtgGAPI DEVICESY断开
在20600:CyLay-EvtggppiAdvultEngStestStut-Sturt
在20602:CyBLY-EVTGGATTA连接器
在20602:cyble_evt_gap_device_connected / /在20602秒以来的正常运行时间,再连接到Android设备
24444:cyble_evt_stack_busy_status / /在24444秒的时间以来,它得到的堆栈忙事件
24462:cyble_evt_stack_busy_status / / 18秒后,又收到BLE堆栈忙碌的事件,这一次它会断开连接。
在24462:CyBLY-EVTA GATTHI隔离连接器
在24462:CyBeLyEvtgGAPI DEVICESY断开
24462:cyble_evt_gapp_advertisement_start_stop / BLE开始广告几秒钟后再接收连接事件和连接
在24477:cyble_evt_gatt_connect_ind
24477:cyble_evt_gap_device_connected
24477:cyble_evt_gap_connection_update_complete
24477:cyble_evt_gap_connection_update_complete
52698:cyble_evt_stack_busy_status / /在52698秒以后的正常运行时间,又收到堆栈忙事件
52716:cyble_evt_stack_busy_status / / / / 18秒后,又收到BLE堆栈忙碌的事件,这一次它会断开连接。
52716:cyble_evt_gatt_disconnect_ind
52716:cyble_evt_gap_device_disconnected
52716:cyble_evt_gapp_advertisement_start_stop
52941:cyble_evt_gatt_connect_ind
52941:cyble_evt_gap_device_connected
52941:cyble_evt_gap_connection_update_complete
在52942:cyble_evt_gap_connection_update_complete
所以这是发生了什么,每次当我收到堆栈忙事件,18秒钟后我收到一堆忙碌的事件,它会断开连接。然后再连接,几个小时后我收到一堆忙碌的事件,18秒钟后我收到一堆忙碌的事件和非常第二它会断开连接。
谁能帮助这是怎么发生的,我该如何解决这个问题?断开和重联的预计情况稳定后几个小时?
谢谢,
钱德雷什
以上来自于百度翻译
以下为原文
Hello,
I am chandresh and i am using CYBLE-014008-00 BLE Psoc-4 MCU. In my project, The CYBLE MCU communicates with an android device and sends 25-30 bytes of data every 250 msec. However IF i keep both the android device and CYBLE on for testing for longer period of time, My Connection gets dropped after few hours for no reason.
To send the data i use this BLE API,
void senddata(void *payload, int sizeofPayload)
{
CYBLE_GATTS_HANDLE_VALUE_NTF_T tempHandle;
tempHandle.attrHandle = CYBLE_TAPSERVICE_TAPDATA_CHAR_HANDLE;
tempHandle.value.val = (uint8 *) payload;
tempHandle.value.len = sizeOfPayload;
CyBle_GattsWriteAttributeValue(&tempHandle,0,&cyBle_connHandle,CYBLE_GATT_DB_LOCALLY_INITIATED);
/* send notification to client if notifications are enabLED and finger location has changed */
CyBle_GattsNotification(cyBle_connHandle,&tempHandle);
}
Here is the log of what i have been facing,
At 0: Initializing BLE Hardware // At t=0 seconds, i have turned on the BLE hardware
At 0: CYBLE_EVT_STACK_ON
At 0: CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP
At 46: CYBLE_EVT_GATT_CONNECT_IND
At 46: CYBLE_EVT_GAP_DEVICE_CONNECTED // After 46 seconds, it gets connected to the android device
At 20600: CYBLE_EVT_GATT_DISCONNECT_IND // After 20600 secs since uptime,it gets disconnected,Now when BLE gets disconnected, it first gives STACK BUSY
At 20600: CYBLE_EVT_GAP_DEVICE_DISCONNECTED
At 20600: CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP
At 20602: CYBLE_EVT_GATT_CONNECT_IND
At 20602: CYBLE_EVT_GAP_DEVICE_CONNECTED // At 20602 seconds since uptime, It again connects to the android device
At 24444: CYBLE_EVT_STACK_BUSY_STATUS // At 24444 seconds since uptime, it gets BLE STACK BUSY EVENT
At 24462: CYBLE_EVT_STACK_BUSY_STATUS // 18 seconds later, again it receives BLE STACK BUSY EVENT, this time it gets disconnected.
At 24462: CYBLE_EVT_GATT_DISCONNECT_IND
At 24462: CYBLE_EVT_GAP_DEVICE_DISCONNECTED
At 24462: CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP // BLE STARTS advertising and again after few seconds it receives connect event and connects
At 24477: CYBLE_EVT_GATT_CONNECT_IND
At 24477: CYBLE_EVT_GAP_DEVICE_CONNECTED
At 24477: CYBLE_EVT_GAP_CONNECTION_UPDATE_COMPLETE
At 24477: CYBLE_EVT_GAP_CONNECTION_UPDATE_COMPLETE
At 52698: CYBLE_EVT_STACK_BUSY_STATUS // AT 52698 seconds since uptime, it again receives STACK BUSY event
At 52716: CYBLE_EVT_STACK_BUSY_STATUS 18 seconds later, again it receives BLE STACK BUSY EVENT, this time it gets disconnected.
At 52716: CYBLE_EVT_GATT_DISCONNECT_IND
At 52716: CYBLE_EVT_GAP_DEVICE_DISCONNECTED
At 52716: CYBLE_EVT_GAPP_ADVERTISEMENT_START_STOP
At 52941: CYBLE_EVT_GATT_CONNECT_IND
At 52941: CYBLE_EVT_GAP_DEVICE_CONNECTED
At 52941: CYBLE_EVT_GAP_CONNECTION_UPDATE_COMPLETE
At 52942: CYBLE_EVT_GAP_CONNECTION_UPDATE_COMPLETE
So this is what happends, everytime when i receive STACK BUSY event, 18 seconds later i receive another STACK BUSY event and it gets disconnected. then it connects again and after few hours i receive STACK BUSY event once, 18 seconds later i receive another STACK BUSY event and on that very second it gets disconnected.
Can anyone help on how this is happening and how can i resolve this? disconnection and reconnection is expected in case of BLE after few hours?
Thanks,
Chandresh
0