Part Number:CC2640R2FOther Parts Discussed in Thread:CC2640
主机是cc2642,从机是cc2640,
一主6从时,可以打开notify,并进行数据传输,一主7从时,第七个从机打开notify失败。一主8从时,也是第七个从机打开notify失败。更多从机还需要其他设置吗?
for(i=0;i<MAX_NUM_BLE_CONNS;i++){req.pValue = GATT_bm_alloc(connList[i].connHandle, ATT_WRITE_REQ, 2, NULL);if ( req.pValue != NULL ){if(index ==SIMPLEPROFILE_CHAR1){req.handle = connList[i].charHandle+1;}else if(index ==SIMPLEPROFILE_CHAR2){req.handle = connList[i].charHandle+5;}req.len = 2;req.pValue[0] = LO_UINT16(GATT_CLIENT_CFG_NOTIFY); //0x0001为开notify;req.pValue[1] = HI_UINT16(GATT_CLIENT_CFG_NOTIFY);req.sig = 0;req.cmd = 0;uint8_t status = GATT_WriteCharValue(connList[i].connHandle, &req, selfEntity); //System_printf("Notification connHandle:%d,%d\r\n",connList[i].connHandle,i);CPUdelay(100);//250 * 48 / 4//6*3if ( status != SUCCESS ){GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ);#ifdef uart_debug //System_printf("Notification failed:%d\r\n",i);pStrAddr = (uint8_t*) Util_convertBdAddr2Str(connList[i].addr);System_printf( "Notification failed:%d , %s\r\n", i,pStrAddr);#endif //return false;i--; //CPUdelay(6*3);} //else //{ ////SimpleCentral_autoConnect(); ////System_printf("Notification success:%d\r\n",i); //return true;//return use careful! //}}}
Katherine Wang:
已为您联系TI工程师,稍后给您回复
,
Katherine Wang:
您能告诉我您用于 CC2642 和 CC2640R2 的 SDK 版本吗?
,
caiyu:
simplelink_cc13x2_26x2_sdk_4_30_00_54
simplelink_cc2640r2_sdk_4_20_00_04
,
caiyu:
uint8_t status = GATT_WriteCharValue(connList[i].connHandle, &req, selfEntity);
主机对第7个从机执行打开notify时,返回失败。
,
Katherine Wang:
请问您说的“打开notify失败”是什么意思?您是收到了特定的错误代码?是系统死机了吗? CCCD 是否已写入但堆栈未将通知传递给应用程序?
我建议您使用蓝牙记录器收集蓝牙 LE 踪迹,以便识别问题。
,
Katherine Wang:
此外,建议您使用可用的最新 SIMPLELINK-CC13XX-CC26XX-SDK 版本运行额外的测试。
,
caiyu:
caiyu 说:uint8_t status = GATT_WriteCharValue(connList[i].connHandle, &req, selfEntity);
执行这就代码返回0,
Katherine Wang 说:CCCD 是否已写入但堆栈未将通知传递给应用程序?
这个应该怎么看?
Katherine Wang 说:您使用蓝牙记录器收集蓝牙 LE 踪迹
这个是什么设备?
,
Katherine Wang:
caiyu 说:主机对第7个从机执行打开notify时,返回失败。
请详细说明函数返回的错误代码。您可以参考函数文档(此处:GATT_WriteCharValue)来解读错误代码。
,
Katherine Wang:
– GATT_WriteCharValue 返回 0 表示“成功”
– 请使用 https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_Bluetooth_ 检查外设是否向中央发送通知。通过这种方式您还可以验证 CCCD 是否正确写入。
,
caiden.chai:
楼主,你好,我最近也在研究主从连接数据收发的问题,我现在连接成功后,数据的收发这块有问题,能交流下这方面吗?
,
Katherine Wang:
请问您的问题得到解决了吗?如仍有问题,我可以继续为您在E2E英文论坛联系工程师。
,
caiyu:
暂未解决,怀疑堆栈、内存的问题。
,
Katherine Wang:
感谢您的提问,您可以在论坛发布新贴进一步解决您的问题
,
caiyu:
算是找了个折中的办法,把中间的延时调大 了。但是还有有返回失败代码,然后进行重发。重发几次就好了,延时不知道会不会影响后面其他程序运行。