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.

LP-EM-CC2745R10-Q1: I'm not able to Enable notifications on a Central BLE role.

Part Number: LP-EM-CC2745R10-Q1
Other Parts Discussed in Thread: CC2340R5

Tool/software:

Hello, 

      

I'm using TI's Low Power BLE SDK v8.40.00.61, and I’ve modified the Basic BLE example to function as a central device.

 Functionality

  • The central device scans and connects successfully to a BLE peripheral.

  • After connecting, it performs service and characteristic discovery.

  • I can correctly match the required custom service and characteristic UUIDs.

The Issue

Even after discovering the correct characteristic:

    • I attempt to enable notifications by writing 0x0001 to the CCCD (Client Characteristic Configuration Descriptor).

    • The server never triggers the notification.

    • The client also does not receive any notification event.

    • The CCCD write operation completes successfully, but data flow never starts.

    • here is the code below how i'm trying to notify after characteristic is discovered 

BLEAppUtil_EventHandler_t dataGATTHandler =
{
    .handlerType    = BLEAPPUTIL_GATT_TYPE,
    .pEventHandler  = GATT_EventHandler,
    .eventMask      = BLEAPPUTIL_ATT_FLOW_CTRL_VIOLATED_EVENT |
                      BLEAPPUTIL_ATT_MTU_UPDATED_EVENT |
                      BLEAPPUTIL_ATT_READ_BY_GRP_TYPE_RSP |
                      BLEAPPUTIL_ATT_READ_BY_TYPE_RSP |
                       GATT_MSG_EVENT                 |
                       BLEAPPUTIL_ATT_HANDLE_VALUE_NOTI
};
case ATT_READ_BY_TYPE_RSP:
    {
        MenuModule_printf(APP_MENU_SCAN_EVENT, 0, "Invoked");
        attReadByTypeRsp_t *rsp = &gattMsg->msg.readByTypeRsp;

        for (uint8_t i = 0; i < rsp->numPairs; i++)
        {
            uint8_t *p = rsp->pDataList + i * rsp->len;
            uint16_t attrHandle = BUILD_UINT16(p[0], p[1]);
            uint8_t properties = p[2];
            uint16_t valueHandle = BUILD_UINT16(p[3], p[4]);


            if (targetServiceFound &&
                p[20] == 44 && p[19] == 28 && p[18] == 151 && p[17] == 113 &&
                p[16] == 249 && p[15] == 162 &&
                p[14] == 77 && p[13] == 46 &&
                p[12] == 138 && p[11] == 200 &&
                p[10] == 117 && p[9] == 34 && p[8] == 120 && p[7] == 115 && p[6] == 124 && p[5] == 10)
                //MenuModule_printf(APP_MENU_PROFILE_STATUS_LINE, 0, "chars found");
            {
                if (properties & GATT_PROP_NOTIFY)
                {
                    MenuModule_printf(APP_MENU_PROFILE_STATUS_LINE, 0,"gatt prop");
                    attWriteReq_t req;
                    uint8 configData[2] = {1,0};
                    req.pValue = GATT_bm_alloc(gattMsg->connHandle, ATT_WRITE_REQ, 2, NULL);
                    req.type.uuid[0] = LO_UINT16(GATT_CLIENT_CHAR_CFG_UUID);
                    req.type.uuid[1] = HI_UINT16(GATT_CLIENT_CHAR_CFG_UUID);

                    bStatus_t status = GATT_ReadByTypeReq(gattMsg->connHandle, &req);

                    if (req.pValue != NULL)
                    {
                        MenuModule_printf(APP_MENU_PROFILE_STATUS_LINE, 0, "write val");
                        req.handle = valueHandle;  // CCCD handle
                        req.len = 2;
                        memcpy(req.pValue, configData, 2);
                        req.cmd = FALSE;
                        req.sig = FALSE;
                        bStatus_t status =GATT_WriteNoRsp(gattMsg->connHandle, &req);
                        if(status == SUCCESS)
                        {
                            MenuModule_printf(APP_MENU_PROFILE_STATUS_LINE, 0, "Sucess: %d", SUCCESS);
                        }
                        else
                        {
                            MenuModule_printf(APP_MENU_PROFILE_STATUS_LINE, 0, "fail: %d", SUCCESS);
                        }
                        }
                }
                break;
            }
        }
        break;
    }
From the above code it will perform write operation and its success. however i cannot see any trigger in peripheral or central device. i have used a debug statements on peripheral side if notification is triggered by central i see print statements on uart terminal. However i dont see anything. Can you please let me know how can i enable the notifications. 
i have also used the TI simpleconnect mobile application to connect and notify it will work fine. however only when i try doing it using above code its not working. it will not even trigger the 
"ATT_HANDLE_VALUE_NOTI" this event also. 


i tried to follow the https://github.com/TexasInstruments-Sandbox/ble_examples/blob/simplelink_low_power_f3_sdk-8.40/examples/rtos/LP_EM_CC2340R5/ble5stack/basic_ble_GATT_client/app/app_menu.c. however i was unable to understand why valuehandle was 47 hardcodded to enable notification. 
  • Hello,

    What is the peripheral device that you are connecting to?

    Are the devices bonded? If bonded, what is the behavior?

    Best,

    Nima Behmanesh

  • Hello Nima, 

    The peripheral device is a Silicon Labs EFR32BG24 MCU running a custom BLE application. It advertises under the name "IT0002" and provides a custom GATT service with characteristics for data transfer.

    No, the devices are not bonded. I do not use pairing or exchange any security keys.
    The central simply scans for the "IT0002" device name, and connects upon detection.
    Even after a power cycle of the central, if the peripheral is still advertising, the central is able to reconnect and communicate without any pairing or bonding steps.

  • Hello,

    You mentioned you were able to see that the write operation completes successfully. Is the correct value being received on the peripheral side?

    Also, as a test, could you try flashing another CC device with the basic_ble example and interact with characteristic 4 (which is a notification) and let me know if the issue persists? This will help us pinpoint whether the issue is on the central side or peripheral side.

    Best Regards,

    Tarek D

  • Hello Tarek D, 

              Do you want me to flash the example code from below mentioned repository and test the results and share you? am i right?
    https://github.com/TexasInstruments-Sandbox/ble_examples/tree/simplelink_low_power_f3_sdk-8.40/examples/rtos/LP_EM_CC2340R5/ble5stack/basic_ble_GATT_client

    As basic_Ble_central does not have notification enable example code on the sdk. Thanks 

  • Hello,

    I believe I was unclear, let me explain.

    For the central device, keep the same firmware on the device. For the peripheral, instead of using the Silicon labs MCU, use another CC2340R5 and flash the basic_ble project (located inside the SDK), without any modifications

    The out of box basic_ble project is a peripheral with a GATT profile, who's characteristic 4 is a notification. Interact with that notification and see if the issue persists (you can't receive data). 

    This way, we can pinpoint where the issue lies. If it works, then the issue is on the Silicon Labs MCU, if the issue persists, then the issue is with you implementation of notification interaction on the central side.

    Please let me know what you find!

    Best Regards,

    Tarek D