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.

cc2540 - question regarding throughput example

Hi TI experts,

I'm trying to implement the throughput example in my code, once I'm trying to send using GATT_Notification( 0, &nData, FALSE ) I'm not getting a success in return and the connection drops after a couple of seconds.

I would like to clarify a couple of things:

- Why the connection handle used in the example is "0"?

- Why the characteristic handle used is "20"?

- Why the connection drops on an successful notification ?

Thanks in advance,

  • Hi Omri,

    Connection handle is always 0 if you are a peripheral since you cannot connect to more than one device at a time. It is simply a index of which of the active connections you are talking about.

    The handle 20 refers to the Characteristic value handle's position in this example's ATT table. It is known to be 20. You should rather use the method seen in SimpleBLEPeripheral and its characteristic 4, whereby SetParam is used from the application, and the service's SetParam implements another way of sending the notification that allows you do ignore the handle.

    It shouldn't drop. If you don't get a success in return, you get something else - what is this?

    Best regards,
    Aslak 

  • Hi Asiak,

    Thanks again for a great answer, IAR was giving me a hard time with reading the return value GATT_Notification (in the watch window the variable I was using to save the return value was "unavailable" regardless to any changes I tried to do, for that I'm not sure what was the exact return value).

    So I left behind the throughput example and now I'm using setParameter as used in the simple peripheral code.

    The good news is that I am able to send notification and read it's value on the mobile device, the problem is that the connection is still dropping after the send.

    As I'm using  SetParameter which is calling GATTServApp_ProcessCharCfg to perform the notification ( if I understand correctly ), the return to which is always SUCCESS (even if connection is not established).

    When connecting to BTOOL I can see the following message after sending the notification:


    ------------------------------------------------------------------------------------------------------------------------
    [80] : <Info> - 02:45:14.875
    Device Disconnected
    Handle = 0x0000
    Addr Type = 0x00 (Public)
    BDAddr = E0:C7:9D:5E:2C:F0
    ------------------------------------------------------------------------------------------------------------------------
    [81] : <Rx> - 02:45:14.875
    -Type : 0x04 (Event)
    -EventCode : 0xFF (HCI_LE_ExtEvent)
    -Data Length : 0x06 (6) bytes(s)
    Event : 0x0606 (GAP_TerminateLink)
    Status : 0x00 (Success)
    ConnHandle : 0x0000 (0)
    Reason : 0x08 (Supervisor Timeout)
    Dump(Rx):
    04 FF 06 06 06 00 00 00 08


    Does it gives you any clue about the disconnection?  I will try again with GATT_Notification directly just to get the return.

    Many thanks,

    Omri.

  • Hi,

    Not sure. Does e.g. SimpleBLEPeripheral work as expected? If so, you may be doing something in your embedded application that takes a lot of time and drops the connection. Supervisor timeout means that your device hasn't said anything to keep the connection alive within the timeout period.

    Best regards,
    Aslak 

  • Hi,

    My embedded code is based on simpleBLEPeripheral, I have no problem establishing a connection and just hang connected for a while / reading characteristics / writing to characteristics and the connection won't drop.

    Only when trying the notification part I'm getting the connection dropped (with the message as above in the BTOOL)

  • UPDATE: If I run simpleBLEPeripheral the notification in the periodic event is working flawlessly.

    The differences from simpleBLEPeripheral  and my code is that I have a lot more attributes (41) as I have many more characteristics and that I send a notification of 18 bytes and not 1 byte. Other than that it looks the same

    GATTServApp_ProcessCharCfg( simpleProfileChar4Config, simpleProfileChar4, FALSE, simpleProfileAttrTbl, GATT_NUM_ATTRS( simpleProfileAttrTbl ), INVALID_TASK_ID ); is the line of code for notification I'm using inside setParameter, and I'm able to receive it on the mobile side...

  • Hi Omri,

    Does SimpleBLE hang when you modify it to send 18 bytes?

    Aslak

  • Hi Asiak,

    Almost embarrassed to say but the error was due to something else completely, having the 8051 doing some other tasks right after the sync caused the supervisor timeout...

    Many thanks for the help, the solution was using setParameter of simpleBLEPeripheral like you suggested