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 DEVM Demo App
Return to WL18xx AM335x TI Bluetooth Stack
Contents
Demo Overview[edit]
Note: : This instructions can be used to run this demo on the AM335x Platform.
DEVM is a BluetopiaPM framework module that works within every profile sample application on the local device to provide generic Bluetooth device functionality.
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#
Start the Server and the Demo application by typing “./SS1BTPM & ./LinuxDEVM”
root@am335x-evm:~/BluetopiaPM/bin# ./SS1BTPM & ./LinuxDEVM [1] 1789
Now the help screen is displayed
****************************************************************** * Command Options: 1) Initialize * * 2) Cleanup * * 3) QueryDebugZoneMask * * 4) SetDebugZoneMask * * 5) SetDebugZoneMaskPID * * 6) ShutdownService * * 7) RegisterEventCallback, * * 8) UnRegisterEventCallback, * * 9) QueryDevicePower * * 10)SetDevicePower * * 11)QueryLocalDeviceProperties * * 12)SetLocalDeviceName * * 13)SetLocalClassOfDevice * * 14)SetDiscoverable * * 15)SetConnectable * * 16)SetPairable * * 17)StartDeviceDiscovery * * 18)StopDeviceDiscovery * * 19)QueryRemoteDeviceList * * 20)QueryRemoteDeviceProperties * * 21)AddRemoteDevice * * 22)DeleteRemoteDevice * * 23)UpdateRemoteDeviceAppData * * 24)DeleteRemoteDevices * * 25)PairWithRemoteDevice * * 26)CancelPairWithRemoteDevice * * 27)UnPairRemoteDevice * * 28)QueryRemoteDeviceServices * * 29)QueryRemoteDeviceServiceSupported * * 30)QueryRemoteDevicesForService * * 31)QueryRemoteDeviceServiceClasses * * 32)AuthenticateRemoteDevice * * 33)EncryptRemoteDevice * * 34)ConnectWithRemoteDevice * * 35)DisconnectRemoteDevice * * 36)SetRemoteDeviceLinkSniff * * 37)SetRemoteDeviceLinkActive * * 38)CreateSDPRecord * * 39)DeleteSDPRecord * * 40)AddSDPAttribute * * 41)DeleteSDPAttribute * * 42)EnableBluetoothDebug * * 43)RegisterAuthentication * * 44)UnRegisterAuthentication * * 45)PINCodeResponse * * 46)PassKeyResponse * * 47)UserConfirmationResponse * * 48)ChangeSimplePairingParameters * * 49)EnableFeature * * 50)DisableFeature * * 51)QueryActiveFeatures * * 52)SendRawHCICommand * * 53)SendHCIVSCommand (Example) * * Help, Quit. * ******************************************************************
Demo Application[edit]
The demo application provides a description on how to use the demo application to connect two configured boards and communicate over Bluetooth.
Device Manager (DEVM)[edit]
- To verify DEVM functionality, start by running the "LinuxDEVM" executable.
- a) Typically the first step after having an instance of the BluetopiaPM server running and executing one of the sample applications is to initialize the Bluetopia Bluetooth, BT, protocol stack as well as BluetopiaPM framework on the local device by entering "Initialize 1" at the prompt.
- b) If the instance of PM sever on the local device has just recently been started or restarted, the local device must be given power by using the "SetDevicePower" command with a parameter of "1", meaning "Power On"., if the device is already powered up you’ll receive an error that the device is already powered up
DEVM>Initialize 1 BTPM_Initialize() Success: 0. DEVM_RegisterEventCallback() Success: 5. DEVM>SetDevicePower 1 [16045.699405] (hci_tty): inside hci_tty_open (ecc4d3c0, ecbddec0) [16045.706811] (stc): chnl_id list empty :4 [16045.710864] (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 [16045.873714] (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 [16045.888032] (stk) :TIInit_11.8.32.bts uim:begin polling... (stk) :change remote baud rate command in firmware [16045.901310] (stk) :skipping the wait event of change remote baud[16046.660392] (stc): add_channel_to_table: id 4 [16046.664824] (stc): add_channel_to_table: id 2 [16046.669200] (stc): add_channel_to_table: id 3 BT COMM PORT (/dev/hci_tty): 1 DEVM_PowerOnDevice() Success: 0. DEVM> Device Powered On. DEVM>
- c) Device discovery is a common Bluetooth command used to discover remote devices. If the device discovery timeout is set to "0" the local device will continue to search for remote devices until you use the "StopDeviceDiscovery" command to stop this procedure.
DEVM>StartDeviceDiscovery 0 Attempting to Start Discovery (INDEFINITE). DEVM_StartDeviceDiscovery() Success: 1. DEVM> Remote Device Found. BD_ADDR: 00182FD3E146 COD: 0x001F20 Device Name: Device Flags: 0x80000001 NAME_KNOWN RSSI: -63 Friendly Name:e@ti.com App. Info: : 00000000 Paired State : FALSE Connect State: FALSEUC-Audio-Sink.jpg Encrypt State: FALSE Sniff State : FALSE Serv. Known : FALSE DEVM> Remote Device Found. BD_ADDR: 001BDC065AB2 COD: 0x000000 Device Name: Device Flags: 0x80000401 NAME_KNOWN EIR_DATA_KNOWN RSSI: -66 Friendly Name: App. Info: : 00000000 Paired State : FALSE Connect State: FALSE Encrypt State: FALSE Sniff State : FALSE Serv. Known : FALSE DEVM>
DEVM>StopDeviceDiscovery DEVM_StopDeviceDiscovery() Success: 0. DEVM> Local Device Properties Changed. DEVM> Device Discovery Stopped. DEVM>
- d) To get the properties of a specific remote device found in a device discovery use the "QueryRemoteDeviceProperties" followed by the BT address of that device and then a "0".
DEVM>QueryRemoteDeviceProperties 0002723257F7 0 Attempting to Query Device Properties: 0002723257F7, ForceUpdate: FALSE. DEVM_QueryRemoteDeviceProperties() Success: 0. BD_ADDR: 0002723257F7 COD: 0x000000 Device Name: SS1BTPM DeviceUC-Audio-Sink.jpg Device Flags: 0xC0000001 NAME_KNOWN RSSI: 0 Friendly Name: App. Info: : 00000000 Paired State : FALSE Connect State: FALSE Encrypt State: FALSE Sniff State : FALSE Serv. Known : FALSE DEVM>
- e) To pair with a remote device first make sure the device is in a discoverable, connectable, and pairable mode by using a combination of the QueryLocalDeviceProperties command, to query the properties of the local device, and the commands SetDiscoverable, SetConnectable, and SetPairable, to set necessary modes to successfully complete the pairing process.
Now register for authentication using the RegisterAuthentication command, then use the appropriate application pairing function, the PairWithRemoteDevice command for this case, followed by the Bluetooth address. The local device will display a pairing request response prompt from the remote device, in this case it was "Respond with the command: UserConfirmationResponse", so use the UserConfirmationResponse command number followed by a 1 to successfully complete the pairing process. The remote device should prompt you with some form of pairing as well to successfully pair the devices.
DEVM>SetDiscoverable 1 Attempting to set Discoverability Mode: Limited (0 Seconds). DEVM_UpdateLocalDeviceProperties() Success: 0. DEVM>
DEVM>SetConnectable 1 Attempting to set Connectability Mode: Connectable (0 Seconds). DEVM_UpdateLocalDeviceProperties() Success: 0. DEVM>
DEVM>SetPairable 1 Attempting to set Pairability Mode: Pairable (0 Seconds). DEVM_UpdateLocalDeviceProperties() Success: 0. DEVM>
DEVM>QueryLocalDeviceProperties DEVM_QueryLocalDeviceProperties() Success: 0. BD_ADDR: 000272D69EB2 HCI Ver: 0x0006 HCI Rev: 0x1000 LMP Ver: 0x0006 LMP Sub Ver: 0x220E Device Man: 0x000F (Broadcom Corporation) Device Flags: 0x80000000 COD: 0x000000UC-Audio-Sink.jpg Device Name: SS1BTPM Device Disc. Mode: TRUE , 0x00000000 Conn. Mode: TRUE , 0x00000000 Pair. Mode: TRUE , 0x00000000 DEVM>
DEVM>RegisterAuthentication DEVM_RegisterAuthentication() Success: 6. DEVM>
DEVM>PairWithRemoteDevice 0002723257F8 Attempting to Pair With Remote Device: 0002723257F8 (Force = 0). DEVM_PairWithRemoteDevice() Success: 0. DEVM> Remote Device Properties Changed. BD_ADDR: 0002723257F8 Device Flags: 0x80000149 NAME_KNOWN LINK_INITIATED_LOCALLY Connect State: TRUE DEVM> Authentication Request received for 0002723257F8. I/O Capability Request. DEVM_AuthenticationResponse() Success. DEVM> Authentication Request received for 0002723257F8. I/O Capability Response. Remote I/O Capabilities: Display Yes/No, MITM Protection: TRUE, OOB Data: FALSE, Bonding: General. DEVM> Authentication Request received for 0002723257F8. User Confirmation Request. User Confirmation: 202366 Respond with the command: UserConfirmationResponse DEVM>
DEVM>UserConfirmationResponse 1 DEVM_AuthenticationResponse(), User Confirmation Response Success. DEVM> Remote Device Properties Changed. BD_ADDR: 0002723257F8 Device Flags: 0x800001CD NAME_KNOWN LINK_INITIATED_LOCALLY AUTHENTICATED_KEY Paired State : TRUE DEVM> Remote Device Pairing Status: 0002723257F8, SUCCESS (0x00) DEVM> Remote Device Properties Changed. BD_ADDR: 0002723257F8 Device Flags: 0x800001DD NAME_KNOWN LINK_INITIATED_LOCALLY AUTHENTICATED_KEY Encrypt State: TRUE DEVM> Remote Device 0002723257F8 Services Status: BR/EDR, SUCCESS. DEVM> Remote Device Properties Changed. BD_ADDR: 0002723257F8 Device Flags: 0x800001DD NAME_KNOWN LINK_INITIATED_LOCALLY AUTHENTICATED_KEY Serv. Known : TRUE DEVM> Remote Device Properties Changed. BD_ADDR: 0002723257F8 Device Flags: 0x80000185 NAME_KNOWN AUTHENTICATED_KEY Connect State: FALSE Encrypt State: FALSE DEVM>
- f) Service discovery is also another common, yet crucial, BT function. To discover a remote device's services use the "QueryRemoteDeviceServices", or equivalent command of the application you are using, followed by the necessary parameters. When performing this action, you can optionally specify, using the function parameters, not to display or to display the total parsed SDP record of remote device.
Note: If you are not using force update the number of Bytes to be queried should be greater than or equal to the “Total Number Service Bytes”.
DEVM>QueryRemoteDeviceServices 0002723257F8 1 0 Attempting Query Remote Device 0002723257F8 For Services. DEVM_QueryRemoteDeviceServices() Success: 0, Total Number Service Bytes: 0. DEVM> Remote Device Properties Changed. BD_ADDR: 0002723257F8 Device Flags: 0xC000314D NAME_KNOWN LINK_INITIATED_LOCALLY Connect State: TRUE DEVM> Remote Device 0002723257F8 Services Status: BR/EDR, SUCCESS. DEVM> Remote Device Properties Changed. BD_ADDR: 0002723257F8 Device Flags: 0xC000314D NAME_KNOWN LINK_INITIATED_LOCALLY Serv. Known : TRUE DEVM>
DEVM>QueryRemoteDeviceServices 0002723257F8 0 78 Attempting Query Remote Device 0002723257F8 For Services. DEVM_QueryRemoteDeviceServices() Success: 78, Total Number Service Bytes: 78. Returned Service Data (78 Bytes): 354C354A0900000A0001000009000135031911010900020A00000003090004350C350319010035051900030801090006350909656E09006A090100090100250E53657269616C20506F727420312E Service Record: 1: Attribute ID 0x0000 Type: Unsigned Int = 0x00010000 Attribute ID 0x0001 Type: Data Element Sequence Type: UUID_16 = 0x1101 Attribute ID 0x0002 Type: Unsigned Int = 0x00000003 Attribute ID 0x0004 Type: Data Element Sequence Type: Data Element Sequence Type: UUID_16 = 0x0100 Type: Data Element Sequence Type: UUID_16 = 0x0003 Type: Unsigned Int = 0x01 Attribute ID 0x0006 Type: Data Element Sequence Type: Unsigned Int = 0x656Ee@ti.com Type: Unsigned Int = 0x006A Type: Unsigned Int = 0x0100 Attribute ID 0x0100 Type: Text String = Serial Port 1. DEVM>