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 HIDM 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.
The human interface device enables a host to connect and control a HID device. There are two roles defined in this profile, Host and Device. The first is the Host which sends control and report requests and the second is the device which responds to the host’s requests. The host is a device that like a computer or tablet and the device is a I/O device like keyboard or mouse.
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 & ./LinuxHIDM”
root@am335x-evm:~/Distribution/BluetopiaPM/bin# ./SS1BTPM & ./LinuxHIDM [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)HIDConnectRequestResponse * * 34)HIDConnectDevice * * 35)HIDDisconnectDevice * * 36)HIDQueryConnected * * 37)HIDChangeIncomingFlags * * 38)HIDSetKeyboardRepeat * * 39)HIDSendReport * * 40)HIDSendGetReportRequest * * 41)HIDSendSetReportRequest * * 42)HIDSendGetProtocolRequest * * 43)HIDSendSetProtocolRequest * * 44)HIDSendGetIdleRequest * * 45)HIDSendSetIdleRequest * * 46)HIDRegisterEventCallback * * 47)HIDUnRegisterEventCallback * * 48)HIDRegisterDataCallback * * 49)HIDUnRegisterDataCallback * * 50)EnableBluetoothDebug * * 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. The included application registers a custom service on a board when the stack is initialized.
Host / HID Host setup on the demo application[edit]
- To verify the HID host role, after running the "LinuxHIDM" executable, initializing, and powering on the device if required, first register for HID events and HID data 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
HIDM>Initialize 1 BTPM_Initialize() Success: 0. DEVM_RegisterEventCallback() Success: 5. HIDM>SetDevicePower 1 [ 81.931202] (hci_tty): inside hci_tty_open (ecc473c0, ecd163c0) [ 81.937235] (stc): chnl_id list empty :4 [ 81.941274] (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 [ 82.106852] (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 [ 82.120882] (stk) :TIInit_11.8.32.bts uim:begin polling... (stk) :change remote baud rate command in firmware [ 82.138237] (stk) :skipping the wait event of change remote baud[ 82.893302] (stc): add_channel_to_table: id 4 [ 82.897700] (stc): add_channel_to_table: id 2 [ 82.902111] (stc): add_channel_to_table: id 3 BT COMM PORT (/dev/hci_tty): 1 DEVM_PowerOnDevice() Success: 0. HIDM> Device Powered On. HIDM>
- c) Registering an HID Events and Data Event callbacks
HIDM>HIDRegisterEventCallback HIDM_Register_Event_Callback() Success: 1. HIDM>HIDRegisterDataCallback HIDM_Register_Data_Event_Callback() Success: 2. HIDM>
- d) Connect to a remote HID device such as a bluetooth keyboard.
HIDM>HIDConnectDevice 0007615DFF47 0 HIDM_Connect_Remote_Device() Success: 0. HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000049 Connect State: TRUE HIDM> HIDM: Device Connection Status: 0, Success. Remote Address: 0007615DFF47 HIDM> HIDM: Device Connected. Remote Address: 0007615DFF47 HIDM> HIDM: Device Connected. Remote Address: 0007615DFF47 HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000069 HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000049 HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000069 HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000049 HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000069 HIDM>
- e) Set the keyboard repeat delay and repeat rate.
HIDM>HIDSetKeyboardRepeat Usage: HIDSetKeyboardRepeat [Repeat Delay] [Repeat Rate]. Function Error. HIDM>
HIDM>HIDSetKeyboardRepeat 1000 500 HIDM_Set_Keyboard_Repeat_Rate(1000, 500) Success: 0. HIDM>
- f) Send a HID report.
HIDM>HIDSendReport Usage: HIDSendReport [BD_ADDR] [Report ASCII Hex String (e.g. '110022')]. Function Error.
HIDM>HIDSendReport 0007615DFF47 110022 HIDM_Send_Report_Data() Success: 0. HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000049 HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000069 HIDM> HIDM: Report Data Received. Data Callback : 2 Remote Address: 0007615DFF47 Report Length : 7 Report Data : 0x10 0x00 0x8F 0x22 0xAA 0x01 0x00 HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000049 HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000069 HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000049 HIDM> Remote Device Properties Changed. BD_ADDR: 0007615DFF47 Device Flags: 0x80000069 HIDM>