Texas Instruments CC2540 Application Manual

Texas Instruments CC2540 Application Manual

Bluetooth low energy
Hide thumbs Also See for CC2540:
Table of Contents

Advertisement

Quick Links

Texas Instruments CC2540/41
Bluetooth® low energy
Sample Applications Guide
v1.4.1
Document Number: SWRU297D
Copyright © 2011-2015 Texas Instruments, Inc.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the CC2540 and is the answer not in the manual?

Questions and answers

Summary of Contents for Texas Instruments CC2540

  • Page 1 Texas Instruments CC2540/41 Bluetooth® low energy Sample Applications Guide v1.4.1 Document Number: SWRU297D Copyright © 2011-2015 Texas Instruments, Inc.
  • Page 2: Table Of Contents

    Reading from the Sensor ....................14 Writing to the Sensor ......................15 5.2.7 Neglect Timer ........................15 5.2.8 RUNNING SPEED AND CADENCE (RSC) SENSOR ..............15 ........................15 ROJECT VERVIEW Page 2 of 36 Copyright © 2011-2015 Texas Instruments, Inc...
  • Page 3 TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 6.1.1 User Interface ........................15 6.1.2 Basic Operation ........................16 ........................ 16 OFTWARE ESCRIPTION Initialization .......................... 16 6.2.1 Event Processing ........................ 16 6.2.2 Callbacks ..........................17 6.2.3 Sending Notifications ......................17 6.2.4...
  • Page 4 TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 12.1.1 User Interface ........................26 12.1.2 Battery Operation ........................26 12.1.3 Accelerometer Operation ....................... 26 12.1.4 Keys ............................26 12.1.5 Proximity ..........................27 12.2 ........................ 27 OFTWARE ESCRIPTION 12.2.1...
  • Page 5: References

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 References Included with Texas Instruments Bluetooth low energy v1.4.1 Stack Release (All path and file references in this document assume that the BLE development kit software has been installed to the default path C:\Texas Instruments\BLE-CC254x-1.4.1\): [1] Texas Instruments Bluetooth®...
  • Page 6: Overview

    The purpose of this document is to give an overview of the sample applications that are included in the Texas Instruments CC2540/41 Bluetooth® low energy (BLE) software development kit. It is recommended that you read [1] before attempting to use these sample applications, as some knowledge of the CC2540/41 BLE protocol stack and software is required.
  • Page 7: Software Description

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 The peer device may also discover the device information service for more information such as mfg and serial number. Once blood pressure measurements have been enabled the application will begin sending data to the peer containing simulated measurement values.
  • Page 8: Sending Blood Pressure Measurement Indications

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1  bpServiceCB: This is the blood pressure service callback. It handles enabling or disabling measurements.  TimeAppPairStateCB: This is a GAPBOND callback to handle pairing states.  TimeAppPasscodeCB: Returns the passcode of 0.
  • Page 9: Basic Operation

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 When in a connection or configured to take measurements, this increases the temperature by 1 degree Celsius. After 3 degrees in temperature rise, the interval will be set to 30 seconds and if configured, this will indicate to the peer an interval change initiated at the thermometer.
  • Page 10: Event Processing

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 called to set up the GAP functions of the application. Then GAPBondMgr_Register is called to register with the bond manager. 3.2.2 Event Processing The application has two main event processing functions, Thermometer_ProcessEvent and Thermometer_ProcessOSALMsg.
  • Page 11: Thermometer Measurement Format

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 3.2.7 Thermometer Measurement Format Temperature Time Stamp Temperature Type Flags Measurement Value (if present) (if present) Size 1 octet 4 octets 0 or 7 octets 0 or 1 octet...
  • Page 12: Initialization

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 The application is implemented in the file heartrate.c. 4.2.1 Initialization The initialization of the application occurs in two phases: first, the HeartRate_Init function is called by the OSAL. This function configures parameters in the peripheral profile, GAP, and GAP bond manager.
  • Page 13: Project Overview

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 Speed and Cadence Profile. This profile also makes use of the optional Device Info Service, which has default values that may be altered at compile or runtime to aid in identifying a specific BLE device.
  • Page 14: Initialization

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 The application is implemented in the file cyclingSensor.c. 5.2.1 Initialization Initialization of the application occurs in two phases: first, the CyclingSensor_Init function is called by the OSAL. This function configures parameters in the peripheral profile, GAP, and GAP bond manager.
  • Page 15: Writing To The Sensor

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1  Total distance  Multiple sensor locations Sending a read request to the Sensor Location characteristic triggers a response packet containing the set position of the sensor on the bicycle. This value may be set by writing to the control point (see below), requesting a sensor location update.
  • Page 16: Basic Operation

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 6.1.2 Basic Operation Power up the device and press the right button to enable advertising. From a RSC collector peer device, initiate a device discovery and connection procedure to discover and connect to the cycling sensor.
  • Page 17: Callbacks

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 Function cycling_ProcessOSALMsg handles OSAL messages as follows:  KEY_CHANGE message: Call function sensor_HandleKeys to handle key presses. 6.2.3 Callbacks The application callback functions are as follows:  SensorGAPStateCB: This is the GAP event callback. It processes GAP events for startup and link connect/disconnect.
  • Page 18: Neglect Timer

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 6.2.8 Neglect Timer This device has a compile time option that allows the sensor to terminate a connection if it sees no user input for 15 seconds. In the context of this application, this means that after the device has connected and notifications are disabled, the application starts a timer.
  • Page 19: Record Filter Configuration

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 To disconnect press Joystick Center again. To reconnect to the same device again press Joystick Center again. 7.1.3 Record Filter Configuration Glucose record requests use filters to select the records that will be operated on by the request.
  • Page 20: Service Discovery

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1  GlucCollPairStateCB: This is the GAP bond manager state callback. It displays the status of pairing and bonding operations.  GlucCollPasscodeCB: This is the GAP bond manager passcode callback. It generates and displays a passcode.
  • Page 21: Basic Operation

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 When not connected, the keyfob's right button is used to toggle advertising on and off. When in a connection, the keyfob's left button sends a glucose measurement and glucose context.
  • Page 22: Sending Notifications And Indications

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1  GlucoseCB: This is the glucose service callback. It handles enabling or disabling of indications of the glucose measurement, context, glucose measurement context, and record access control point.
  • Page 23: User Interface

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 The project contains one configuration, CC2540DK-MINI Keyfob Slave, using the keyfob hardware platform. 10.1.1 User Interface When not connected and not already advertising, pressing either button will initiate advertising.
  • Page 24: Callbacks

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 Function HidEmuKbd_ProcessOSALMsg handles OSAL messages as follows:  KEY_CHANGE messages: Call function HidEmuKbd_HandleKeys to handle keypresses. 10.3.3 Callbacks The application callback functions are as follows:  hidEmuKbdRptCB: This is the HID device report callback. It processes HID reports received from the HID host.
  • Page 25: Gatt Read And Write Callbacks

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1  hidDevScanParamCB: This is the scan parameters service callback. Handle a scan parameters service event. 10.4.4 GATT Read and Write Callbacks The HID device profile GATT read and write callbacks, HidDev_WriteAttrCB and HidDev_ReadAttrCB handle reading and writing of all HID characteristics.
  • Page 26: Project Overview

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1  Link Loss (for Proximity Profile, Reporter role; see [14] and [16])  Immediate Alert (for Proximity Profile, Reporter role and Find Me Profile, Target role; see [14], [15], and [17]) ...
  • Page 27: Proximity

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 A value of “00” indicates that neither key is pressed. A value of “01” indicates that the left key is pressed. A value of “02” indicates that the right key is pressed. A value of “03” indicates that both keys are pressed.
  • Page 28: Sensortag

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 13 SensorTag The SensorTag is a BLE peripheral slave device which runs on the CC2541 SensorTag hardware platform. The Sensor Tag includes five peripheral sensors with a complete software solution for sensor drivers interfaced to a GATT server running on TI BLE stack.
  • Page 29: Simpleblecentral

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1  Left and Right Buttons: The Simple Keys service on the SensorTag allows the device to send notifications of key presses and releases to a central device. 14 SimpleBLECentral The SimpleBLECentral project implements a very simple BLE central device with GATT client functionality.
  • Page 30: Basic Operation

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 16.1.2 Basic Operation When the application powers up it displays "Time App", the BD address of the device, and a default time and date of "00:00 Jan01 2000". To connect, press Joystick Up to start advertising then initiate a connection from a peer device.
  • Page 31: Callbacks

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1  START_DEVICE_EVT: Start the device, as described in the previous section.  START_DISCOVERY_EVT: Start service discovery.  CLOCK_UPDATE_EVT: Update the clock display. Function timeApp_ProcessOSALMsg handles OSAL messages as follows: ...
  • Page 32: Handling Indications And Notifications

    MCU to change firmware without using the CC Debugger. There are project options for both UART and SPI. 17.1.1 SBL Developer’s Guide A detailed guide on the serial bootloader can be found on the Texas Instruments wiki page. http://processors.wiki.ti.com/index.php/SerialBootLoader 17.2 Target Requirements The target must be setup with the SBL (Serial Bootloader).
  • Page 33: Build The Project To Be Bootloaded

    OAD image client (OAD target). There is also a method for performing encrypted OAD using the hardware AES engine. 19.1 OAD Developer’s Guide A detailed guide on the entire OAD process can be found on the Texas Instruments wiki page. http://processors.wiki.ti.com/images/8/82/OAD_for_CC254x.pdf 19.2 Target Requirements The target must be setup with a BIM (Boot Image Manager) and at least one image with OAD profile support.
  • Page 34: Server Requirements

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 19.3 Server Requirements The installer includes a server application compatible with the SBL Tool which runs on the SmartRF board. The project allows the user to connect load an image over the serial port, and then transfer it over the air to the target.
  • Page 35: General Information

    TI CC2540 Bluetooth low energy Sample Applications Guide v1.4.1 SWRU297 Version 1.4.1 20 General Information 20.1 Document History Table 1: Document History Revision Date Description/Changes 2011-07-13 Initial release, documenting sample applications included in BLEv1.1 release 2012-02-07 Updated to align with BLEv1.2 release sample applications.
  • Page 36 TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated products in automotive applications, TI will not be responsible for any failure to meet such requirements. Following are URLs where you can obtain information on other Texas Instruments products and application solutions: Products Applications Amplifiers amplifier.ti.com...

This manual is also suitable for:

Cc2541

Table of Contents