NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

WL18xx TI Bluetooth Stack HRPM Demo App

From Texas Instruments Wiki
Jump to: navigation, search

Return to WL18xx AM335x TI Bluetooth Stack

Demo Overview[edit]

NoteNote: : This instructions can be used to run this demo on the AM335x Platform.

The Heart Rate profile enables a Collector device to connect and interact with a Heart Rate sensor for use in healthcare applications. There are two roles defined in this profile. The first is the Sensor which measures the Heart Rate and the second is the collector which gets the Heart Rate and other settings from the sensor. Typically, the sensor would be present directly on the patient in a location such as the Heart or wrist measuring the temperature while the collector device is close by getting the Heart Rate from the sensor at regular intervals.

This application allows the user to use a console to use Bluetooth Low Energy (BLE) to establish connection between two BLE devices, notify heart rate between the server and client, get and change the location of the heart rate sensor.

It is recommended that the user visits the kit setup Getting Started Guide for AM335x pages before trying the application described on this page.

Running the Bluetooth Code[edit]

Once the am335x is initialized on the terminal, follow the instructions;

NoteNote: When using a CC256x controller you will need to change the init script in order to enable BLE. You can use the following command in the AM335x device terminal

cp -f /lib/firmware/TIInit_6.7.16_ble_on.bts /lib/firmware/TIInit_6.7.16.bts


Enter to the Sample Application folder, for this example “cd BluetopiaPM/bin”

 root@am335x-evm:~# cd BluetopiaPM/bin/
 root@am335x-evm:~/BluetopiaPM/bin#

Start the Server and the Demo application by typing “./SS1BTPM & ./LinuxHRPM”

root@am335x-evm:~/BluetopiaPM/bin# ./SS1BTPM & ./LinuxHRPM
[1] 1789

Now the help screen is displayed

******************************************************************
* Command Options: 1) Initialize                                 *
*                  2) Cleanup                                    *
*                  3) QueryDebugZoneMask                         *
*                  4) SetDebugZoneMask                           *
*                  5) ShutdownService                            *
*                  6) RegisterEventCallback,                     *
*                  7) UnRegisterEventCallback,                   *
*                  8) QueryDevicePower                           *
*                  9) SetDevicePower                             *
*                  10)QueryLocalDeviceProperties                 *
*                  11)SetLocalDeviceName                         *
*                  12)SetLocalClassOfDevice                      *
*                  13)SetDiscoverable                            *
*                  14)SetConnectable                             *
*                  15)SetPairable                                *
*                  16)StartDeviceDiscovery                       *
*                  17)StopDeviceDiscovery                        *
*                  18)QueryRemoteDeviceList                      *
*                  19)QueryRemoteDeviceProperties                *
*                  20)AddRemoteDevice                            *
*                  21)DeleteRemoteDevice                         *
*                  22)DeleteRemoteDevices                        *
*                  23)PairWithRemoteDevice                       *
*                  24)CancelPairWithRemoteDevice                 *
*                  25)UnPairRemoteDevice                         *
*                  26)QueryRemoteDeviceServices                  *
*                  27)RegisterAuthentication                     *
*                  28)UnRegisterAuthentication                   *
*                  29)PINCodeResponse                            *
*                  30)PassKeyResponse                            *
*                  31)UserConfirmationResponse                   *
*                  32)ChangeSimplePairingParameters              *
*                  33)ConnectWithRemoteDevice                    *
*                  34)DisconnectRemoteDevice                     *
*                  35)HRPRegisterCollectorEvents                 *
*                  36)HRPUnRegisterCollectorEvents               *
*                  37)HRPGetBodySensorLocation                   *
*                  38)HRPResetEnergyExpended                     *
*                  39)StartAdvertising                           *
*                  40)StopAdvertising                            *
*                  41)EnableBluetoothDebug                       *
*                  Help, Quit.                                   *
******************************************************************




Demo Application[edit]

This section provides a description of how to use the demo application to connect two configured boards and communicate over Bluetooth. HRS is a simple Client-Server connection process. We will setup one of the boards as a server and the other board as a client. We will then initiate a connection from the client to the server. Once connected, we can transmit data between the two devices over Bluetooth.



Heart Rate Profile (HRPM) - Collector Role[edit]

To verify the HRPM collector role, after running the "LinuxHRPM" executable, initializing, and powering on the local device if necessary, first register for HRP collector events.
a) Initialize the profile by typing “1 1” or “Initialize 1”.
b) Powering up the Bluetooth device by typing “9 1” or "SetDevicePower 1”, if the device is already powered up you’ll receive an error that the device is already powered up
HRPM>Initialize 1

BTPM_Initialize() Success: 0.
DEVM_RegisterEventCallback() Success: 5.
HRPM>SetDevicePower 1


[14740.172341] (hci_tty): inside hci_tty_open (ecc473c0, ec8a9440)
[14740.178530] (stc):  chnl_id list empty :4
[14740.182594] (stk) : st_kim_start(stk) :ldisc_install = 1uim:poll broke due to event 10(PRI:2/ERR:8)

uim:read 1 from install

