This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F: Notification setting the connection interval to 7.5 m and payload size set to 200 bytes

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, &notreq, 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?

  • This should not give you any problem. Have you tried using data length extension?
    You can find how to enable this feature here :
    dev.ti.com/.../data-length-extensions.html
  • Hi Christin.

    Thank you for your replay.

    I added the following code to both sides.

    As a result, the problem was solved.

    Thank you.

    TX side.

    static void user_processGapStateChangeEvt(gaprole_States_t newState)
    {
      -----
        case GAPROLE_CONNECTED:
    
          // -----> ADD
          {
            uint16_t requestedPDUSize = 251;
            uint16_t requestedTxTime = 2120;
    
            HCI_LE_SetDataLenCmd(gConnectionHandle, requestedPDUSize, requestedTxTime);
          }
          // <----- ADD
      -----
    }
    

    RX side.

    static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent)
    {
      -----
        case GAP_LINK_ESTABLISHED_EVENT:
    
              // -----> ADD
              {
                uint16_t requestedPDUSize = 251;
                uint16_t requestedTxTime = 2120;
    
                HCI_LE_SetDataLenCmd(connHandle, requestedPDUSize, requestedTxTime);
              }
              // <----- ADD
      -----
    
    }
    

    The output of the TX side is

    #001694 [ 28.917 ] INFO: (project_zero.c:1796) 751
    #001695 [ 28.924 ] INFO: (project_zero.c:1796) 751
    #001696 [ 28.932 ] INFO: (project_zero.c:1796) 750
    #001697 [ 28.939 ] INFO: (project_zero.c:1796) 748
    #001698 [ 28.947 ] INFO: (project_zero.c:1796) 751
    #001699 [ 28.954 ] INFO: (project_zero.c:1796) 750
    #001700 [ 28.962 ] INFO: (project_zero.c:1796) 751
    #001701 [ 28.970 ] INFO: (project_zero.c:1796) 751
    #001702 [ 28.977 ] INFO: (project_zero.c:1796) 748
    #001703 [ 28.984 ] INFO: (project_zero.c:1796) 750
    #001704 [ 28.992 ] INFO: (project_zero.c:1796) 751
    #001705 [ 28.999 ] INFO: (project_zero.c:1796) 751
    #001706 [ 29.007 ] INFO: (project_zero.c:1796) 748
    #001707 [ 29.014 ] INFO: (project_zero.c:1796) 750


    The output of the RX side is

    751
    751
    750
    748
    751
    751
    750
    748
    751
    751
    750
    748
    751
    750
    751
    748
    751
    750