Congratulations on choosing the CC2640R2 microcontroller and LaunchPad ecosystem! This example is an easy starting point for developing your own Bluetooth® Smart application. The functionality and architecture of the example is presented on this page. It also explains how to flash and test the example on your LaunchPad. The next step is to load the project into CCS Cloud or download it to your computer for further development.
The CC2640R2 LaunchPad development kit includes everything you need to run and develop with this example.
This example will allow you to control the LEDs from a mobile phone or other Bluetooth Smart capable device and subscribe to button press notifications from the LaunchPad. A log of the actions taken along with the code-line executed is output on the Application/User Serial port on your LaunchPad.
To get started follow these steps:Review the three custom BLE Services exposed by Project Zero. Find these at the bottom of the list.
All the custom service identifiers (UUIDs) are on the form F000XXXX-0451-4000-B000-000000000000 where each service has a different 16-bit XXXX-part identifier, and the rest of the UUID is the Texas Instruments 128-bit UUID namespace used for demo purposes.
The services can be identified from the 16-bit part of the UUID as follows:
Turn on the LEDs.
Find the topmost custom service, which can be identified from the list above as the LED service
Tap the first characteristic entry to enter the Read/Write menu for the LED0 characteristic.
Tap on Write with response, write the numbers 01 and tap Write to change the LED0 state to ON.
Review the three custom BLE Services exposed by Project Zero. Find these at the bottom of the list.
All the custom service identifiers (UUIDs) are on the form F000XXXX-0451-4000-B000-000000000000 where each service has a different 16-bit XXXX-part identifier, and the rest of the UUID is the Texas Instruments 128-bit UUID namespace used for demo purposes.
The services can be identified from the 16-bit part of the UUID as follows:
Turn on the LEDs.
Find the topmost custom service, which can be identified from the list above as the LED service
Tap the first characteristic entry (red box above) to enter the Read/Write menu for the LED0 characteristic.
Tap on Write new value, write the numbers 01 and tap Done to change the LED0 state to ON.
Review the three custom BLE Services exposed by Project Zero.
All the custom service identifiers (UUIDs) are on the form F000XXXX-0451-4000-B000-000000000000 where each service has a different 16-bit XXXX-part identifier, and the rest of the UUID is the Texas Instruments 128-bit UUID namespace used for demo purposes.
The services can be identified from the 16-bit part of the UUID as follows:
Turn on the LEDs
Expand the topmost CUSTOM SERVICE which can be identified from the list above as the LED service
Click on the W next to the first Characteristic to write to it, and select Byte Array
Write the numbers 01 and click OK to change the LED0 state to ON.
To see all available resources associated with the CC2640R2, click on this link to filter out all the incompatible projects and collateral.
Available in resource explorer are code examples using SimpleLink CC2640R2 SDK, documentation, Software Developers Guide and links to wiki articles and more. Feel free to navigate the available resources to jump-start your development.
Below is a short description and a quick-link to flash your CC2640R2 Launchpad with a pre-built version of the example.
Note: In CCS Cloud, the Stack project must be downloaded to the device once, before downloading or debugging the App project. This is only needed the first time, or after a mass-erase of the device.
main.c
initializes the supporting tasks for the Stack and GAP role, calls the user application's ProjectZero_createTask()
and starts the TI-RTOS scheduler.
ProjectZero_createTask()
sets up the user Task with TI-RTOS and tells the system that the task thread is the function called ProjectZero_taskFxn()
. When BIOS_start()
is called from main()
, this function will be executed.
ProjectZero_init()
which configures the BLE Stack, the services and the hardware peripherals used by the application. It also registers a whole slew of callbacks for system events, and from here everything is event based. The taskFxn then enters an infinite loop, waiting for messages to process.
ProjectZero_taskFxn()
.
This includes things such as button presses, connection state changes and data received from a peer device. You can follow the code flow by looking at the UART log output.
Download prebuilt Project Zero App+Stack combined image to the CC2640R2 Launchpad |
|
Note: You may have to re-insert the USB cable to the Launchpad after downloading for the virtual COM port to work correctly in Windows |