uim:@ st_uart_config
uim: signal received, opening /dev/ttyS1
uim:@ set_baud_rate
uim:set_baud_rate() done
uim:Setting speed to 3000000
uim:@ read_command_complete
uim: Command complete started
uim:@ read_hci_event
uim: read_hci_event
uim:Command complete done
[14740.363201] (stc): st_tty_open
uim:Speed changing to 3000000, 1
uim:@ set_custom_baud_rate
(stk) :line discipline installeduim:Installed N_TI_WL Line displine
[14740.377487] (stk) :TIInit_11.8.32.bts
uim:begin polling...
(stk) :change remote baud rate command in firmware
[14740.390714] (stk) :skipping the wait event of change remote baud[14741.145935] (stc): add_channel_to_table: id 4
[14741.150335] (stc): add_channel_to_table: id 2
[14741.154749] (stc): add_channel_to_table: id 3
BT COMM PORT (/dev/hci_tty): 1
DEVM_PowerOnDevice() Success: 0.
HRPM>
Device Powered On.
HRPM>
c) Now register for HRP client events.
HRPM>HRPRegisterCollectorEvents

HRPM_Register_Collector_Event_Callback() Success: 1.
HRPM>
d) Connect with the remote device that has a heart rate service, HRS.
Usage: ConnectWithRemoteDevice [BD_ADDR] [Connect LE (1 = LE, 0 = BR/EDR)] [ConnectFlags (Optional)].
where ConnectFlags is a bitmask of
    0x00000001 = Authenticate
    0x00000002 = Encrypt
    0x00000004 = Use Local Random Address
    0x00000008 = Use Peer Random Address
HRPM>ConnectWithRemoteDevice 0002723257F8 1

Attempting to Connect With (LE) Remote Device: 0002723257F8 (Flags = 0x80000000).
DEVM_ConnectWithRemoteDevice() Success: 0.
HRPM>
Remote Device Connection Status: 0002723257F8, 0 (SUCCESS)
HRPM>
Remote Device Properties Changed.
BD_ADDR:             0002723257F8
Address Type:        Public
LE Type:             Dual Mode
Device Flags:        0xC0048001
LE Connect State:    TRUE
HRPM>
e) Discover and identify the remote device's GATT services for the local device, then the remote device with a HRS sensor role can notify this collector client of heart rate measurements.
HRPM>QueryRemoteDeviceServices 0002723257F8 1 1

Attempting Query Remote Device 0002723257F8 For GATT Services.
DEVM_QueryRemoteDeviceServices() Success: 0, Total Number Service Bytes: 0.
HRPM>
Remote Device 0002723257F8 Services Status: LE, SUCCESS.
HRPM>
Remote Device Properties Changed.
BD_ADDR:             0002723257F8
Address Type:        Public
LE Type:             Dual Mode
Device Flags:        0xC0049001
GATT Services Known: TRUE
HRPM>
Remote Device Properties Changed.
BD_ADDR:             0002723257F8
Address Type:        Public
LE Type:             Dual Mode
Device Flags:        0xC004B001
Device Appearance:   128
HRPM>

hetHRPConnected with size 16:
   Bluetooth Address:     0002723257F8
   Connection Flags:      0x00000003
   Connection Type:       Sensor
   Body Sensor Location:  Supported
   Reset Energy Expended: Supported

HRPM>

hetHRPHeartRateMeasurement with size 24:
   Bluetooth Address: 0002723257F8

   Heart Rate Measurement Data:
      Measurement Flags:   0x1F
      Heart Rate       :   1
      Energy Expended  :   1
      Sensor Contact   :   Detected
      Num. RR Intervals:   5
      RR Intervals     :   { 100, 101, 102, 103, 104 }

HRPM>
f) Get the location of the body sensor and reset the energy expended.
HRPM>HRPGetBodySensorLocation 0002723257F8

HRPM_Get_Body_Sensor_Location() Success.
HRPM>

hetHRPGetBodySensorLocationResponse with size 16:
   Bluetooth Address: 0002723257F8
   Status:            0

   Body Sensor Location is 'Chest'.

HRPM>HRPResetEnergyExpended 0002723257F8

HRPM_Reset_Energy_Expended() Success.
HRPM>

hetHRPResetEnergyExpendedResponse with size 16:
   Bluetooth Address: 0002723257F8
   Status:            0

   Reset Energy Expended Success.

HRPM>
g) Disconnect the remote device from the local device.
HRPM>DisconnectRemoteDevice 0002723257F8 1

Attempting to Disconnect Remote Device: 0002723257F8.
DEVM_DisconnectRemoteDevice() Success: 0.
HRPM>
Remote Device Properties Changed.
BD_ADDR:             0002723257F8
Address Type:        Public
LE Type:             Dual Mode
Device Flags:        0xC0003001
LE Connect State:    FALSE
HRPM>

hetHRPDisconnected with size 16:
   Bluetooth Address:     0002723257F8
   Connection Type:       Sensor

HRPM>
E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article WL18xx TI Bluetooth Stack HRPM Demo App here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article WL18xx TI Bluetooth Stack HRPM Demo App here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article WL18xx TI Bluetooth Stack HRPM Demo App here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article WL18xx TI Bluetooth Stack HRPM Demo App here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article WL18xx TI Bluetooth Stack HRPM Demo App here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article WL18xx TI Bluetooth Stack HRPM Demo App here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article WL18xx TI Bluetooth Stack HRPM Demo App here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article WL18xx TI Bluetooth Stack HRPM Demo App here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article WL18xx TI Bluetooth Stack HRPM Demo App here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity