CC2540 And CC2541 Bluetooth Low Energy Software Developer .

3y ago
10 Views
2 Downloads
5.03 MB
154 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Kaleb Stephen
Transcription

CC2540 and CC2541 Bluetooth low energySoftware Developer’sReference GuideLiterature Number: SWRU271GOctober 2010 – Revised September 2015

ContentsPreface . 71Overview . 81.11.22The TI BLE Software Development Platform . 112.12.22.334.54.64.716171818Project Overview .Start-up in main() .Application Initialization .Event Processing .4.4.1 Periodic Event .4.4.2 OSAL Messages .Callbacks .Complete Attribute Table .Additional Sample Projects .202223232324242526The BLE Protocol Stack . 275.15.25.35.45.55.62Task Initialization .Task Events and Event Processing .Heap Manager .OSAL Messages .The Application and Profiles . 204.14.24.34.45Configurations . 11Projects . 14Software Overview . 14The Operating System Abstraction Layer (OSAL) . 153.13.23.33.44Introduction . 8BLE Protocol Stack Basics . 9Generic Access Profile (GAP) .5.1.1 Overview.5.1.2 GAP Abstraction .5.1.3 Configuring the GAP Layer .GAPRole Task .5.2.1 Peripheral Role .5.2.2 Central Role .Gap Bond Manager (GAPBondMgr) .5.3.1 Overview of BLE Security .5.3.2 Using the GapBondMgr Profile .5.3.3 GAPBondMgr Examples for Various Security Modes .Generic Attribute Profile (GATT) .5.4.1 GATT Characteristics and Attributes .5.4.2 GATT Services and Profile .5.4.3 GATT Client Abstraction.5.4.4 GATT Server Abstraction.L2CAP .HCI .5.6.1 HCI Extension Vendor-Specific Commands .5.6.2 Receiving HCI Extension Events in the Application WRU271G – October 2010 – Revised September 2015Submit Documentation FeedbackCopyright 2010–2015, Texas Instruments Incorporated

www.ti.com5.76Drivers . se Notes History . 81Document History . 94Commands . 95Configurable Parameters . 95Events. 98Commands .Configurable Parameters .Callbacks.B.3.1 State Change Callback (pfnStateChange) .B.3.2 RSSI Callback (pfnRssiRead) .102104105105106GAPRole Central Role API . 107C.1C.2C.3DIAR Overview .Using IAR Embedded Workbench .8.2.1 Open an Existing Project .8.2.2 Project Options, Configurations, and Defined Symbols .8.2.3 Building and Debugging a Project .8.2.4 Linker Map File .GAPRole Peripheral Role API . 102B.1B.2B.3C686868686868696969697070GAP API . 95A.1A.2A.3BConfiguring the BLE Stack .Define BLE Behavior .Define Application Tasks .Configure Hardware Peripherals .Configuring Parameters for Custom Hardware .7.5.1 Board File .7.5.2 Adjusting for 32-MHz Crystal Stabilization Time .7.5.3 Setting the Sleep Clock Accuracy .Software Considerations .7.6.1 Memory Management for GATT Notifications and Indications .7.6.2 Limit Application Processing During BLE Activity .7.6.3 Global Interrupts .General Information . 819.19.2A666666666666666767Development and Debugging . 718.18.29ADC .AES .LCD .LED.KEY .DMA .UART and SPI .Other Peripherals.Simple NV (SNV) .Creating a Custom BLE Application. 687.17.27.37.47.58Library Files . 64Commands .Configurable Parameters .Callbacks.C.3.1 RSSI Callback (rssiCB) .C.3.2 Central Event Callback (eventCB) .107111111111112GATT/ATT API . 113SWRU271G – October 2010 – Revised September 2015Submit Documentation FeedbackCopyright 2010–2015, Texas Instruments IncorporatedContents3

www.ti.comD.1D.2D.3D.4D.5D.6EServer Commands .Client Commands .Return Values .Events .GATT Commands and Corresponding ATT Events .ATT ERROR RSP Error Codes .113114120121123123GATTServApp API . 125. 125FGAPBondMgr API . 127F.1Commands . 127F.2Configurable Parameters . 130F.3Callbacks. 131F.3.1 Passcode Callback (passcodeCB) . 131F.3.2 Pairing State Callback (pairStateCB) . 131GHCI Extension API . 133G.1Commands . 133G.2Host Error Codes . 151Revision History . 153E.14CommandsContentsSWRU271G – October 2010 – Revised September 2015Submit Documentation FeedbackCopyright 2010–2015, Texas Instruments Incorporated

