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.

How to get the data from CC2540?

Other Parts Discussed in Thread: CC2540

Hello,

1. I have two PC (one running CC2540 HostTest example, and another running CC2540 SimpleBLEPeripheral example). I tried to discover the SimpleBLEPeripheral and establish connection with it. I only managed to connect with it once in every 10 trying. I did modify the Supervision Timeout value to the max (32000ms) but nothing change. And, every time the connection dropped, it is giving the 0x08 (Supervision Timeout). Hope someone with experience can explain on this.

2. Okay, the second question is on how can I received the GATT_Notification message sent from HostTest? I tried to put in the "printf" function inside the simpleBLEPeripheral_ProcessOSALMsg, and the result is, regardless of how many GATT_Notification I sent, the simpleBLEPeripheral program won't even run into that function.

Please help. Thanks in advance.

Sincerely,

Kwan

  • 1. Can you elaborate on your setup?  How do you have a PC running simpleBLEPeripheral?  Do you mean the CC2540 USB dongle?  If so, there is no CC2540 USB Dongle project configuration for simpleBLEPeripheral so I"m not sure what project you're running.  In any case, I would recommend taking a sniffer capture to verify that the simpleBLEPeripheral is advertising as a first step.

    2. Well in general you shouldn't be using standard printf in an embedded project as it takes too long to run and will break the real-time processing of the device.  You can receive notifications by calling the following in your application init function:

      // Register to receive incoming ATT Indications/Notifications
      GATT_RegisterForInd( simpleBLETaskId );

    Look at the simpleBLECentral project as an example. In this case, you would ultimately receive the notification in simpleBLECentralProcessGATTMsg() as a ATT_HANDLE_VALUE_NOTI. See the GATT section of the SDG for more information: http://www.ti.com/lit/swru271

  • Hi Tim,

    Thanks for your advice.

    I have one CC2540 USB Dongle running with SimpleBLEPeripheral and it's giving advertising data (But just for a very short while ~less than 5 seconds). In order for me to connect with it, I use another CC2540 USB Dongle running the HostTestRelease. I managed to scan the advertising package from the SimpleBLEPeripheral device. Among the 10 times I tried to scan and establish connection, there is about 3 times the scanning follow-up with link establishment, the rest is manage to scan but cannot establish the link.

    My project is pretty simple, I just wish to establish the link from my master CC2540 USB Dongle with the CC2540 USB Dongle slaves (up to 2~3).

    Master (Send Data) -> Slaves (Receive Data from Master and decode it)

    Thanks in advance.

    Sincerely,
    Kwan
  • I'm assuming you're using BTool to control HostTest? If so, please attach the BTool log of this sequence.
  • Hi Tim,

    Thanks for your help. I have called TI distributor in my area to clarify this. And, I have bought another CC2540 board (CC2540 EM version - with antenna). The program is working fine. So, I suspect the CC2540 USB dongle is just for the HostTestRelease example only. Cause the connection is stable now.

    Anyway, there is something worth notice. TI FAE in my area told me there is some connection issue regarding the SimpleBLEPeripheral example which the program won't return from the sleep (and a hard reset is needed). Anyway, I didn't encounter this so far. I tried to establish connection and make the SimpleBLEPeripheral keep waiting for command from the HostTestRelease. The result is great! It won't disconnect even after 8 hours (Cause I establish the connection and left it there without any interference).

    Thanks for suggesting this function to me

    // Register to receive incoming ATT Indications/Notifications

    GATT_RegisterForInd( simpleBLETaskId );

    This is working great! After I put in this function, the SimpleBLEPeripheral manage to get the GATT_Notification without any problem. 

    Regarding the printf function, it's really break the real-time function of CC2540. When I tried to print a longer string, the CC2540 giving a Supervisor Timeout and the connection is broken.

    Thanks a lot for your help.

    Once again, thanks dude =)

    Sincerely,

    Kwan

  • Hi Tim,

    I forget you are TI Employee. Really sorry about this...Haha

    Thanks a lot.

    Sincerely,
    Kwan