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.

CC2640: Unable to send large data to Master through notifications

Part Number: CC2640

Hello,

I am using simple_peripheral application and i want to send and receive data from Master. I have tested with 100 bytes of data i can receive and send to Master.

But when the data is larger than 100 bytes i am  able to receive it correctly from master. But  When i send data (using the notifications) from simple_peripheral to Mater it sends only 100 bytes correct.

After that it starts repeating the data from first index. I have tested with 100 bytes, 200 bytes , 250 bytes and 600 bytes of data and only found success for 100 bytes. Following is the code i am using to send data through notifications

void sendData( uint16_t connHandle, uint8_t *offset ) 
{
  uint16_t length = 20;
   // If notifications enabled
    uint16_t value = GATTServApp_ReadCharCfg(connHandle, myccDes);
     if (value & GATT_CLIENT_CFG_NOTIFY)
     {
       attHandleValueNoti_t noti;
        noti.len = length;
        noti.pValue = GATT_bm_alloc(connHandle, ATT_HANDLE_VALUE_NOTI, noti.len, &noti.len);

      if (noti.pValue != NULL)
      {
        gattAttribute_t *pAttr;
        pAttr= GATTServApp_FindAttr(dmyServiceAttrTbl, 
                                    GATT_NUM_ATTRS(domServiceAttrTbl),
                                    &tramsmissionCharVal);
        noti.handle = pAttr->handle;
        memcpy(noti.pValue , dataBuffer + offset[0] , length);  // dataBuffer has all the data
        if (GATT_Notification(connHandle, &noti, FALSE) != SUCCESS)
        {
          GATT_bm_free((gattMsg_t *)&noti, ATT_HANDLE_VALUE_NOTI);
        }
    }
   } 
}

Can you please help me? Is there any limit from stack that it does not supporting more data?

Following is the result of my test green data is sent from Master and black is the data received from slave.

test result with 100 bytes

0106010101010101010101010101010101010206020202020202020202020202020202020306030303030303030303030303030303030

406040404040404040404040404040404040506050505050505050505050505050505050606065d5e5f61626364


01060101010101010101010101010101010102060202020202020202020202020202020203060303030303030303030303030303030304

06040404040404040404040404040404040506050505050505050505050505050505050606065d5e5f61626364

test rest with 120 bytes

01070101010101010101010101010101010102070202020202020202020202020202020203070303030303030303030303030303030

3040704040404040404040404040404040404050705050505050505050505050505050505060731323334ef03f0f10107010101010101010101010101010101010207

0107010101010101010101010101010101010207020202020202020202020202020202020307030303030303030303030303030303030

40704040404040404040404040404040404050705050505050505050505050505050505060731323334ef03f0f1f2f3060606060606070731323334ef03f0f1f2f3

waiting for your kind reply.

Regards

  • Hello,

    It wasn't specified in your OP how the GATT Client is sending the data to you or what the configured ATT_MTU size is in effect. For GATT Notifications, the maximum transfer size in one Notification is going to be ATT_MTU - 3 bytes. You should not send more than noti.len bytes but you are not checking against this size.

    Best wishes
  • Hello JXS,

    Thanks for your reply. From client i am getting data by generating events and processing it. I have verified that correct data is coming from client.

    The length=20 shows the maximum size that should be transfred. While debugging i came to know after sending 100 bytes. The programm enter in:

     GATT_bm_free((gattMsg_t *)&noti, ATT_HANDLE_VALUE_NOTI);

    That should not happen. I have also tried very small size e.g 10 bytes per transaction. It shows the same behaviour.

    Waiting for your kind reply.

    Regards

  • Hello mabbas,

    Likely you are enqueuing more than the MAX_NUM_PDU PDUs (Notifications) before the stack has had a chance to send them. You can increase this define to see if that fixes the problem. See the SW Dev Guide.
    Also, it's more efficient to use a larger ATT_MTU.

    Best wishes

  • Hi JXS,

    Thanks for your help . Can you tell me what are maximum number of PDUs that i can send in one connection??

    waiting for your kind reply.

    Regards

  • Hi mabbas,

    Sorry, it's MAX_NUM_PDU ('ve corrected earlier posts) and can be found in the SW Dev Guide SWRU393 sec "5.7 Runtime BLE Protocol Stack Configuration"

    Best wishes