CC2650 LaunchPad User's Guide for Bluetooth Smart

From Texas Instruments Wiki
Jump to: navigation, search

Bluetooth Low Energy Wiki Main Page

Introduction

This page covers the new CC2650 LaunchPadTM (LAUNCHXL-CC2650) for Bluetooth® low energy (BLE), including new features and hardware capability. At just $29, the CC2650 LaunchPad is a complete development platform with an integrated XDS110 debugger that can be used to prototype Bluetooth low energy IoT applications. As with all TI SimpleLinkTM development kits, a free CCS Full License is provided when using the CC2650 LaunchPad.

The CC2650 LaunchPad is supported by the BLE-Stack v2.2.0 SDK release with Bluetooth core specification version 4.2 (BT4.2) support. This guide provides porting instructions for users of the earlier BLE-Stack v2.1.x SDK as well.

Hardware

The CC2650 LaunchPad for BLE includes the following hardware features:

  • External 8Mbit Serial Flash for supporting Over the Air (OAD) firmware updates
  • 2x push buttons
  • Entire contents of CC2650EM-7ID Evaluation module
  • 2x LEDs
  • 2x BoosterPack connectors
  • Standardized LaunchPad form factor
  • XDS110 debugger w/ external target interface (Provides a free CCS v6.x Full License)

A detailed CC2650 LaunchPad HW User Guide is available at the TI Resource Explorer website.


Notes

  • CC2650 device and RF layout is duplicated from the CC2650EM-7ID device. Schematic inquiries should refer here for reference: http://www.ti.com/tool/cc2650em-7id-rd
  • The on board XDS110 JTAG debugger supports flashing & debugging an external target, follow the instructions on this wiki for details: http://processors.wiki.ti.com/index.php/Connecting_CC2650LP_to_Ext_Target
  • The CC2650 LaunchPad is not compatible with Energia.
  • The external serial flash will by default consume 6uA when idle and must be placed into low power state by issuing commands over the SPI bus. See the procedure below.
  • The LaunchPad can be powered externally using the TI Fuel Tank BoosterPackTM (BOOSTXL-BATTPACK) or by supplying a 3V source to the 3V3 pin as described on the above HW User Guide under "Advanced use of the LaunchPad hardware"



Software

Project.0 Your first Bluetooth low energy application

Now included on TI Resource Explorer, CC2650 Project.0 is as an easy starting point for developing your own Bluetooth LE Peripheral application. Using CCS Cloud, explore, build, download & debug your CC2650 LaunchPad with Project.0. With Project.0 on the CC2650 LaunchPad, you'll see how to control the LEDs and monitor button press states on the SimpleLink SensorTag iOS app over the Bluetooth low energy (BLE) connection. No LCD display required! All diagnostic data is displayed via the LaunchPad's onboard USB Serial port to a PC terminal application. Please see the CC2650 Project 0 page for an overview of the software.

Placing the external flash memory in low power mode

The external serial flash memory used for firmware upgrades (OAD/DFU) must be placed in low power mode to achieve optimal board standby current consumption. The following procedure can be used to place the external serial flash into low power mode:

  1. Include the external flash driver and include file ExtFlash.c/.h into your project. The external flash driver is located in the TI-RTOS installation.
    • For BLE-Stack v2.2.1 this is C:\ti\tirtos_cc13xx_cc26xx_2_20_00_06\products\tidrivers_cc13xx_cc26xx_2_20_00_08\packages\ti\mw\extflash
    • Add to your your application file: #include <ti/mw/extflash/ExtFlash.h>
  2. Call ExtFlash_open(); followed by ExtFlash_close(); into your application's initialization taskFxn, such as SimpleBLEPeripheral_init().
    • Note: The open/close functions must not be called in main and must be called after BIOS_start().

A detailed procedure is also listed in application note Measuring Bluetooth Low Energy Consumption (SWRA478) Rev B or later. When placed in low power mode, the external serial flash on the LaunchPad will consume ~ 100nA.

BLE-Stack Projects already supported by LaunchPad

The CC2650 LaunchPad is supported directly in the BLE-Stack v2.2.0 SDK. The following procedures apply to the BLE-Stack v2.1.x SDK and are not required when using BLE-Stack v2.2.0 SDK or later.

Although any project can be ported to run on the CC2650 LaunchPad by following the steps below, a handful of BLE-Stack SDK v2.1.x projects have already been ported to the CC2650 LaunchPad and are currently available via the TI Github page: https://github.com/ti-simplelink/ble-sdk-210-extra If you would like to use the project listed below, simply clone or download the Zip of the Github repo to use our ported examples.


Porting BLE-Stack v2.1.x to the CC2650 LaunchPad

For most software within the BLE-Stack SDK, porting to the CC2650 LaunchPad is as simple as changing the board files. For more information about board files and changing them please refer to section 6.2 of the Software Developer's Guide.

Board Files

This procedure assumes you have downloaded installed the TI BLE-Stack v2.1.1 SDK. Building BLE-Stack sample applications for the LaunchPad from CCS Cloud is not currently supported.

  1. CC2650 LaunchPad board files are available for download on TI's Github Page: https://github.com/ti-simplelink/ble-sdk-210-extra
    • If you are familiar with Git, you can clone using this URL https://github.com/ti-simplelink/ble-sdk-210-extra.git other wise you can download the entire repository's contents in a zip file using the "Download ZIP" button
    • The board files are contained in the /Util/tirtos_2_13_patches/ti/boards/ folder
  2. After obtaining the files from the TI Github page, place them in the normal TI-RTOS board files location.
    • For TI-RTOSv2.13.00.06 (used by BLE-Stack v2.1.x) the default board file location is:C:\ti\tirtos_simplelink_2_13_00_06\packages\ti\boards
    • Copy the CC2650_LAUNCHXL folder from the repo into the above location
  3. Update the include path of your project to include the new board file location (see include path screenshots below). Replace the CC2650EM-7ID with CC2650_LAUNCHXL.
  4. Change the Board.c in the /Startup folder of the application from Board.c to CC2650_LAUNCHXL.c (see project screenshots below).
IAR Board Project
CCS Board Project
IAR Board Project
CCS Board Project


Board Peripherals

For sample applications such as SimpleBLEPeripheral, SimpleBLEBroadcaster & HostTest, there are no external peripherals used, so the porting process should be complete after changing to board files. Since most of the existing BLE-Stack SDK is based on the SmartRF06 board and SensorTag, there must be extra care taken when porting projects that use specific peripherals from these boards.

LEDs

There are two LEDs present on the LaunchPad, in the Board.h file from the Github you will see that the naming convention for the LEDs is as follows:

#define Board_LED0        Board_RLED
#define Board_LED1        Board_GLED

When using LEDs in your LaunchPad project, you may use either of the names above.

Keys

There are also two buttons on the LaunchPad. Again, the Board.h file from the Github contains the following defintions"

#define Board_BUTTON0       Board_BTN1
#define Board_BUTTON1       Board_BTN2

Change any references to Board_KEY_SELECT, Board_KEY_UP, Board_KEY_DOWN, Board_KEY_RIGHT, Board_KEY_LEFT from the SmartRF06EB to use one of the above button definitions. Examples that use more than two buttons (such as SimpleBLECentral) will require external buttons that can be attached to un-used GPIO pins on the BoosterPack header.

Some projects from the BLE-Stack v2.1.x SDK use the board_key.c module. It contains references to the SmartRF06EB buttons. This file needs to be updated to use only two buttons like this:

PIN_Config keyPinsCfg[] =
{
    Board_BTN1   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,            /* Button is active low          */
    Board_BTN2   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,    
    PIN_TERMINATE
};
 
...
 
void Board_initKeys(keysPressedCB_t appKeyCB)
{
  // Initialize KEY pins. Enable int after callback registered
  hKeyPins = PIN_open(&keyPins, keyPinsCfg);
  PIN_registerIntCb(hKeyPins, Board_keyCallback);
 
  PIN_setConfig(hKeyPins, PIN_BM_IRQ, Board_BUTTON0  | PIN_IRQ_NEGEDGE);
  PIN_setConfig(hKeyPins, PIN_BM_IRQ, Board_BUTTON1  | PIN_IRQ_NEGEDGE);
 
#ifdef POWER_SAVING
  //Enable wakeup
  PIN_setConfig(hKeyPins, PINCC26XX_BM_WAKEUP, Board_BUTTON0 | PINCC26XX_WAKEUP_NEGEDGE);
  PIN_setConfig(hKeyPins, PINCC26XX_BM_WAKEUP, Board_BUTTON1 | PINCC26XX_WAKEUP_NEGEDGE);
#endif
 
  // Setup keycallback for keys
  Util_constructClock(&keyChangeClock, Board_keyChangeHandler,
                      KEY_DEBOUNCE_TIMEOUT, 0, false, 0);
 
  // Set the application callback
  appKeyChangeHandler = appKeyCB;
}

The KEY_IDs must also be changed in the board_key.h file:

#define KEY_ID_BUTTON0         0x0001
#define KEY_ID_BUTTON1         0x0002


UART, SPI, etc

The naming convention has also changed slightly for the on chip peripherals inside the CC2650. For example, references to CC2650_UART0 or CC2650_SPI1 should be changed to Board_UART and Board_SPI1 respectively.

Note: On the CC2650 LaunchPad Rev 1.2, the DIO2 and DIO3 pins (used for UART TX and RX) are labeled incorrectly. The correct labeling can be seen on the CC2650 LaunchPad Rev 1.3 below.

LaunchPad pins

32 kHz Sleep Crystal

The CC2650 LaunchPad uses a 32.768 kHz sleep crystal that has a 90 ppm rating, however, the BLE stack uses default Sleep Clock Accuracy (SCA) of 40 ppm. This can create connection stability issues if long effective connection intervals are used. To configure the sample applications with the correct crystal accuracy, the HCI_EXT_SetSCACmd API can be called during the application initialization function after ICall_registerApp has been called. For the simple_peripheral application, see the Added below:

static void SimpleBLEPeripheral_init(void)
{
  // ******************************************************************
  // N0 STACK API CALLS CAN OCCUR BEFORE THIS CALL TO ICall_registerApp
  // ******************************************************************
  // Register the current thread as an ICall dispatcher application
  // so that the application can send and receive messages.
  ICall_registerApp(&selfEntity, &sem);
  HCI_EXT_SetSCACmd(90); /* Added */

Display

Unlike the SmartRF06 evaluation board, the CC2650 LaunchPad doesn't include an LCD. Any references to LCD_WRITE_STRING("Hello World", LCD_PAGE0); should be removed. In order to fill this need, a generic display driver has been created. This will be pushed to the Github page shortly. It will also be included in future releases of TI-RTOS. In the mean time, you can use the UART logging system as an alternative method for feedback. This UART Logger has been integrated with the SimpleBLEPeripheral on the TI Github page.