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 HDPM 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.
This demo allows users to evaluate TI's WL18xx device by using the AM335x platform. This profile together with the Multi-Channel Adaptation Protocol (MCAP) enables Healthcare and Fitness device usage models. The Health Device Profile supports two roles, Sink and Source. This document demonstrates how to use both roles of the profile.

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;
Enter to the Sample Application folder, for this example “cd BluetopiaPM/bin”

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


Demo Application[edit]

This section provides a description of how to connect to and retrieve data from an Health device.
NoteNote: The Bluetooth Health Device Profile is only a transport for IEEE 11073 data and to decode and verify the data an 11073 stack is required and is not provided by Stonestreet One.

Health Device Profile (HDPM) - Source / Sink Role[edit]

To verify HDPM Source and Sink roles functionality, first run the "LinuxHDPM" executable, initialize, and power on the both device if necessary.

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

root@am335x-evm:~/BluetopiaPM/bin# ./SS1BTPM & ./LinuxHDPM
[3] 8338

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)HDPRegisterEndpoint                        *
*                  34)HDPUnregisterEndpoint                      *
*                  35)HDPDataConnectionRequestResponse           *
*                  36)HDPQueryRemoteDeviceInstances              *
*                  37)HDPQueryRemoteDeviceInstanceEndpoints      *
*                  38)HDPQueryRemoteDeviceEndpointDescription    *
*                  39)HDPConnectRemoteDevice                     *
*                  40)HDPDisconnectRemoteDevice                  *
*                  41)HDPConnectRemoteDeviceEndpoint             *
*                  42)HDPDisconnectRemoteDeviceEndpoint          *
*                  43)HDPWriteData                               *
*                  44)HDPWriteDataLength                         *
*                  45)HDPWriteDataCont                           *
*                  46)HDPStopWriteDataCont                       *
*                  47)EnableBluetoothDebug                       *
*                  Help, Quit.                                   *
******************************************************************
  • Run the following command (a to c) on both devices.
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
HDPM>Initialize 1

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

echo 117 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio117/direction
echo 0 > /sys/class/gpio/gpio117/value
echo 1 > /sys/class/gpio/gpio117/value
BT COMM PORT (/dev/ttyS1): 1
Changing HCI baud rate to 3000000
Status: Executing BTS Script /lib/firmware/TIInit_12.10.28.bts.
Status: BTS Script successfully executed.
DEVM_PowerOnDevice() Success: 0.
HDPM>
Device Powered On.
HDPM>
c) Register Authentication if needed
HDPM>RegisterAuthentication

DEVM_RegisterAuthentication() Success: 5.
HDPM>
  • Source
d) Register HDP End Point as Source, You can add Description for the device.
Usage: HDPM_Register_Endpoint [Data Type] [Role (0: Sink, 1: Source)] [Description (Optional)].
HDPM>HDPRegisterEndpoint 1 1 HDP_Preview_Source

HDPM_Register_Endpoint() Success.
    Endpoint ID: 1.
HDPM>
  • Sink
d) Register HDP End Point as Sink, You can add Description for the device.
HDPM>HDPRegisterEndpoint 1 0 HDP_Preview_Sink

HDPM_Register_Endpoint() Success.
    Endpoint ID: 1.
HDPM>

NoteNote: : Endpoint ID Number will be use in the following commands

e) You can can use QueryRemoteDeviceServices function in order to discover SDP and see the new SDP records.
Usage: QueryRemoteDeviceServices [BD_ADDR] [Force Update] [Bytes to Query (specified if Force is 0)].
  • Source
HDPM>QueryRemoteDeviceServices 84DD209C58DD 1 0

Attempting Query Remote Device 84DD209C58DD For Services.
DEVM_QueryRemoteDeviceServices() Success: 0, Total Number Service Bytes: 0.
HDPM>
Remote Device Properties Changed.
BD_ADDR:       84DD209C58DD
Device Flags:  0x800001CD
Connect State: TRUE
HDPM>
Remote Device 84DD209C58DD Services Status: BR/EDR, SUCCESS.
HDPM>
Remote Device Properties Changed.
BD_ADDR:       84DD209C58DD
Device Flags:  0x800001CD
Serv. Known  : TRUE
HDPM>
Remote Device Properties Changed.
BD_ADDR:       84DD209C58DD
Device Flags:  0x80000185
Connect State: FALSE
HDPM>
HDPM>QueryRemoteDeviceServices 84DD209C58DD 0 2000

Attempting Query Remote Device 84DD209C58DD For Services.
DEVM_QueryRemoteDeviceServices() Success: 997, Total Number Service Bytes: 997.
Returned Service Data (997 Bytes):...
Service Record: 9:
    Attribute ID 0x0000
       Type: Unsigned Int = 0x00010009
    Attribute ID 0x0001
       Type: Data Element Sequence
          Type: UUID_16 = 0x1402
    Attribute ID 0x0002
       Type: Unsigned Int = 0x00000009
    Attribute ID 0x0004
       Type: Data Element Sequence
          Type: Data Element Sequence
             Type: UUID_16 = 0x0100
             Type: Unsigned Int = 0x1001
          Type: Data Element Sequence
             Type: UUID_16 = 0x001E
             Type: Unsigned Int = 0x0100
    Attribute ID 0x0006
       Type: Data Element Sequence
          Type: Unsigned Int = 0x656E
          Type: Unsigned Int = 0x006A
          Type: Unsigned Int = 0x0100
    Attribute ID 0x0009
       Type: Data Element Sequence
          Type: Data Element Sequence
             Type: UUID_16 = 0x1400
             Type: Unsigned Int = 0x0100
    Attribute ID 0x000D
       Type: Data Element Sequence
          Type: Data Element Sequence
             Type: Data Element Sequence
                Type: UUID_16 = 0x0100
                Type: Unsigned Int = 0x1003
             Type: Data Element Sequence
                Type: UUID_16 = 0x001F
    Attribute ID 0x0100
       Type: Text String = Health Device Service
    Attribute ID 0x0102
       Type: Text String = Texas Instruments
    Attribute ID 0x0200
       Type: Data Element Sequence
          Type: Data Element Sequence
             Type: Unsigned Int = 0x01
             Type: Unsigned Int = 0x0001
             Type: Unsigned Int = 0x01
             Type: Text String = HDP_Preview_Sink
    Attribute ID 0x0301
       Type: Unsigned Int = 0x01
    Attribute ID 0x0302
       Type: Unsigned Int = 0x00
HDPM>

NoteNote: : You can See in this Service Record that this record is HDP - "Text String = Health Device Service" and you can see the Description you wrote "Text String = HDP_Preview_Sink"

  • Sink
HDPM>QueryRemoteDeviceServices D03972507A42 1 0

Attempting Query Remote Device D03972507A42 For Services.
DEVM_QueryRemoteDeviceServices() Success: 0, Total Number Service Bytes: 0.
HDPM>
Remote Device Properties Changed.
BD_ADDR:       D03972507A42
Device Flags:  0x800001CD
Connect State: TRUE
HDPM>
Remote Device D03972507A42 Services Status: BR/EDR, SUCCESS.
HDPM>
Remote Device Properties Changed.
BD_ADDR:       D03972507A42
Device Flags:  0x800001CD
Serv. Known  : TRUE
HDPM>
Remote Device Properties Changed.
BD_ADDR:       D03972507A42
Device Flags:  0x80000185
Connect State: FALSE
HDPM>
HDPM>QueryRemoteDeviceServices D03972507A42 0 2000

