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.

RTOS/LAUNCHXL-CC2650: Not able to read more then 22 bytes data in CC2650 BLE Central on CC2650 Launchpad.

Part Number: LAUNCHXL-CC2650
Other Parts Discussed in Thread: CC2650STK, CC2650, BLE-STACK

Tool/software: TI-RTOS

Hi there,

I am implementing BLE Central on CC2650 Launchpad which scans data sensors data from CC2650STK (sensor tag).

In sensor tag having individual service for individual sensors and respected characteristics for reading, enabling etc.

I am customizing all the sensor in one service and I am reading data from single characteristic. While I am reading all sensors data and building a single string in JSON format to send data to the BLE Central. All sensors data in a single string, string length 100+ bytes.

When I am reading this data from BLE central (CC2650 Launchpad) so I notice that I am not able to receive data more than 22  bytes. When I read data from Android BLE Scanner App (for testing purpose), I am getting complete data. Below code is how I am checking received data length and building string.

                uint16 dataLen = pMsg->msg.readRsp.len;
                uint8 data[200], i;
                for (i = 0; i < dataLen; i++)
                {
                    data[i] = pMsg->msg.readRsp.pValue[i];
                }
                data[i] = '\0';

Why I am not able to read complete bytes/data?

Is somewhere restricted reading limits?

Thanks

  • Hello,

    In your simple BLE Central application, are you performing an MTU exchange before reading the long characteristic? What GATT procedure are you using to read the data. If you are performing an MTU exchange, what is your negotiated MTU?

    Most Android devices will automatically perform an MTU exchange, which could account for the difference.
  • Yes I am doing default MTU exchange before discovery

    static void SimpleBLECentral_startDiscovery(void)
    {
    attExchangeMTUReq_t req;

    // Initialize cached handles
    svcStartHdl = svcEndHdl = charHdl = 0;

    discState = BLE_DISC_STATE_MTU;

    // Discover GATT Server's Rx MTU size
    req.clientRxMTU = maxPduSize - L2CAP_HDR_SIZE;

    // ATT MTU size should be set to the minimum of the Client Rx MTU
    // and Server Rx MTU values
    VOID GATT_ExchangeMTU(connHandle, &req, selfEntity);
    }

    When I check, "maxPduSize - L2CAP_HDR_SIZE" giving 157 but after exchanging I am getting MTU size 23 and receive data length 22.
    In below code where "maxPduSize " is updating.

    static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent)
    {
    switch (pEvent->gap.opcode)
    {
    case GAP_DEVICE_INIT_DONE_EVENT:
    {
    maxPduSize = pEvent->initDone.dataPktLen;
    Display_print0(dispHandle, ROW_ZERO, 0, "BLE Central");
    Display_print0(dispHandle, ROW_ONE, 0, Util_convertBdAddr2Str(pEvent->initDone.devAddr));
    Display_print0(dispHandle, ROW_TWO, 0, "Initialized");
    Display_print0(dispHandle, ROW_SEVEN, 0, ">RIGHT to scan");
    }
    break;

    While GATT_ExchangeMTU() when I sending 157 but in below code I am receiving MTU size 23

    static void SimpleBLECentral_processGATTDiscEvent(gattMsgEvent_t *pMsg)
    {
    if (discState == BLE_DISC_STATE_MTU)
    {
    // MTU size response received, discover simple BLE service
    if (pMsg->method == ATT_EXCHANGE_MTU_RSP)
    {

    #if (defined USE_128_BIT_UUID)
    uint8 uuid[ATT_UUID_SIZE] = { TI_UUID(SIMPLEPROFILE_SERV_UUID) };
    #else
    uint8_t uuid[ATT_BT_UUID_SIZE] = { LO_UINT16(SIMPLEPROFILE_SERV_UUID),
    HI_UINT16(SIMPLEPROFILE_SERV_UUID) };
    #endif


    // Just in case we're using the default MTU size (23 octets)
    Display_print1(dispHandle, ROW_THREE, 0, "MTU Size: %d", ATT_MTU_SIZE);
    discState = BLE_DISC_STATE_SVC;

    // Discovery simple BLE service
    VOID GATT_DiscPrimaryServiceByUUID(connHandle, uuid, UUID_SIZE, selfEntity );


    How can I change MTU size to receive 100+ bytes of data?
  • Hello,

    A successful MTU exchange is made of two parts

    1. Your local device must support a large MTU this means the following :
    2. Your peer device must support a large MTU


    Here are a couple of tips/tricks related to MTU exchange
    - (For TI BLE-Stack only): Local supported MTU = MAX_PDU_SIZE - L2CAP_HDR_SIZE
    - This means for TI to TI communication you will need to set MAX_PDU_SIZE >= 100 + L2CAP_HDR_SIZE on both peer and local device and
    rebuild + reflash the projects.
    - The GATT client device (i.e. Simple BLE Central) must initiate the MTU exchange (GATT_ExchangeMTU()), this call must succeed, be sure to
    check the return params.
    - The actual MTU negotiated will be passed to the application via ATT_MTU_UPDATED_EVENT, it should be printed on the display for both
    central and peripheral. pMsg->msg.mtuEvt.MTU should contain the negotiated MTU.