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 SPPM 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. The SPP sample application code is provided to enable a rich out-of-box experience to the user. The application allows the user to use a console to send Bluetooth commands, setup a Bluetooth Device to accept connections, connect to a remote Bluetooth device and communicate over Bluetooth.

For information of the LE version of this profile, refer to the document SPP-LE 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#

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

root@am335x-evm:~/BluetopiaPM/bin# ./SS1BTPM & ./LinuxSPPM
[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)PairWithRemoteDevice                       *
*                  23)CancelPairWithRemoteDevice                 *
*                  24)UnPairRemoteDevice                         *
*                  25)QueryRemoteDeviceServices                  *
*                  26)RegisterAuthentication                     *
*                  27)UnRegisterAuthentication                   *
*                  28)PINCodeResponse                            *
*                  29)PassKeyResponse                            *
*                  30)UserConfirmationResponse                   *
*                  31)ChangeSimplePairingParameters              *
*                  32)RegisterServerPort                         *
*                  33)OpenServerPortRequestResponse              *
*                  34)UnRegisterServerPort                       *
*                  35)OpenRemotePort                             *
*                  36)ClosePort                                  *
*                  37)ReadData                                   *
*                  38)WriteData                                  *
*                  39)SendLineStatus                             *
*                  40)SendPortStatus                             *
*                  41)QueryServerPresent                         *
*                  42)FindFreeServerPort                         *
*                  43)ChangeBufferSize                           *
*                  44)LoopbackMode                               *
*                  45)AutomaticReadMode                          *
*                  46)DisplayRawDataMode                         *
*                  47)EnableBluetoothDebug                       *
*                  Help, Quit.                                   *
******************************************************************




Demo Application[edit]

This section provides a description of how to use the demo application to connect two configured board and communicate over Bluetooth. Bluetooth SPP 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.



SPPM Client Role setup on the demo application[edit]

To verify the SPPM client role functionality, after running the "LinuxSPPM" executable, initialize, and power on the local device if necessary.
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
SPPM>Initialize 1

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


[ 2257.529043] (hci_tty): inside hci_tty_open (ecc473c0, eb913600)
[ 2257.536353] (stc):  chnl_id list empty :4
[ 2257.540322] (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
[ 2257.703329] (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
[ 2257.717649] (stk) :TIInit_11.8.32.bts
uim:begin polling...
(stk) :change remote baud rate command in firmware
[ 2257.730895] (stk) :skipping the wait event of change remote baud[ 2258.487476] (stc): add_channel_to_table: id 4
[ 2258.491904] (stc): add_channel_to_table: id 2
[ 2258.496280] (stc): add_channel_to_table: id 3
BT COMM PORT (/dev/hci_tty): 1
DEVM_PowerOnDevice() Success: 0.
SPPM>
Device Powered On.
SPPM>
c) Discover and identify remote device services.
SPPM>QueryRemoteDeviceServices 0002723257F8 1

Attempting Query Remote Device 0002723257F8 For Services.
DEVM_QueryRemoteDeviceServices() Success: 0, Total Number Service Bytes: 0.
SPPM>
Remote Device 0002723257F8 Services Status: BR/EDR, SUCCESS.
SPPM>
Remote Device Properties Changed.
BD_ADDR:      0002723257F8
Device Flags:  0xC000314D
Serv. Known  : TRUE
SPPM>
d) Open an SPP connection to the remote device.

NoteNote: The "1" below refers to the remote device's SPP port. This can be obtained by doing a remote SDP request.

SPPM>OpenRemotePort 0002723257F8 1

SPPM_OpenRemotePort(1) Success. Port Handle: 1.
SPPM>
Remote Device Properties Changed.
BD_ADDR:      0002723257F8
Device Flags:  0xC000314D
Connect State: TRUE
SPPM>
Remote Port Open Status.
    Port Handle: 1
    Status:      Remote Port Open Successful
SPPM>
Port Status Changed.
    Port Handle: 1
    Port Status:
       Mask:         0x00000003
       BreakSignal:  0
       BreakTimeout: 0
SPPM>
e) Write data to the remote device.
SPPM>WriteData 1 Testing123.Testing123

SPPM_WriteData Success: 21 bytes written.
SPPM>
f) Read data sent from the remote device.
SPPM>
Data Received.
    Port Handle: 1
    Data Length: 22
SPPM>ReadData

Usage: ReadData [Port Handle] [DataLength] [Timeout (optional)].
Function Error.
SPPM>ReadData 1 22

SPPM_ReadData(22) Success: 22 bytes read.
Data: 54 68 69 73 20 69 73 20 61 20 74 65 73 74 20 73 74 72 69 6E 67 2E
SPPM>
The user can set up an Automatic Read Mode with the application to help with bandwidth and reliability testing.
g) To set up automatic read mode enter the following command:
SPPM>AutomaticReadMode 1

Current Automatic Read Mode is: ACTIVE.
h) This allows the app to read data from the remote device as soon as it is recieved. It is possible to also display this data as soon as it is read.
SPPM>DisplayRawDataMode 1

Current Display Raw Data Mode set to: ACTIVE.

NoteNote: It is possible that display raw data mode may affect the bandwidth as the app does more processing with the data.