Attempting Query Remote Device D03972507A42 For Services.
DEVM_QueryRemoteDeviceServices() Success: 999, Total Number Service Bytes: 999.
Returned Service Data (999 Bytes):...
Service Record: 9:
    Attribute ID 0x0000
       Type: Unsigned Int = 0x00010009
    Attribute ID 0x0001
       Type: Data Element Sequence
          Type: UUID_16 = 0x1401
    Attribute ID 0x0002
       Type: Unsigned Int = 0x00000009
    Attribute ID 0x0004
       Type: Data Element Sequence
          Type: Data Element Sequence
             Type: UUID_16 = 0x0100
             Type: Unsigned Int = 0x1001
          Type: Data Element Sequence
             Type: UUID_16 = 0x001E
             Type: Unsigned Int = 0x0100
    Attribute ID 0x0006
       Type: Data Element Sequence
          Type: Unsigned Int = 0x656E
          Type: Unsigned Int = 0x006A
          Type: Unsigned Int = 0x0100
    Attribute ID 0x0009
       Type: Data Element Sequence
          Type: Data Element Sequence
             Type: UUID_16 = 0x1400
             Type: Unsigned Int = 0x0100
    Attribute ID 0x000D
       Type: Data Element Sequence
          Type: Data Element Sequence
             Type: Data Element Sequence
                Type: UUID_16 = 0x0100
                Type: Unsigned Int = 0x1003
             Type: Data Element Sequence
                Type: UUID_16 = 0x001F
    Attribute ID 0x0100
       Type: Text String = Health Device Service
    Attribute ID 0x0102
       Type: Text String = Texas Instruments
    Attribute ID 0x0200
       Type: Data Element Sequence
          Type: Data Element Sequence
             Type: Unsigned Int = 0x01
             Type: Unsigned Int = 0x0001
             Type: Unsigned Int = 0x00
             Type: Text String = HDP_Preview_Source
    Attribute ID 0x0301
       Type: Unsigned Int = 0x01
    Attribute ID 0x0302
       Type: Unsigned Int = 0x00

NoteNote: : You can See in this Service Record that this record is HDP - "Text String = Health Device Service" and you can see the Description you wrote "Text String = HDP_Preview_Source"


  • The following command Works both ways
e) In Order to Connect both devices, You'll need Instance ID. therefore, before using the connect command you will need to discover the Instance ID
Usage: HDPQueryRemoteDeviceInstances [BD_ADDR].
HDPM>HDPQueryRemoteDeviceInstances 84DD209C58DD

HDPM_Query_Remote_Device_Instances() Success: 1.  Total Instances: 1
  Instances:
      0x10011003
HDPM>
f) After Discovering the Instance ID you can initiate the connection.
Usage: HDPConnectRemoteDevice [BD_ADDR] [Instance].
HDPM>HDPConnectRemoteDevice 84DD209C58DD 0x10011003

HDPM_Connect_Remote_Device() Success: 0.
HDPM>
Remote Device Properties Changed.
BD_ADDR:       84DD209C58DD
Device Flags:  0x800001CD
Connect State: TRUE
HDPM>
Remote Device Properties Changed.
BD_ADDR:       84DD209C58DD
Device Flags:  0x800001DD
Encrypt State: TRUE
HDPM>
HDPM: Connection Status:
    Remote Address: 84DD209C58DD
    Instance:       0x10011003
    Status:         0
HDPM>
g) In order to connect via Multi-Channel Adaptation Protocol (MCAP) You will need first to discover the End Point ID of the remote device.
Usage: HDPQueryRemoteDeviceInstanceEndpoints [BD_ADDR] [Instance].
HDPM>HDPQueryRemoteDeviceInstanceEndpoints 84DD209C58DD 0x10011003

HDPM_Query_Remote_Device_Instance_Endpoints() Success: 1.  Total Endpoints: 1
  Endpoint 1:
      Data Type: 0x0001
      Role:      Sink
HDPM>
h) Initiate the MCAP Connection
Usage: HDPConnectRemoteDeviceEndpoint [BD_ADDR] [Instance] [Endpoint ID] [Channel Mode (0=No Preference, 1=Reliable, 2=Streaming)].
HDPM>HDPConnectRemoteDeviceEndpoint 84DD209C58DD 0x10011003 1 1

