Simple Application Processor Code Example

Table of Contents

Introduction

Simple Application Processor is a simple code example which showcases basic functionality of the SimpleLink MSP432 SDK Bluetooth Plugin. Simple BLE concepts such as characteristic manipulation and property notifications are examined. This code example is made to be a bare bones implementation that can be used as a basis for more elaborate implementations.

Hardware Prerequisites

Simple Application Processor requires the standard configuration of an MSP-EXP432P401R LaunchPad with an attached BOOSTXL-CC2650 BoosterPack. This hardware configuration is shown in the below image:

MSP432 LaunchPad with CC2650 BoosterPack

Software Prerequisites

This code example has been tested with IAR Embeded Workbench 7.80.3 and Code Composer Studio v7.1. For more information on how to import this project into your IDE workspace and build/run, please refer to the main user’s guide.

Service/Profile Table

Purpose UUID Format Properties Profile Source
LED Control 0xFFF1 Integer Read/Write simple_gatt_profile.c
Read 0xFFF2 Integer Read simple_gatt_profile.c
Write 0xFFF3 Integer Write simple_gatt_profile.c
Notify Characteristic 0xFFF4 Integer Notification simple_gatt_profile.c

Usage

Once the Simple Application Processor code example starts the output to the terminal will notify the user of initialization and then set the state of the application to idle.

Simple Application Processor Initialization

In idle mode, the application is in a low power mode and not actively advertising. In order to start advertising, the S1 switch on the LaunchPad needs to be pressed. The S1 switch can be found on the left side of the LaunchPad as pictured below:

Button Positions

Once the S1 button is pressed, the device will start advertising itself with a device name of “Simple AP”. Also note that once advertising (and while connected) the LED on the MSP432 LaunchPad’s LED1 pin is turned red to signify activity.

Simple AP BLE device

After connecting to the Simple AP device, the terminal screen should print that the peer was connected and also print the ID of the peer:

Connection Log

At this point the device is connected and successfully negotiated the connection details. Scrolling down past the product information (this might be different depending on your client) there should be a list of four different characteristics and their corresponding properties/values (these are described in detail in the following sections):

List of characteristics

LED Control (UUID: 0xFFF1)

Characteristic 1 in this code examples toggles the tricolor led connected to the LED2 pin of the MSP432 LaunchPad. Note that values written to this characteristic are irrelevant as any new value written simply toggles the LED between and off and on state. Select this characteristic and select to write a new value:

Characteristic 1

Enter any arbitrary number and select Done to finish the write:

Writing a value

After the value has been written the LED attached to LED2 on the MSP432 LaunchPad should turn on to its white color state:

LED on

Writing another value to the characteristic will cause the LED to turn off.

Read-Only Characteristic (UUID: 0xFFF2)

Characteristic 2 is a very simple characteristic that is simply read only. This might be useful if the BLE device has a constant that it needs to broadcast out to a device. Simply select this value and read the value to receive the constant integer value of 2:

Read only characteristic

Write-Only Characteristic (UUID: 0xFFF3)

Characteristic 3 is another very simple characteristic that is simply write only. No value can be actively read from this value. To write to this characteristic, simply choose it and write a new value:

Write only characteristic

Notification Characteristic (UUID: 0xFFF4)

Characteristic 4 is a notification characteristic which provides periodic notifications to listeners with updated values. In the case of this code example, the values that are notified occur on a period of every five seconds and simply consist of an integer value that is being incremented by one. To observe this notification, select the characteristic and enable notifications. You should see an incrementing value being displayed approximately every five seconds:

Notification characteristic

SBL Update

Updating the firmware on the CC2650 BoosterPack uses the SBL libraries to invoke the CC2650’s bootloader and transfer the new firmware over serial. For Simple Application Processor, the method to trigger this invocation is to press and release the S2 button on the LaunchPad. Note that in order to trigger the firmware update, no active BLE device can be connected. Once S2 has been pressed, LED2 on the LaunchPad will toggle red to signal the BSL start:

SBL LED

The console screen will print the status of the firmware update as well as signal when the update has finished. At the end of the update the status of the update will be printed over the serial port and the MSP432 will reboot itself:

SBL log