Table of Contents
Introduction
Project Zero is the flagship out-of-box demo for the SimpleLink MSP432 SDK Bluetooth Plugin. It showcases several functional features of the MSP432 + CC2650 BLE ecosystem and is easy to setup and configure. Several different hardware fusions are demonstrated such as dynamic LED control and push button interrupt monitoring. A data monitoring service is also demonstrated which showcases simple storage and streaming of binary data.
Hardware Prerequisites
Project Zero code example requires the standard configuration of an MSP-EXP432P401R LaunchPad with an attached BOOSTXL-CC2650 BoosterPack or LAUNCHXL-CC2640R2 Launchpad. This hardware configuration is shown in the below image:
Alternatively, the CC2640R2 LaunchPad can be used in lieu of the CC2650 BoosterPack. In this case the CC2640R2 LaunchPad should be stacked on the MSP432 LaunchPad as seen below:
Software Prerequisites
This code example has been tested with IAR Embeded Workbench 8.11, Code Composer Studio v7.4, and gcc-arm-none-eabi-6-2017-q1-update. 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 Color Control | F0001111-0451-4000-B000-000000000000 | Integer | Read/Write | led_service.c |
S1 Button Status | F0001121-0451-4000-B000-000000000000 | Integer | Notification | button_service.c |
S2 Button Status | F0001122-0451-4000-B000-000000000000 | Integer | Notification | button_service.c |
Data String Storage | F0001131-0451-4000-B000-000000000000 | UTF-8 String | Read/Write | data_service.c |
Data Stream | F0001132-0451-4000-B000-000000000000 | Integer | Notification/Write No Response | data_service.c |
Usage
Once the Project Zero code example starts the output to the terminal will notify the user of the registering of callbacks and interrupts as seen below:
If this information fails to display, check your hardware configuration and make sure that the SNP image is programmed correctly on the CC2650 BoosterPack. Once started, advertising is enabled by default and there is no need to physically press a button on the LaunchPad in order to start BLE advertising. A Bluetooth device with the name of “Project Zero” should be advertised (note the navigation might be slightly different depending on your mobile application):
Connect to the device. After negotiation/handshakes you should be connected to the Project Zero device with various system information displayed:
Scrolling down, you should see a list of three services as well as their corresponding characteristics (described in detail below):
LED Service (UUID: F0001110-0451-4000-B000-000000000000)
The LED service allows users to remotely control and manipulate the on-board tricolor LED of the LaunchPad. This LED is connected to the LED2 pin at the bottom of the MSP432 LaunchPad. The sole characteristic of the LED Service is a three byte hex string. This string equates to RGB values on the LED. The highest byte represents the red value, middle byte represents the green value, and lowest byte represents the blue value. By default, this value is set to 0x000000:
If this value was set to 0x0000FF, for example:
This would result in the LED on LED2 being set to blue:
Values can be combined in any fashion or manner to create any color combination that you want. A value of 0xFF00FF being written to the characteristic:
Would result in a purple color being shown on the LED (full blue plus full red):
Button Service (UUID: F0001120-0451-4000-B000-000000000000)
The button service of Project Zero provides a way for an application to monitor and observe the state of a button press on the LaunchPad. This feature might be useful for applications such as key pads or remote access door bells. In order, the map of the button service’s UUIDs to the LaunchPad’s buttons are as follows:
- UUID: F0001121-0451-4000-B000-000000000000 - S1
- UUID: F0001122-0451-4000-B000-000000000000 - S2
The buttons’ physical location on the LaunchPad can be seen in the image below:
From the main device menu, select the first characteristic (UUID: F0001121-0451-4000-B000-000000000000) that corresponds to button S1:
For this characteristic, a numerical value of 1 represents that the button is pressed and a value of 0 means that the button is released. Select enable notifications for the characteristic and then press and hold S1 on the LaunchPad. A notification value of 1 should appear in the window:
Now release the button. A notification value of 0 should show up in the notifications:
The previous process can be followed on the second UUID to enable notifications for S2. Note that notifications can be enabled/disabled for as many characteristics as desired in parallel.
Data Service (UUID: F0001130-0451-4000-B000-000000000000)
The data service for Project Zero demonstrates a couple of different data storage/streaming capabilities. The first property in this service simply holds an UTF-8 string that can be up to 40 bytes long. Once written, a response in automatically generated and read. Open up the characteristic and try to write a new string value (you may need to set your mobile application to display in string format):
Once written, the new value should be persisted to the characteristic and immediately read back through a response:
The second characteristic demonstrates the use of the SNP_GATT_PROP_WRITE_NORSP property. A characteristic with this property signifies that the BLE device will not send a response to the host after the write is successful. This is useful when transferring large chunks of data by reducing response overhead. This characteristic also has notification enabled to illustrate the writing of data. Open this characteristic and enable notifications. With notifications enabled, write an arbitrary value to the characteristic:
Once written, the new value will show up through the notification stream:
SimpleLink SDK Explorer
SimpleLink SDK Explorer is a customized mobile application from Texas Instruments that is designed to compliment various aspects of the SimpleLink SDK mobile ecosystem. Currently this application is available for iOS and Android devices. The code examples included in the SimpleLink SDK BKE Plugin are fully modeled and showcased as a part of SimpleLink SDK Explorer. From the Apple AppStore or Google Play Store search for SimpleLink SDK and download the SimpleLink SDK Explorer.
The app can also be found at the links below:
Apple AppStore: https://itunes.apple.com/us/app/simplelink-sdk-explorer/id1237329921?ls=1&mt=8
Google Play: https://play.google.com/store/apps/details?id=com.ti.simplelinksdkexplorer&hl=en
Additionally, the full BSD licensed source code for both applications can be found at the link below: https://www.ti.com/tool/download/SIMPLELINK-SDK-BLUETOOTH-PLUGIN
Open the mobile application once it has been downloaded:
From the main screen select the Profile Examples menu item. This will take you to a list of profile examples that correspond to each code example in the SimpleLink MSP432 SDK Bluetooth Plugin:
Select the Project Zero menu item. On the next screen SimpleLink SDK Explorer will automatically scan for BLE devices in your vicinity. By default the Project Zero application advertises and shows up as “Project Zero”:
Press on Project Zero to connect to the device. After negotiation the view for the LED service will appear. This view contains a color wheel and brightness view that will change the color of the tri-color LED on the MSP432 LaunchPad. Press different parts on the color wheel to change the LED’s color.
Select the button service on the tab bar at the bottom of the screen. This will switch to the view for the button service. Whenever a button or combination of buttons is pressed on the MSP432 LaunchPad (either S1 or S2) the buttons displayed on this screen will highlight and a tone will play (make sure your device is not muted). Press S1 and S2 on your LaunchPad to see the buttons toggle on the application.
Select the data service on the tab bar at the bottom of the screen. This will switch to the data service view. On this screen you can select the normal WRITE characteristic or the WRITE_NO_RSP characteristic. Try to write to either of these characteristics. For the WRITE characteristic a response value is read after the write and displayed in the log window. For the WRITE_NO_RSP characteristic a write will result in a notification being sent out and displayed in the log view.
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 Project Zero, the method to trigger this invocation is to hold down both S1 and S2 buttons on the LaunchPad for a duration of at least three seconds. Note that in order to trigger the firmware update, no active BLE device can be connected. Once S1 and S2 are held down for two seconds, LED2 on the LaunchPad will toggle bright blue to signal the BSL start:
*** Note that the default SNP image for all code examples is that of the CC2640R2 LaunchPad SNP. Any hardware configurations using the CC2650 BoosterPack must be explicitly updated to contain the CC2650 BoosterPack SNP image. ***
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: