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 implement GATT server and GATT client on the same application?

Other Parts Discussed in Thread: CC2540

I purchased a CC2540DK.
I tested two samples which are SimpleBLECentral and SimpleBLEPeripheral using IAR embedded workbench,
I've read TI_BLE_Software_Developer's_Guide and following site.


http://blog.punchthrough.com/post/63658238857/the-apple-notification-center-service-or-wtf-is

http://mbientlab.com/blog/ancs-on-ti2541-in-an-afternoon/

I want to support ANCS on SimpleBLEPeripheral.
And I heard that how to do is to discover as GATT client after connection between iPhone and peripheral,
I do not know well how to implement.

Could you advise me for programming?
I'm sorry that I'm a begginer.

  • In all honesty, that second site is probably your best source for getting started. They provide the source code to do exactly this in their git repo (https://github.com/lkasso/ANCS). I would start by adding their changed source files to our TimeApp project and make modifications as needed. It might also help you understand more if you used a packet sniffer to see the BLE traffic. This would allow you to see the bonding steps the scanning and eventually the ANCS notifications you're receiving in real time. (You can use our BLE USB dongle with the PC application http://www.ti.com/tool/packet-sniffer)

    To get to this point from the SimpleBLEPeripheral would require a lot of work and explanation to add in the bonding/pairing as well as the application code for managing the GATT client discovery and msg handling.

    -Matt

  • HI, Matt


    Thanks you for responding. I solved with that second site.

    I was struggled with incomplete source code. but I fixed it.

    But I failed to try to use btool with initialization error.

  • Which device are you trying to use BTool with?

    You'll need to have a the hosttestapp project running on the board so it can receive the HCI commands that are being sent via the host PC. Usually it would be run on the USB dongle and that board comes pre-programmed with the packet sniffer firmware.

    -Matt

  • it is CC2540DK.

    I'm using below project.

    C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble\HostTestApp\CC2540\HostTestRelease.eww

    But I got following message. I turned on RS232 switch to enable.

    [1] : <Info> - 09:33:22.898
    Port opened at 2014/07/29 9:33:22
    ------------------------------------------------------------------------------------------------------------------------
    [2] : <Tx> - 09:33:23.859
    -Type        : 0x01 (Command)
    -Opcode        : 0xFE00 (GAP_DeviceInit)
    -Data Length    : 0x26 (38) byte(s)
     ProfileRole    : 0x08 ( Central )
     MaxScanRsps    : 0x05 (5)
     IRK        : 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
     CSRK        : 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
     SignCounter    : 0x00000001 (1)
    Dump(Tx):
    01 00 FE 26 08 05 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 01 00 00 00
    ------------------------------------------------------------------------------------------------------------------------
    [3] : <Warning> - 09:33:33.896
    GAP Device Initialization Timeout.
    Device May Not Function Properly.
    ------------------------------------------------------------------------------------------------------------------------

  • It's not able to RX anything from the SmartRF board. When you restart the device do you see it show up in your COM ports?

    If you have the 2540DK you can actually reprogram the dongle which might be easiest. You'll need smartRF Flash Programmer and you'll load the .hex file "CC2540_USBdongle_HostTestRelease_All.hex" found in the accessory folder of the BLE Stack download. I've attached a pdf with instructions (ignore the version numbers it's a little old). Once you get the dongle to enumerate as a COM port then you should be good to go with BTool.

    -Matt

    8424.4505.Reprogramming_CC2540_USB_dongle.pdf

  • Thanks Matt.

    It becomes available.
    but I don't know address which I should connect to SmartRF05.

    How can I know my device address?

  • The general discovery process in BLE begins with the central device scanning for advertisers. When you perform this scan you should get a report back for each device that is currently advertising. This means you'll have to set your peripheral device to advertise when you are scanning from BTool. The address for the device will be found in this report and then you can issue a connection request from the central device (BTool in this case).

    -Matt