www.ti.comList of Figures.1-1.Bluetooth Smart and Bluetooth Smart Ready Branding Marks1-2.BLE Protocol Stack . 92-1.Single-Device Configuration . 122-2.Network Processor Configuration . 133-1.OSAL Task Loop . 174-1.Project Files . 204-2.SimpleBLEPeripheral Complete Attribute .8-10.8-11.GAP State Diagram .Connection Event and Interval .Slave Latency .GAP Abstraction .Just Works Pairing .Bonding After Just Works Pairing .Pairing With MITM Authentication.GATT Client and Server .simpleGATTProfile Characteristic Table from BTool .GATT Client Abstraction.GATT Server Abstraction.Attribute Table Initialization .Get and Set Profile Parameter Usage .HAL Drivers .IAR Embedded Workbench .Project Configurations and Options .Project Configurations .Preprocessor Defined Symbols Settings .The buildConfig.h File .Configuration File Setup .Building a Project .Debug Button in IAR .Target Selection .IAR Debug Toolbar.Map File in File List .SWRU271G – October 2010 – Revised September 2015Submit Documentation FeedbackCopyright 2010–2015, Texas Instruments IncorporatedList of 77787879795

www.ti.comList of Tables6.5-1.GAP Bond Manager Security Terms5-2.Supported BLE-Stack Library Configurations. 64G-1.Host Error Codes . 151List of Tables37SWRU271G – October 2010 – Revised September 2015Submit Documentation FeedbackCopyright 2010–2015, Texas Instruments Incorporated

PrefaceSWRU271G – October 2010 – Revised September 2015ReferencesThe following references are included with the TI Bluetooth low energy v1.4.1 stack release.NOTE: Path and file references in this document assume you have installed the BLE developmentkit software to the path: C:\Texas Instruments\BLE-CC254X-1.4.1

CC2540 and CC2541 Bluetooth low energy Software Developer’s Reference Guide Literature Number: SWRU271G October 2010–Revised September 2015

Related Documents:

The following references provide additional information on the CC2540, CC2541, the Texas Instruments Bluetooth low energy (BLE) stack, and the BLE specification in general. (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.3\)

TI_BLE_Vendor_Specific_HCI_Guide.pdf [4] Texas Instruments CC2540 Bluetooth Low Energy API Guide C:\Texas Instruments\ BLE-CC254X-1.3.2\Documents\BLE_API_Guide_main.htm [5] Texas Instruments CC2540 Bluetooth Low Energy Sample Applications Guide

When purchased as an EMK the CC2540 USB Dongle comes pre-programmed with packet sniffer SW and will thus work with the free to download Packet Sniffer PC tool from Texas Instruments. The TI BLE Stack download includes several pre-made SW examples for the CC2540 USB Dongle. The most versatile is the HostTestApp project.

Using your Bluetooth headset with the Logitech wireless hub 2 Start the Bluetooth Setup Wizard in one of three ways: Press the Connect button on your Bluetooth wireless hub.-or- Right-click the Bluetooth icon, , in the Windows taskbar and select Add a Bluetooth Device from the menu displayed.-or- Select Add a Bluetooth Device from the Bluetooth Tasks panel in the My Bluetooth

The HM-10 is a small 3.3v SMD Bluetooth 4.0 BLE module based on the TI CC2540 or CC2541 Bluetooth SOC (System On Chip). The HM-10 is made by Jinan . 2/2.1 modules such as the HC-06 and HC-05. The HM-10 is controlled via AT commands which are sent over the serial UART connection. There are a host of commands, some simple, some more complex .

Targus USB Ultra-Mini Bluetooth 2.0 Adapter with EDR Basic Operations Start or Stop Bluetooth (for Windows 2000/ XP only) To start Bluetooth In the Windows system tray, right-click the Bluetooth icon and select Start the Bluetooth Device.The Bluetooth icon is blue in color with a white insert when the Bluetooth software is running. To stop Bluetooth

Bluetooth Hands-Free Bluetooth Hands-Free When connecting a Bluetooth device (mobile phone) to the vehicle's Bluetooth unit via radio wave transmission, calls can be made or received. For example, even if a Bluetooth device is in your coat pocket, a call can be made without taking the Bluetooth device out and operating it directly.

Alison Sutherland 579 Alison Sutherland 1030 Alison Will 1084 Alison Haskins 1376 Alison Butt 1695 Alison Haskins 1750 Alison Haskins 1909 Alison Marr 2216 Alison Leiper 2422 Alistair McLeod 1425 Allan Diack 1011 Allan Holliday 1602 Allan Maclachlan 2010 Allan Maclachlan 2064 Allan PRYOR 2161 Alys Crompton 1770 Amanda Warren 120 Amanda Jones 387 Amanda Slack 729 Amanda Slack 1552 Amanda .