HDPM_Connect_Remote_Device_Endpoint() Success: 1.
HDPM>
  • Acceptor

HDPM: Incoming Data Connection Request.

   Remote Address: D03972507A42
   Endpoint ID:    1
   Channel Mode:   Reliable
   DataLink ID:    1

Respond with HDPDataConnectionRequestResponse HDPM>

i) The Receiving Side of the Connection Request has to answer with Connect response.
Usage: HDPM_Data_Connection_Request_Response [DataLink ID] [MCAP Response Code] [Channel Mode (0: No Preference, 1: Reliable, 2: Streaming)].
HDPM>HDPDataConnectionRequestResponse 1 0 1

HDPM_Data_Connection_Request_Response() Success: 0.
HDPM>
HDPM: Data Connected.
    Remote Address: D03972507A42
    Endpoint ID:    1
    DataLink ID:    1
HDPM>
  • Initiator
HDPM>
HDPM: Data Connection Status.
    Remote Address: 84DD209C58DD
    Instance:       0x10011003
    Endpoint ID:    1
    DataLink ID:    1
    Status:         0
HDPM>
j) You can Also read the remote device description.
Usage: HDPQueryRemoteDeviceEndpointDescription [BD_ADDR] [Instance] [Endpoint ID] [Data Type] [Role (0=Sink, 1=Source)].
HDPM>HDPQueryRemoteDeviceEndpointDescription 84DD209C58DD 0x10011003 1 1 0

HDPM_Query_Remote_Device_Endpoint_Description() Success: 16.
  Endpoint 1 Description: HDP_Preview_Sink
HDPM>
k) In Order to Write Data strings use HDPWriteData command
Usage: HDPWriteData [Data Link ID] [Data String].
  • Initiator
HDPM>HDPWriteData 1 ABC

HDPM_Write_Data() Success: 0.
HDPM>
  • Acceptor
HDPM: Data Received.
    Remote Address: D03972507A42
    DataLink ID:    1
    Bytes:          3
    String: ABC
HDPM>
l) In Order to Write Pre-coded numbers use HDPWriteDataLength command and the amount of numbers.
Usage: HDPWriteDataLength [Data Link ID] [Data length].
  • Initiator
HDPM>HDPWriteDataLength 1 20

Transmit thread create Success
HDPM>Transmit thread started
 20 bytes transmitted to the HDP Sink
Transmit thread stopped.
  • Acceptor
HDPM: Data Received.
    Remote Address: D03972507A42
    DataLink ID:    1
    Bytes:          10
    String: 0123456789
HDPM>
HDPM: Data Received.
    Remote Address: D03972507A42
    DataLink ID:    1
    Bytes:          10
    String: 0123456789
HDPM>
m) In Order to Write Continues Pre-coded numbers use HDPWriteDataCont command.
Usage: HDPWriteDataLength [Data Link ID]
  • Initiator

HDPM>HDPWriteDataCont 1

Transmit thread create Success HDPM>Transmit thread started HDPM>

  • Acceptor
HDPM: Data Received.
    Remote Address: D03972507A42
    DataLink ID:    1
    Bytes:          10
    String: 0123456789
HDPM>
HDPM: Data Received.
    Remote Address: D03972507A42
    DataLink ID:    1
    Bytes:          10
    String: 0123456789
HDPM>
...
n) In order to stop the continues data numbers use the following command HDPStopWriteDataCont
HDPM>HDPStopWriteDataCont

Set the Stop thread flag
HDPM> Transmit thread stopped by the application
 16390 bytes transmitted to the HDP Sink
Transmit thread stopped.
HDPM>
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 HDPM 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 HDPM 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 HDPM 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 HDPM 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 HDPM 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 HDPM 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 HDPM 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 HDPM 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 HDPM 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