TI中文支持网
TI专业的中文技术问题搜集分享网站

CC2640R2L: 通过BLE间隔10ms通过Notify发送一包数据,存在丢包情况

Part Number:CC2640R2L

使用BLE的Notify功能,通过定时器每隔10ms向手机发送一包数据,每包数据20字节,发送大约4000包后出现丢包情况,每次丢1包,再次发送大约2000包后再丢一包,这种情况是为什么呢?

当前的连接间隔:

// Minimum connection interval (units of 1.25ms, 80=100ms) for automatic
// parameter update request
#define DEFAULT_DESIRED_MIN_CONN_INTERVAL16//20

// Maximum connection interval (units of 1.25ms, 800=1000ms) for automatic
// parameter update request
#define DEFAULT_DESIRED_MAX_CONN_INTERVAL32//40

发送代码:

//10msif (events & KFD_DATA_RECV_DELAY_EVT){events &= ~KFD_DATA_RECV_DELAY_EVT;Util_startClock(&dataRecvDelayClock);if(tempTimes>=199){Util_stopClock(&dataRecvDelayClock);}tempTimes++;Pfd_ServApp_SendNotiInd(&tempdata[0],20);}

发送Notify的代码:

bStatus_t Pfd_ServApp_SendNotiInd(uint8_t *nvalue, uint16_t nlen)
{attHandleValueNoti_t noti;uint16_t slen;bStatus_t status;slen  = nlen;gattCharCfg_t *pItem = Pfd_ProfileChar4Config;if(PFDexConnected){pItem->connHandle = Pfd_CCC_Handle;}if  ( pItem->connHandle != INVALID_CONNHANDLE ){//check the notify CCCD open of notif (!GATTServApp_ReadCharCfg(pItem->connHandle, Pfd_ProfileChar4Config)){GATTServApp_WriteCharCfg(pItem->connHandle,Pfd_ProfileChar4Config,1);}//the above added by liningnoti.pValue = (uint8 *)GATT_bm_alloc( pItem->connHandle, ATT_HANDLE_VALUE_NOTI,slen,&slen);//GATT_MAX_MTU, &slen );if ( noti.pValue != NULL )//申请到了地址。=NULL说明没申请到地址{noti.handle =  Pfd_ProfileAttrTbl[2].handle;noti.len = slen;memcpy(noti.pValue, nvalue, slen);// CCCD enabled, send notificationstatus = GATT_Notification( pItem->connHandle, &noti, FALSE );if ( status != SUCCESS ){GATT_bm_free( (gattMsg_t *)&noti, ATT_HANDLE_VALUE_NOTI );}}else{GATT_bm_free( (gattMsg_t *)&noti, ATT_HANDLE_VALUE_NOTI );status = bleNoResources;}}return ( status );
}

Links:

您好,

已了解您的疑问,我们这边会调查下,明天会做出更新。

,

Links:

感谢您对TI产品的关注!为更加有效地解决您的问题,我们建议您将问题发布在E2E英文技术论坛上(e2e.ti.com/…/addpost

赞(0)
未经允许不得转载:TI中文支持网 » CC2640R2L: 通过BLE间隔10ms通过Notify发送一包数据,存在丢包情况
分享到: 更多 (0)