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 PXPM 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 Proximity profile is used to notify the client about Link Loss and Power Level of the server device. There are two roles defined in this profile, Server and the Client. Any changes made to the Power Level or Link Loss is also notified by the server to the Client.

This application allows the user to use a console to use Bluetooth Low Energy (BLE) to establish connection between two BLE devices, Notify Link Loss, Set Alert Levels and Get Transmit Power Levels.

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 & ./LinuxPXPM_MON”

root@am335x-evm:~/BluetopiaPM/bin# ./SS1BTPM & ./LinuxPXPM_MON
[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)PXPRegisterMonitorEvents                   *
*                  36)PXPUnRegisterMonitorEvents                 *
*                  37)PXPSetPathLossRefreshTime                  *
*                  38)PXPSetPathLossThreshold                    *
*                  39)PXPQueryCurrentPathLoss                    *
*                  40)PXPSetPathLossAlertLevel                   *
*                  41)PXPSetLinkLossAlertLevel                   *
*                  42)StartAdvertising                           *
*                  43)StopAdvertising                            *
*                  44)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 bluetoothLE. The included application registers a custom service on a board when the stack is initialized.


Proximity Profile (PXPM_MON) - Monitor Role[edit]

To verify PXPM_MON monitor role functionality, after running the "LinuxPXPM_MON" executable, initializing, and powering on the local device if necessary, first register for PXP monitor 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
PXPM>Initialize 1

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


[ 7414.955102] (hci_tty): inside hci_tty_open (ecc4d3c0, ecc57c80)
[ 7414.962542] (stc):  chnl_id list empty :4
[ 7414.966514] (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
[ 7415.129574] (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
[ 7415.143702] (stk) :TIInit_11.8.32.bts
uim:begin polling...
(stk) :change remote baud rate command in firmware
[ 7415.156567] (stk) :skipping the wait event of change remote baud[ 7415.909910] (stc): add_channel_to_table: id 4
[ 7415.914346] (stc): add_channel_to_table: id 2
[ 7415.918722] (stc): add_channel_to_table: id 3
BT COMM PORT (/dev/hci_tty): 1
DEVM_PowerOnDevice() Success: 0.
PXPM>
Device Powered On.
PXPM>
c) Now register for PXP client events.
PXPM>PXPRegisterMonitorEvents

PXPM_Register_Monitor_Event_Callback() Success: 1.
PXPM>
d) Connect with a simulated or an actual legitimate proximity remote device.
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
PXPM>ConnectWithRemoteDevice 0002723257F8 1

Attempting to Connect With (LE) Remote Device: 0002723257F8 (Flags = 0x80000000).
DEVM_ConnectWithRemoteDevice() Success: 0.
PXPM>
Remote Device Connection Status: 0002723257F8, 0 (SUCCESS)
PXPM>
Remote Device Properties Changed.
BD_ADDR:             0002723257F8
Address Type:        Public
LE Type:             Dual Mode
Device Flags:        0xC004B105
LE Connect State:    TRUE
PXPM>

PXPM Link Loss Alert:
   Bluetooth Address: 0002723257F8
   Connection Type:   Monitor
   Alert Level:       No Alert

PXPM>

PXPM Connected:
   Bluetooth Address: 0002723257F8
   Connection Type:   Monitor
   Link Loss Alert:   Supported
   Path Loss Alert:   Supported

PXPM>
e) Query the current path loss, which represents the remote device's transmit power level in decibels. The level ranges from -100 dBm to +20 dBm to a resolution of 1 dBm.

The Path Loss is calculated by subtracting the RSSI from the transmit power level of the Proximity Reporter, When the RSSI is greater than the TxPower, it means that we does not have any Path Loss, and the Path Loss value will be 0.

PXPM>PXPQueryCurrentPathLoss 0002723257F8

PXPM_Query_Current_Path_Loss() Success: 0, Path Loss = 59 dBm.
PXPM>
f) Set a new path loss threshold and receive path loss alert events at the current alert level.
PXPM>PXPSetPathLossThreshold 0002723257F8 58

Attempting to set Path Loss Threshold: 0002723257F8, 58.
PXPM_Set_Path_Loss_Threshold() Success: 0.
PXPM>

PXPM Path Loss Alert:
   Bluetooth Address: 0002723257F8
   Connection Type:   Monitor
   Alert Level:       Mild Alert

PXPM>
g) Set a new path loss alert level and receive path loss alert events at the newly specified alert level.
PXPM>PXPSetPathLossAlertLevel 0002723257F8 2

Attempting to set Path Loss Alert Level: 0002723257F8, High Alert.
PXPM_Set_Path_Loss_Alert_Level() Success: 0.
PXPM>

PXPM Path Loss Alert:
   Bluetooth Address: 0002723257F8
   Connection Type:   Monitor
   Alert Level:       High Alert

PXPM>
h) Disconnect the remote proximity device from the local device and receive link loss alerts at the current link loss alert level.
PXPM>DisconnectRemoteDevice 0002723257F8 1

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

PXPM Link Loss Alert:
   Bluetooth Address: 0002723257F8
   Connection Type:   Monitor
   Alert Level:       Mild Alert

PXPM>

PXPM Disconnected:
   Bluetooth Address: 0002723257F8
   Connection Type:   Monitor

PXPM>
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 PXPM 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 PXPM 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 PXPM 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 PXPM 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 PXPM 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 PXPM 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 PXPM 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 PXPM 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 PXPM 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