Sunday, August 19, 2018

TI Simplelink BLE

Here we try out TI SimpleLink Bluetooth Low Energy (BLE) CC2650MODA+MSP432P401R Launchpad bundle ($35).  MSP432P401R comes with an out-of-box demo with LEDs.  We install the latest CCS 8.1.0 and SimpleLink MSP432P4 SDK (v2.20.00.12).  From the SDK, we import outofbox_msp432p401r_MSP_EXP432P401R_tirtos_ccs and  compile and upload.  After that is successful, we download SimpleLink SDK BLE Plugin (simplelink_sdk_ble_plugin_1_40_00_42) and also BLE-Stack (ble_sdk_2_02_02_25). 

We import from SimpleLink SDK BLE Plugin project_zero_MSP_EXP432P401R_tirtos_ccs.   We compile and upload.   When the USB is connected to a PC, two serial ports are created.  On Linux they are /dev/ttyACM0 and ACM1.  Connect to the serial port at 115200 baud, the following message comes up.
--------- Project Zero Example ---------
Initializing the user task, hardware, BLE stack and services.
LEDService: Registered callbacks to application.
ButtonService: registered callbacks to application
DataService: Registered callbacks to application.
LEDService: Registered service, 1 attributes
ButtonService: Registered service, 2 attributes
DataService: Registered service, 2 attributes
Scanning for Bluetooth devices, "Project Zero" should come up.   TI Android App SimpleLink SDK Explorer can be used for testing; it has a Project Zero interface to control the LED, read buttons, and send text.  On Linux, we can use hcitool lescan to scan and gatttool to test
gatttool -b A0:E6:F8:BD:EB:02 -I
[A0:E6:F8:BD:EB:02][LE]> connect
Attempting to connect to A0:E6:F8:BD:EB:02
Connection successful
[A0:E6:F8:BD:EB:02][LE]> primary
attr handle: 0x0001, end grp handle: 0x0007 uuid: 00001800-0000-1000-8000-00805f9b34fb
attr handle: 0x0008, end grp handle: 0x0008 uuid: 00001801-0000-1000-8000-00805f9b34fb
attr handle: 0x0009, end grp handle: 0x001b uuid: 0000180a-0000-1000-8000-00805f9b34fb
attr handle: 0x001c, end grp handle: 0x001e uuid: f0001110-0451-4000-b000-000000000000
attr handle: 0x001f, end grp handle: 0x0025 uuid: f0001120-0451-4000-b000-000000000000
attr handle: 0x0026, end grp handle: 0xffff uuid: f0001130-0451-4000-b000-000000000000
[A0:E6:F8:BD:EB:02][LE]> char-write-req 0x001e ff00ff
Characteristic value was written successfully
[A0:E6:F8:BD:EB:02][LE]> char-read-hnd 0x001e
Characteristic value/descriptor: ff 00 ff
When both buttons are pressed, CC2650MODA is flashed.  However, note the default project includes cc2640r2lp_simple_np_uart_pm_sble hex, which does not work with CC2650.  We replace it with simple_np_cc2650bp_uart_pm_sbl_2_02_01_18a_merge.  If there is some problem flashing, install SmartRF Flash Programmer 2 (v1.7.5).

CC2650MODA draws about 160uA when idle, and 0.1uA when in reset.  There is a 100K pull up resistor on the reset pin, which could contribute to 30uA if the reset pin is pulled low.

No comments:

Post a Comment