Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2640
I am using two CC2640 Launchpads.
I use Project Zero on the TX side and Simple Centra on the RX side.
I want to notify the payload of 200 bytes by NOTIFICATION at 7.5 ms intervals from the TX side and receive it at 7.5 ms on the RX side.
Changes on the TX side are as follows.
"MAX_PDU_SIZE = 255" is set as Predefined SYmbols
Add the following code
static void user_processGapStateChangeEvt(gaprole_States_t newState)
{
-----
case GAPROLE_CONNECTED:
{
// -----> ADD
GAPRole_GetParameter(GAPROLE_CONNHANDLE, &gConnectionHandle);
if (HCI_EXT_ConnEventNoticeCmd(gConnectionHandle, selfEntity, PRZ_CONN_EVT_END_EVT) == SUCCESS)
{
Log_info0("HCI_EXT_ConnEventNoticeCmd succsss" );
}
// <----- ADD
-----
}
static void ProjectZero_taskFxn(UArg a0, UArg a1)
{
-----
if (pEvt->event_flag & PRZ_CONN_EVT_END_EVT)
{
// Try to retransmit pending ATT Response (if any)
//ProjectZero_sendAttRsp();
// -----> ADD
user_processApConnectionEvent();
// <----- ADD
}
-----
}
// -----> ADD
static void user_processApConnectionEvent(void)
{
attHandleValueNoti_t notreq;
uint32 ret;
notreq.pValue = GATT_bm_alloc(gConnectionHandle, ATT_WRITE_REQ, 200, NULL);
if (notreq.pValue != NULL)
{
notreq.handle = 0x0023;
notreq.len = sendDataLen;
memcpy(notreq.pValue, sendData, 200);
notreq.pValue[3] = (frame_cnt&0x000000FF);
notreq.pValue[2] = (frame_cnt&0x0000FF00)>>8;
notreq.pValue[1] = (frame_cnt&0x00FF0000)>>16;
notreq.pValue[0] = (frame_cnt&0xFF000000)>>24;
GATT_Notification(gConnectionHandle, ¬req, 0x00);
frame_cnt++;
}
}
// <----- ADD
Changes of the RX side are as follows.
"MAX_PDU_SIZE = 255" is set as Predefined SYmbols
Add the following code
#define DEFAULT_UPDATE_MIN_CONN_INTERVAL 6
#define DEFAULT_UPDATE_MAX_CONN_INTERVAL 6
static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg)
{
if (state == BLE_STATE_CONNECTED)
{
-----
// -----> ADD
if(pMsg->method == ATT_HANDLE_VALUE_NOTI)
{
rcvtick[ticknum] = Clock_getTicks();
Display_print1(dispHandle, 10+ticknum, 0, "%d", (rcvtick[ticknum]-lasttick)); // t / (1000.0/Clock_tickPeriod) ms
lasttick = rcvtick[ticknum];
ticknum++;
if( ticknum >= sizeof(rcvtick)/sizeof(rcvtick[0]) )
ticknum = 0;
}
// <----- ADD
-----
} // else - in case a GATT message came after a connection has dropped, ignore it.
// Needed only for ATT Protocol messages
GATT_bm_free(&pMsg->msg, pMsg->method);
}
The output of the TX side is
#002302 [ 31.239 ] INFO: (project_zero.c:1783) 769
#002303 [ 31.247 ] INFO: (project_zero.c:1783) 718
#002304 [ 31.247 ] INFO: (project_zero.c:1808) GATT_Notification failed 22
#002305 [ 31.254 ] INFO: (project_zero.c:1783) 750
#002307 [ 31.269 ] INFO: (project_zero.c:1783) 754
#002308 [ 31.277 ] INFO: (project_zero.c:1783) 744
#002309 [ 31.284 ] INFO: (project_zero.c:1783) 748
#002310 [ 31.292 ] INFO: (project_zero.c:1783) 772
#002311 [ 31.299 ] INFO: (project_zero.c:1783) 772
#002312 [ 31.307 ] INFO: (project_zero.c:1783) 708
#002313 [ 31.307 ] INFO: (project_zero.c:1808) GATT_Notification failed 22
#002314 [ 31.314 ] INFO: (project_zero.c:1783) 757
The output of the RX side is
811
1572
812
821
815
814
821
833
1084
812
821
814
818
821
On the TX side, notification of completion of notification is received at about 7.5 ms, but GATT_Notification fails periodically.
On the RX side, ATT_HANDLE_VALUE_NOTI notification has not been received at 7.5 ms intervals.
If the payload size was set 20bytes, TX size and RX side both works without problems.
Is there a problem with the TX side that will result like this? Or is there a problem on the RX side?
Or is it the limit of ability of CC2640?