CC2564C TI Dual-Mode Bluetooth® Stack on STM32F4 MCUs
User's Guide
Document Number: SWRU498A
Revision: November 2016 – Revised February 2017
Introduction
The CC2564C dual-mode Bluetooth stack on STM32F4 microcontrollers (MCU) software (CC2564CSTBTBLESW) from Texas Instruments (TI) enables the STM32 ARM Cortex-M4 processor. It offers single-mode and dual-mode capabilities implementing the Bluetooth 4.2 specification. The stack is fully qualified (QDID 85355 and QDID 69886) and provides simple command-line applications to expedite development. MFi capability is available upon request.
For a complete evaluation solution, the CC2564CSTBTBLESW software development kit (SDK) works directly with the STM3240G-EVAL hardware development kit. The stack for the STM32 MCU is certified and royalty-free.
The software is compatible with the CC256xCQFN-EM board. It provides a complete Bluetooth BR, EDR, and low-energy HCI solution, reducing design effort and accelerating time-to-market. The CC256xCQFN-EM features TI's dual-mode Bluetooth 4.2-compliant solution. These devices offer best-in-class RF performance with transmit power and receive RX sensitivity that approximately doubles the range compared to other BLE-only solutions. TI's power-management hardware and software algorithms contribute to significant power savings in common Bluetooth BR, EDR, and low-energy modes.
1 Features
- Supports dual-mode Bluetooth 4.2 – Bluetooth certified and royalty-free.
- Offers a fully qualified Bluetooth Stack (QDID 85355 and QDID 69886).
- Offers thread-safe operation.
- Supports both threaded (RTOS) and non-threaded (No OS) environments (sample applications use FreeRTOS).
- Offers a fully documented API interface.
- Works with any STM32F4 MCU.
- Offers sample applications for the STM3240G-EVAL MCU Development Kit supported by CC256XEM-STADAPT.
- Offers the capability to disable or enable protocols and profiles.
- Supports Keil® and IAR Embedded Workbench® IDEs.
Trademarks: ARM, Cortex, Keil, µVision are registered trademarks of ARM Limited (or its subsidiaries). Bluetooth is a registered trademark of Bluetooth SIG. IAR Embedded Workbench is a registered trademark of IAR Systems AB. STM32 is a registered trademark of STMicroelectronics International N.V. All other trademarks are the property of their respective owners.
2 Bluetooth Profiles
Classic Profiles
- Advanced audio distribution profile (A2DP): Standard A2DP implementation and Assisted A2DP (A3DP) implementation with internal SBC encoding/decoding on the CC2564C device.
- Audio and video remote control profile (AVRCP).
- Generic access profile (GAP).
- Generic audio and video distribution profile (GAVDP).
- Headset profile (HSP).
- Hands-Free Profile (HFP).
- Human-interface device (HID) profile.
- Message access profile (MAP).
- Phonebook access profile (PBAP).
- Serial port profile (SPP).
Low-Energy Profiles
- Alert notification service (ANS).
- Alert notification profile (ANP).
- Battery service (BAS).
- Cycle speed and cadence service (CSCS).
- Device information service (DIS).
- Find me profile (FMP).
- Generic access profile service (GAPS).
- Generic attribute profile (GATT).
- Health thermometer service (HTS).
- Health thermometer profile (HTP).
- Heart rate service (HRS).
- Heart rate profile (HRP).
- Human-interface device service (HIDS).
- HID over GATT profile (HOGP).
- Immediate alert service (IAS).
- Link loss service (LLS).
- Phone alert state service (PASS).
- Phone alert state profile (PASP).
- Proximity profile (PXP).
- TX power service (TPS).
MFi Support
- iAP Protocol (iAP 1/iAP 2).
- Provided as an add-on upon request.
3 Sample Application Overview
This demonstration allows evaluation of TI's CC2564C Bluetooth device with the STM3240G-EVAL platform. The CC2564C STM3240G-EVAL Bluetooth applications provide a feature-rich and user-friendly experience. Users can employ a console to send Bluetooth commands, configure a Bluetooth device to accept connections, connect to a remote Bluetooth device, and communicate via Bluetooth.
This demonstration includes one sample application for each profile, along with simple command-line sample applications to accelerate development. Figure 1 illustrates the demonstration overview.
Figure 1. Overview of Demonstration: A diagram showing two PCs (PC1 and PC2) connected via UART to development boards. The boards are then connected wirelessly via Bluetooth, one acting as a server and the other as a client.
4 CC2564CSTBTBLESW Hardware and Software Requirements
A complete evaluation requires the following hardware and software tools:
Hardware
- One dual-mode Bluetooth CC2564 evaluation board (e.g., CC256xCQFN-EM).
- One CC256xEM Bluetooth adapter kit (e.g., CC256XEM-STADAPT).
- One STM32 experimenter board (e.g., STM3240G-EVAL board or STM32F4DISCOVERY board).
Note: All sample applications function directly with the STM3240G-EVAL board. Applications must be ported to the STM32F4DISCOVERY board; porting documentation is available in the CC2564CSTBTBLESW installation directory.
Due to hardware limitations on the STM32F4DISCOVERY board, audio and voice applications cannot be fully evaluated. Use the STM3240G-EVAL for complete evaluation of the following audio and voice sample applications:
- A3DP Demo_SNK
- A3DP Demo_SRC
- AUD demo
- HFP demo
- HFPAG demo
- HSP demo
Software
- Dual-mode Bluetooth stack: CC2564CSTBTBLESW for STM32F4 MCUs.
- IDE versions: IAR 7.2 or 7.3 for ARM, or Keil µVision® 4.70.0.0, or STSW-LINK004 (optional).
Figure 2. Hardware Combination: An image displaying the CC256XCQFN-EM board, CC256XEM-STADAPT board, and STM3240G-EVAL board connected together.
5 Setting Up the Hardware
Using TI's dual-mode Bluetooth CC2564C solution (CC256xCQFN-EM), the STM32 MCU evaluation board (STM3240G-EVAL or STM32F4DISCOVERY), and the CC256xEM Bluetooth Adapter Kit (CC256XEM-STADAPT), developers can evaluate both classic and Bluetooth low energy capabilities with the TI Dual-Mode Bluetooth stack on STM32F4 MCUs.
To set up the hardware, follow these steps:
- Fit the jumpers onto the adapter board. Refer to the CC256xEM Bluetooth Adapter Kit User's Guide and Quick Start Guide for correct jumper positions and connections to STM32 boards.
- Mount the adapter board onto the STM32 board. See Figure 5 for STM3240G-EVAL and Figure 6 for STM32F4DISCOVERY examples.
- Optional for Audio and Voice Sample Applications: Ensure PCM signal directions are correctly set on the CC256XCQFN-EM. The PCM port can be configured as master or slave depending on the sample application. Table 1 details the required resistor configurations (R18, R19, R11) on the CC256XCQFN-EM for audio and voice sample applications.
Figure 3. CC256XCQFN-EM PCM Role Selection for Audio and Voice Sample Applications: An image highlighting resistors R18, R19, and R11 on the CC256XCQFN-EM board.
Table 1. CC256XCQFN-EM PCM Direction for Audio and Voice Sample Applications
Demo Name | CC256XCQFN-EM PCM Role | R18 | R19 | R11 |
---|---|---|---|---|
A3DP Demo_SNK | Slave | 0 Ω | DNI | DNI |
A3DP Demo_SRC | ||||
HFP Demo_AG | ||||
HFP Demo_HF | ||||
HSP Demo | ||||
All other Sample Applications | Master (default) | DNI | 10K Ω | 0 Ω |
(1) In addition to the changes listed, ensure proper UART and I2S paths are configured on the CC256XEM-STADAPT board for each demo. Refer to the CC256xEM Bluetooth® Adapter Kit quick start guide for details.
(2) DNI indicates Do not install.
Figure 4. STM32 General Setup: An image showing a typical setup of the STM32 board with the adapter and CC256xCQFN-EM boards.
Figure 5. STM3240G-EVAL, CC256X-STADAPT, and CC256xCQFN-EM Combination: An image displaying the STM3240G-EVAL board combined with the CC256X-STADAPT and CC256xCQFN-EM boards.
Figure 6. STM32F4DISCOVERY, CC256X-STADAPT, and CC256xCQFN-EM Combination: An image displaying the STM32F4DISCOVERY board combined with the CC256X-STADAPT and CC256xCQFN-EM boards.
Note: Due to hardware limitations on the STM32F4DISCOVERY board, audio and voice applications cannot be ported for complete evaluation. Use the STM3240G-EVAL for complete evaluation of the following sample applications: A3DP Demo_SNK, A3DP Demo_SRC, AUD demo, HFP demo, HFPAG demo, HSP demo.
6 Setting Up the Software
Follow these steps to set up the software for the demonstration:
- Navigate to the Bluetooth SDK.
- Note: A TI login is required for SDK download. Create one if you do not have an account.
- Create a TI login if necessary.
- Complete and submit the export approval form.
- Note: Wait for TI to approve the request. Upon approval, a download link will be provided.
- Click Download to obtain the software.
- Note: The Bluetooth SDK is intended for use with the STM3240G-EVAL board. Software modifications are necessary for the STM32F4DISCOVERY board.
- Run the installer (e.g., CC256XSTMNoOSBTBLESW-v4.2.x.x-Setup.exe) after download.
- Accept the TI Bluetooth Stack Clickwrap License Agreement.
- Note: After accepting the license, the SDK installs to C:\TI\Connectivity\CC256X BT\CC256xSTM32BluetopiaSDK\v4.2.x.x\.
- Access the SDK via Start/Programs/Texas Instruments/CC256XBT/CC256xSTM32BluetopiaSDKv4.2.x.x.
7 Building and Flashing the Bluetooth Code (STM3240G-EVAL)
Sample applications for FreeRTOS and NoOS are available for IAR and Keil IDEs. Follow these instructions to set up applications for each IDE.
IAR
- Navigate to C:\TI\Connectivity\CC256XBT\CC256xSTM32BluetopiaSDK\v4.2.x.x to open the workspace.
- Select a sample:
- For NoOS, navigate to \NoOS\STM3240G-EVAL\Samples\ for a list of samples.
- For FreeRTOS, navigate to \FreeRTOS\STM3240G-EVAL\Samples\ for a list of samples.
- Choose the demonstration to load onto the device (e.g., SPPDemo).
- Navigate to NoOS.
- Navigate to EWARM.
- Select SPPDemo.eww.
- Note: The IAR IDE opens.
- Select Debug (see Figure 7) or Release Configuration from the drop-down menu. For this example, select Debug.
Figure 7. IAR Drop-Down Menu: A screenshot of the IAR Embedded Workbench IDE showing the project structure and the Debug/Release configuration selection.
- Select Download and Debug from the Project drop-down menu or click the Play icon (see Figure 8).
Figure 8. Download and Debug: A screenshot of the IAR IDE showing the "Download and Debug" option in the Project menu and the "Play" icon.
Note: The IDE debugs and loads the software onto the device, which may take 5 to 10 minutes.
- Click the red 'X' icon in the IDE to stop debugging (see Figure 9).
Figure 9. Debugging Screen: A screenshot of the IAR IDE showing the debugging interface with the code execution and variables.
- Disconnect the STM3240G-EVAL.
- Reconnect the STM3240G-EVAL.
- Press the Reset button on the STM3240G-EVAL device.
- Click the GO button in IAR (see Figure 10).
Figure 10. The GO Button: A screenshot of the IAR IDE highlighting the "GO" button used to start program execution.
Keil
- Navigate to C:\TI\Connectivity\CC256XBT\CC256xSTM32BluetopiaSDK\v4.2.x.x to open the workspace.
- Select one of the following samples:
- For NoOS, navigate to \NoOS\STM3240G-EVAL\Samples\ for a list of samples.
- For FreeRTOS, navigate to \FreeRTOS\STM3240G-EVAL\Samples\ for a list of samples.
- Select the demonstration to load onto the device (this example uses SPPDemo).
- Navigate to NoOS.
- Note: For RTOS, navigate to FreeRTOS.
- Navigate to RVMDK in the list.
- Click SPPDemo.uvproj.
- Note: Keil µVision4 opens.
- Select Debug or Release Configuration from the drop-down menu (for this example, select Debug [See Figure 11]).
Figure 11. Debug Drop-Down Menu: A screenshot of the Keil µVision4 IDE showing the project structure and the Debug/Release configuration selection.
- Right-click SPPDemo_Debug in the project sidebar.
- Select Build target to build the code (see Figure 12).
Figure 12. Building Target: A screenshot of the Keil µVision4 IDE showing the "Build target" option in the project context menu.
Note: Figure 13 shows the output when built correctly. After a few minutes, the build process finishes and creates an .axf file. Rebuild the .axf file each time the configuration changes.
Figure 13. Build Output: A screenshot of the Keil µVision4 IDE's build output window, indicating a successful build with no errors or warnings.
- Choose Debug mode or Release and Debug modes.
- For Debug mode only:
- (a) Select Start/Stop Debug Session to load the profile onto the STM32 device and work in Debug mode (see Figure 14).
Figure 14. Debug Mode: A screenshot of the Keil µVision4 IDE showing the "Start/Stop Debug Session" option in the Debug menu.
Note: The loading process completes in a few minutes. The profile loads on the STM3240G-EVAL board.
-
- (b) Stop the debugging session from the Debug drop-down menu.
- (c) Unplug the device.
- (d) Plug the device in again to start working with it.
For Release and Debug modes:
-
- (a) Click LOAD to start loading the profile onto the STM32 device (see Figure 15).
Figure 15. Release and Debug Mode: A screenshot of the ST-LINK Utility showing the "LOAD" button to initiate the flashing process.
Note: The loading process completes in a few minutes. The profile loads on the STM3240G-EVAL board.
-
- (b) Unplug the device.
- (c) Plug the device in again to start working with it.
7.1 Flashing the Bluetooth Code STSW-LINK004
The STSW-LINK004 utility can be used to flash the software after creating the binary file through IAR or Keil.
To flash the software:
- Open the file from the File drop-down menu.
- Select the demonstration to load on the device (this example uses SPPDemo).
- For NoOS, navigate to C:\TI\Connectivity\CC256XBT\CC256xSTM32BluetopiaSDK\v4.2.x.x\NoOS\STM3240G-EVAL\Samples\SPPDemo\NoOS\EWARM\Debug\Exe.
- For FreeRTOS, navigate to C:\TI\Connectivity\CC256XBT\CC256xSTM32BluetopiaSDK\v4.2.x.x\FreeRTOS\STM3240G-EVAL\Samples\SPPDemo\FreeRTOS\EWARM\Debug\Exe.
- Select a .bin file (this example uses SPPDemo.bin).
- Click Program & Verify... from the Target drop-down menu (see Figure 16).
Figure 16. Program and Verify: A screenshot of the STM32 ST-LINK Utility showing the "Program & Verify..." option in the Target menu.
Note: The information for your device is displayed. Ensure the values in Device Information match your device.
- Press Start (see Figure 17).
Figure 17. Start Download: A screenshot of the STM32 ST-LINK Utility showing the "Start" button to begin the programming process.
Note: The command window displays "Verification...OK" (see Figure 18).
Figure 18. Verification...OK: A screenshot of the STM32 ST-LINK Utility's command window confirming successful verification.
8 Applications
The dual-mode Bluetooth stack on STM32F4 MCUs includes a sample application directory for NoOS and FreeRTOS, featuring source code that demonstrates TI's dual-mode Bluetooth stack. These simple, command-line sample applications display a list of available commands. Table 2 lists the available profiles for the Bluetooth SDK.
Table 2. Table of Available Profiles for Bluetooth SDK
Profile | Role | FreeRTOS | NoOS | EM Platform |
---|---|---|---|---|
A3DP Demo_SNK | Sink Controller | IAR Keil | IAR Keil | STM3240G-EVAL |
A3DP Demo_SRC | Source Target | IAR Keil | IAR Keil | STM3240G-EVAL |
ANP demo | Server Client | IAR Keil | IAR Keil | STM3240G-EVAL |
AUD demo | Source Sink | IAR Keil | IAR Keil | STM3240G-EVAL |
FMP demo | Target Locator | IAR Keil | IAR Keil | STM3240G-EVAL |
CSCP demo | Server Client | IAR Keil | IAR Keil | STM3240G-EVAL |
HFP demo | Audio gateway Hands-free unit | IAR Keil | IAR Keil | STM3240G-EVAL |
HFPAG demo | Audio gateway Hands-free unit | IAR Keil | IAR Keil | STM3240G-EVAL |
HID demo | Host Device | IAR Keil | IAR Keil | STM3240G-EVAL |
HOGP demo | Host Device | IAR Keil | IAR Keil | STM3240G-EVAL |
HRP demo | Collector Sensor | IAR Keil | IAR Keil | STM3240G-EVAL |
HSP demo | Audio gateway Headset | IAR Keil | IAR Keil | STM3240G-EVAL |
HTP demo | Collector Thermometer | IAR Keil | IAR Keil | STM3240G-EVAL |
iBEACON demo | Server Client | IAR Keil | IAR Keil | STM3240G-EVAL |
MAP demo | Server Client | IAR Keil | IAR Keil | STM3240G-EVAL |
PASP demo | Server Client | IAR Keil | IAR Keil | STM3240G-EVAL |
PBAP demo | Server Client | IAR Keil | IAR Keil | STM3240G-EVAL |
PXP demo | Server Client | IAR Keil | IAR Keil | STM3240G-EVAL |
SPP demo | Device A Device B | IAR Keil | IAR Keil | STM3240G-EVAL |
SPPDMMulti demo | Server Client | IAR Keil | IAR Keil | STM3240G-EVAL |
SPPLE demo | Server Client | IAR Keil | IAR Keil | STM3240G-EVAL |
9 Classic Bluetooth Sample Applications
AUD Demo
- Lets you use the advanced audio distribution profile (A2DP) to stream high-quality audio over Bluetooth.
- Note: The AUD Demo uses the AUD module of the TI dual-mode Bluetooth stack, implementing the non-assisted A2DP profile and the Audio/Video Remote Control Profile (AVRCP).
- Supports the sink role only.
- Visit the AUD demonstration application wiki for instructions.
A3DP Sink Demo
- Lets you use the assisted advanced audio distribution profile (A3DP) to send stereo audio over Bluetooth.
- Visit the A3DP demonstration sink wiki for instructions.
A3DP Source Demo
- Lets you use the assisted advanced audio distribution profile (A3DP) to send stereo audio over Bluetooth.
- Visit the A3DP demonstration source wiki for instructions.
HFP Demo
- Lets you use hands-free profile (HFP) to provide remote control and voice connections over Bluetooth to a mobile device.
- Supports the hands-free role.
- Visit the HFP demonstration wiki for instructions.
HFPAG Demo
- Lets you use the hands-free profile on an embedded device.
- Connects a headset or speaker phone with a mobile device for remote control and voice connections.
- Supports the hands-free and audio-gateway roles.
- Provides two applications demonstrating the audio-gateway and hands-free roles, respectively.
- Offers audio routing to the STM3240G-EVAL board DAC for the hands-free and audio-gateway applications.
- Visit the HFPAG demonstration application wiki for instructions.
HID Demo
- Offers a demonstration of the human-interface device (HID) profile, enabling a host to connect and control a HID device.
- Visit the HID demonstration wiki for instructions.
HSP Demo
- Lets you demonstrate the headset profile (HSP) on an embedded device.
- Connects a headset or speaker phone with a mobile device.
- Connects an audio gateway with a headset device for basic control and voice connections.
- Visit the HSP demonstration wiki for instructions.
MAP Demo
- Lets you exchange message objects over Bluetooth.
- Visit the MAP demonstration application wiki for instructions.
10 Classic Bluetooth + Bluetooth low energy Applications
PBAP Demo
- Lets you exchange phone book objects over Bluetooth.
- Visit the PBAP demonstration application wiki.
SPP Demo
- Shows how to use the serial port profile (SPP) module.
- Shows how to handle different callback events.
- Lets you interface with a remote SPP client or server.
- Visit the SPP demonstration application wiki for instructions.
SPP + SPPLE Demo
- Shows how to use Low Energy (LE) and the GATT profile.
- Emulates using SPP over LE using the GATT profile.
- Acts as an LE master and LE slave.
- Shows how to use the SPP module.
- Shows how to handle different SPP callback events.
- Acts as either an SPP server or SPP client.
- Uses the same command for SPP as the SPP demonstration.
- Visit the SPP + SPPLE demonstration wiki for instructions.
SPPDMMulti Demo
This application is based on the SPP + SPPLE Demo and demonstrates features from Bluetooth specifications 4.1 and 4.2:
- LE Dual Mode Topology: Connect in classic Bluetooth and Bluetooth low energy to the same device.
- LE Link Layer Topology: Support multiple simultaneous roles (Peripheral and Central).
- L2CAP LE Connection Oriented: Support LE Credit Based Flow Control Mode.
- LE Ping: Verify remote Link Layer presence and message integrity by forcing the remote device to send an LE ACL packet with a valid MIC.
- LE Low Duty Cycle Advertising: For cases where reconnecting with a specific device is required, but time is not critical or the central device's range is unknown.
- 32-bit UUID: Register services with aliases as 32-bit values instead of 128-bit UUIDs.
- LE Secure Connections: Enhance the LE Security Manager with public key Elliptic Curve Diffie-Hellman (ECDH) key generation.
The application allows users to establish connections between multiple BLE devices using the SPPLE custom service, send Bluetooth commands, and exchange data over BLE. It also demonstrates using the SPP module and handling SPP callback events, acting as an SPP server or client with the same command set as SPPDemo.
For a step-by-step demonstration, visit the SPPDMMulti demo wiki.
11 Bluetooth low energy Applications
ANP Demo
- Shows how to use low energy (LE) and the GATT profile.
- Implements the alert notification profile (ANP) using the GATT profile.
- Acts as an LE master and LE slave.
- Visit the ANP demonstration wiki for instructions.
iBEACON Demo
- Provides location-based information and services for iOS devices.
- Has server and client roles.
- Lets users use a console to advertise specific data via Bluetooth low energy (BLE) that clients can read.
HRP Demo
- Shows how to use low energy (LE) and the GATT profile.
- Implements the heart rate profile (HRP) using the GATT profile.
- Acts as an LE master and LE slave.
- Visit the HRP demonstration wiki for instructions.
HTP Demo
- Shows how to use low energy (LE) and the GATT profile.
- Implements the health thermometer profile (HTP) using the GATT profile.
- Acts as an LE master and LE slave.
- Visit the HTP demonstration wiki for instructions.
PASP Demo
- Shows how to use low energy (LE) and the GATT profile.
- Implements the phone alert status profile (PASP) using the GATT profile.
- Acts as an LE master and LE slave.
- Visit the PASP demonstration wiki for instructions.
HOGP Demo
- Shows how to use low energy (LE) and the GATT profile.
- Implements the human-interface device (HID) using the GATT profile.
- Visit the HOGP demonstration wiki for instructions.
PXP Demo
- Shows how to use low energy (LE) and the GATT profile.
- Implements the proximity profile (PXP) using the GATT profile.
- Visit the PXP demonstration wiki for instructions.
FMP Demo
- Shows how to use low energy (LE) and the GATT profile.
- Implements the find me profile (FMP) using the GATT profile.
- Acts as an LE master and slave.
- Visit the FMP demonstration wiki for instructions.
CSCP Demo
- This application demonstrates using LE and the GATT profile to establish a connection between two BLE devices with the cycling speed and cadence service (CSCS). It also covers notifying measurements and changing sensor location and cumulative wheel value in the Speed Cadence (SC) Control Point.
- For a step-by-step demonstration, visit the CSCP demo wiki.
Revision History
Note: Page numbers for previous revisions may differ from page numbers in the current version.
Changes from November 14, 2016 to February 28, 2017
- Changed Table 1 on page 5.