i) The user can also set up Loopback mode to allow full duplex data transfers with SPP. To enable Loopback mode enter the following command:
SPPM>LoopbackMode 1

Current Loopback Mode is: ACTIVE.

NoteNote: automatic read mode cannot be used when operating in Loopback Mode.

j) To disable each of these features enter the following commands:
SPPM>LoopbackMode 0

Current Loopback Mode is: INACTIVE.
SPPM>AutomaticReadMode 0

Current Automatic Read Mode is: INACTIVE.
SPPM>DisplayRawDataMode 0

Current Display Raw Data Mode set to: INACTIVE.
k) Disconnect the remote device from the local device.
SPPM>ClosePort 1

SPPM_ClosePort Success: 0.
SPPM>
Remote Device Properties Changed.
BD_ADDR:      0002723257F8
Device Flags:  0xC0003105
Connect State: FALSE
SPPM>

SPPM Server Role setup on the demo application[edit]

To verify SPPM server role functionality, after running the "LinuxSPPM" executable, initializing, and powering on the local device if necessary, first register an SPP server to the local device.
a) Initialize the profile by typing “1 1” or “Initialize 1”.
b) Powering up the Bluetooth device by typing “9 1” or Set “DevicePower 1”, if the device is already powered up you’ll receive an error that the device is already powered up
SPPM>Initialize 1

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


[ 2257.529043] (hci_tty): inside hci_tty_open (ecc473c0, eb913600)
[ 2257.536353] (stc):  chnl_id list empty :4
[ 2257.540322] (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
[ 2257.703329] (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
[ 2257.717649] (stk) :TIInit_11.8.32.bts
uim:begin polling...
(stk) :change remote baud rate command in firmware
[ 2257.730895] (stk) :skipping the wait event of change remote baud[ 2258.487476] (stc): add_channel_to_table: id 4
[ 2258.491904] (stc): add_channel_to_table: id 2
[ 2258.496280] (stc): add_channel_to_table: id 3
BT COMM PORT (/dev/hci_tty): 1
DEVM_PowerOnDevice() Success: 0.
SPPM>
Device Powered On.
SPPM>
c) Registering a server port

NoteNote: Use port Greater than 5, Ports 0-4 were opened during the initialization of the SS1BTPM .

SPPM>RegisterServerPort 5

SPPM_RegisterServerPort(5) Success. Port Handle: 1.
SPPM_RegisterServerPortServiceRecord Success. Record Handle: 65545 (0x00010009).
SPPM>
d) Query the local device to see if the created SPP server is present.
SPPM>QueryServerPresent

Usage: QueryServerPresent [Server Port].
Function Error.
SPPM>QueryServerPresent 5

SPPM_QueryServerPresent(0x00000005) Success: 0, TRUE.
SPPM>
e) Initiate an SPP connection from the remote device.
SPPM>
Remote Device Properties Changed.
BD_ADDR:      0002723257F8
Device Flags:  0xC000310D
Connect State: TRUE
SPPM>
Server Port Open.
    Port Handle:    1
    Remote Address: 0002723257F8
SPPM>
Port Status Changed.
    Port Handle: 1
    Port Status:
       Mask:         0x00000003
       BreakSignal:  0
       BreakTimeout: 0
SPPM>
f) Read data sent from the remote device.
SPPM>
Data Received.
    Port Handle: 1
    Data Length: 22
SPPM>ReadData 4 22

SPPM_ReadData(22) Success: 22 bytes read.
Data: 54 68 69 73 20 69 73 20 61 20 74 65 73 74 20 73 74 72 69 6E 67 2E
SPPM>
g) Write data to the remote device.
SPPM>WriteData 1 Testing123_Testing123

SPPM_WriteData Success: 21 bytes written.
SPPM>

The user can set up an Automatic Read Mode with the application to help with bandwidth and reliability testing.

h) To set up automatic read mode enter the following command:
SPPM>AutomaticReadMode 1

Current Automatic Read Mode is: ACTIVE.
i) This allows the app to read data from the remote device as soon as it is recieved. It is possible to also display this data as soon as it is read.
SPPM>DisplayRawDataMode 1

Current Display Raw Data Mode set to: ACTIVE.

NoteNote: It is possible that display raw data mode may affect the bandwidth as the app does more processing with the data.

j) The user can also set up Loopback mode to allow full duplex data transfers with SPP. To enable Loopback mode enter the following command:
SPPM>LoopbackMode 1

Current Loopback Mode is: ACTIVE.

NoteNote: Automatic read mode cannot be used when operating in Loopback Mode.

k) To disable each of these features enter the following commands:
SPPM>LoopbackMode 0

Current Loopback Mode is: INACTIVE.
SPPM>AutomaticReadMode 0

Current Automatic Read Mode is: INACTIVE.
SPPM>DisplayRawDataMode 0

Current Display Raw Data Mode set to: INACTIVE.
l) Disconnect the remote device from the local device.
SPPM>UnRegisterServerPort 1

SPPM_UnRegisterServerPort(1) Success: 0.
SPPM>
Remote Device Properties Changed.
BD_ADDR:      0002723257F8
Device Flags:  0xC0003105
Connect State: FALSE
SPPM>
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 SPPM 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 SPPM 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 SPPM 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 SPPM 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 SPPM 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 SPPM 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 SPPM 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 SPPM 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 SPPM 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