Table of Contents
Introduction
The temperature sensor broadcast code example is a simple code example that leverages the integrated temperature sensor on the MSP432 to broadcast the temperature over BLE. This code example has the advantage over the Sensors BoosterPack code example in the sense that it does not require any additional sensor booster pack. This project leverages the MSP432’s floating point unit to provide both Celsius and Fahrenheit temperature data.
Hardware Prerequisites
Temperature Sensor Broadcast 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 the tool and compiler versions listed in the Release Notes. 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 | Unit | Properties | Profile Source |
---|---|---|---|---|---|
Temperature Broadcast (C) | 0xFFE1 | IEEE-754 32-bit floating point | °C | Notification | temperature_profile.c |
Temperature Broadcast (F) | 0xFFE2 | IEEE-754 32-bit floating point | °F | Notification | temperature_profile.c |
Usage
Once the Temperature Sensor Broadcast code example starts the output to the terminal will notify the user of initialization and then set the state of the application to idle.
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:
Once the S1 button is pressed, the device will start advertising itself with a device name of “MSP432 Thermometer”. Also note that once advertising (and while connected) the LED on the MSP432 LaunchPad’s LED1 pin is turned red to signify activity.
After connecting to the MSP432 Thermometer device, the terminal screen should print that the peer was connected and also print the ID of the peer:
At this point the device as 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 two different characteristics and their corresponding properties/values (these are described in detail in the following sections):
Temperature (C) (UUID: 0xFFF1)
The first characteristic is a notification characteristic that broadcasts temperature readings approximately at a period of five seconds. Note that the temperature readings are reported in floating point value and the mobile client may need to be updated to display floating point legibly.
Temperature (F) (UUID: 0xFFF2)
The second characteristic is the same characteristic as the first one, however broadcasting in Fahrenheit:
SBL Update
Updating the firmware on the CC26xx BoosterPack uses the SBL libraries to invoke the CC2650’s bootloader and transfer the new firmware over serial. For Temperature Sensor Broadcast, 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:
*** 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: