Simple Central

Table of Contents

Introduction

The simple_central project implements a simple Bluetooth low energy central device with GATT client functionality. This project can be run on various platforms, including the CC2640R2 Launchpad. By default, the simple_central application is configured to filter and connect to peripheral devices with the TI Simple Profile UUID. To modify this behavior, set DEFAULT_DEV_DISC_BY_SVC_UUID to FALSE in simple_central.

Hardware Prerequisites

The default Simple Central configuration uses the LAUNCHXL-CC2640R2. This hardware configuration is shown in the below image:

For custom hardware, see the Running the SDK on Custom Boards section of the BLE5-Stack User’s Guide.

Software Prerequisites

For information on what versions of Code Composer Studio and IAR Embedded Workbench to use, see the Release Notes located in the docs/ble5stack folder. For information on how to import this project into your IDE workspace and build/run, please refer to The CC2640R2F Platform section in the BLE5-Stack User’s Guide.

Usage

This application uses the UART peripheral to provide an interface for the application. This document will use PuTTY to serve as the display for the output of the CC2640R2 LaunchPad. Note that any other serial terminal can be used. The following default parameters are used for the UART peripheral for display:

UART Param Default Values
Baud Rate 115200
Data length 8 bits
Parity None
Stop bits 1 bit
Flow Control None

Once the Simple Central sample application starts, the output to the terminal will report its address and the fact that it is initialized and ready to begin discovery, as shown below:

As shown, press the left button(BTN-2) to go to Next Item and select “Discover Devices”, then press the right button (BTN-2 on the CC2640R2 LaunchPad) to begin discovering devices that are broadcasting BLE advertisements. This will report the number of discovered devices:

The left button (BTN-1) can be pressed to scroll to “Connect to” then go through the available devices then again scroll to the device to connect to. When you have found the device that you are trying to connect to, press the right button to connect. This will display information such as the PHY updates and the address of the connected peripheral device, as well as the first of a list of options. Scroll to the “Work with” option to work with a selected connected device.

The red box shows the first of 4 options, which will be described in the following sections:

These options can be selected by pressing the right button.

Option: GATT Read/Write

This option is used to send read requests to the peripheral device and to write new values to the device. Pressing the right button once will send a read request to the peripheral device and will print the returned value:

Scrolling and selecting the “GATT Write” option will allow you to choose certain values to write:

Each time a write is sent, the write response will be shown in terminal. Note that this option requires that the device has the TI Simple Profile UUID.

Option: Start/Stop RSSI Reading

This option is used to get the RSSI (signal strength) of the connected peripheral device. Press the right button to start and stop RSSI reading. When it is started, the RSSI value will be printed. The value will continue to be updated as the RSSI changes:

Option: Connection Update

This option updates the connection parameters. These values can be set by changing the following constants in simple_central.c:

The updated parameter connTimeout value will printed on the terminal to indicate the connection parameters have been updated successfully.

Option: Set Conn PHY Preference

This option allows the user to select a PHY preference.

Option: Disconnect

This option will terminate the connection. The following shows a successful disconnection:

Note that this application also supports MTU exchanges. This is done automatically by the Simple Central device after a connection is formed with a peripheral device. A larger MTU can be negotiated by changing MAX_PDU_SIZE. More information on this can be found in the Configuring for Larger MTU Values section of the BLE5-Stack User’s Guide.