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.

CC2651R3: BLE is not disconnecting while data transfer is in progress

Expert 1720 points
Part Number: CC2651R3

Hi TI,

I currently work on TI BLE SDK 5.40.

As per our requirement, my device continuously tranfers a 50byte of data at 100ms interval to the nRF smartphone app (through indication mode).

Simultaneously when I try to disconnect the device connection from Smartphone , it disconnects and immediately reconnects (within few milliseconds).

May I know the reason for this behaviour ?

  • Hey Ddnr,

    Can you provide a sniffer log of this issue? Is there a new connection indication sent by the smartphone during the reconnection?

  • Hi Ammar,

    Thanks for the immediate response.

    Yes, there is a new connection indication which can be seen in the logs attached. 

  • Hey Ddnr,

    What example project is being used? Is the smartphone in this case a peripheral or the central? I'm not too familiar with the logs you attached, but reading it I am confused reading "Indication received from xx-xx". If the phone received the connection indication then it must be acting as a peripheral.

    Let me know if you are able to provide a sniffer capture (using an Ellisys/Frontline sniffer) of the above scenario.

  • Hi Ammar,

    I used simple_peripheral example project. The smartphone is the central here.

    This is the logs from nRF connect app in the smartphone. The "indication recevied from xx-xx" is the data received from the peripheral device in the form of INDICATION.

    Sorry, may be I confused a little in the previous message.

    I will try to provide logs from nRF app or wireshark sniffer.

  • Hey Ddnr,

    Are you able to perform the above test using BTOOL as the central device? In short, I don't immediately have an explanation for this behavior and would like to rule out anything the mobile central might be doing. If possible can you also try a different phone?

  • I have tried using multiple phones and still I see the same behavior.

    I could observe that if disconnected while data transfer is in progress (using INDICATION), then program is not entering into GAP_LINK_TERMINATED_EVENT at all in the code. (which is the reason why we see an immediate reconnection).

    How can I test using BTOOL? I should use another central device for example a CC2651R3 LAUNCHPAD?

    Meanwhile, if I use NOTIFICATIONS for data transfer, it works as expected. The issue is observed only with the INDICATION mode. I think since there is acknowledgment involved in INDICATION, the GATT layer is busy performing the operation and delaying in handing over the control to GAP.

  • Hello,

    Thanks for confirming the behavior from other phones.

    How can I test using BTOOL? I should use another central device for example a CC2651R3 LAUNCHPAD?

    Correct. You'll flash the host_test example project on a CC2651P3 LP and then launch the BTOOL application and connect to it using a COM port. 

    You'll find more guidance using BTOOL in our SimpleLink Academy module for BLE Fundamentals, Task 2.

    I think since there is acknowledgment involved in INDICATION, the GATT layer is busy performing the operation and delaying in handing over the control to GAP.

    I agree here, I can try to look into the expected flow here and see what might be occurring. If the TI board doesn't receive the disconnection packet (i.e. it doesn't trigger the GAP_LINK_TERMINATED_EVENT, it will continue to send what is queued. With indications, you are right in that a reply will be expected before it sends anything else.

  • I have set up the BTool and tried to connect and discover the UUIDs all as per the reference link provided by you. Thanks.

    But how do I enable Indications/Notifications in the Central device (in BTool ) or is it not required to enable it explicitly?

    One more doubt, I'm continuously sending data stream at 1second interval from peripheral device to central device, and in Central where I can see the data coming in?

    Please find the BTool snapshot here after establishing connection:

  • Hey ddnr,

    All great questions. The easiest way to enable receiving notifications on the central is to write 01:00 to the CCCD for notifications or 02:00 for indications. In the screenshot above, you'll find this in what looks like Handle number 0x0023, UUID 0x2902 "Client Characteristic Configuration". Once you do this, the peripheral can start sending the data. When the central receives the data, you'll see the log window on the right update accordingly and print out the received messages.

    EDIT: To write to the CCCD, double click on the line I pointed out. A window should pop up allowing you to write to the characteristic configuration.

  • Thanks Ammar, I will check this and come back to you.

  • Anytime. FYI I will be unable to follow up so I've re-assigned this post to my colleague who will continue to help debug this for you.

    We are looking forward to hearing back.