spp
Overview
Application demonstrating how to use the SPP feature.
Prepare the Demo
Open example’s project and build it.
Connect a USB cable between the PC host and the OpenSDA USB port on the target board.
Provide 5V voltage for the target board.
Open a serial terminal on PC for OpenSDA serial device with these settings:
115200 baud rate
8 data bits
No parity
One stop bit
No flow control
Download the program to the target board.
Either press the reset button on your board or launch the debugger in your IDE to begin running the example.
Running the demo
The log below shows the output of the example in the terminal window.
Bluetooth initialized
BR/EDR set connectable and discoverable done
Copyright 2020 NXP
>>
Procedure to run SPP server
input “help” to show command list
input “spp register 3” to register spp server channel 3, wait for spp connection
After spp connection on channel 3 is created, input “spp send [1|2|3|4]” to send data
After peer device send “spp set_pn client 3”, input “spp get_pn server 3” to test pn command
After peer device send “spp set_port client 5”, input “spp register 5” to register spp server channel 5 and wait for spp connection
After spp connection on channel 5 is created, input “spp get_port server 5” to test remote port negotiation command after spp connection is created
input “spp handle” to show current active spp handle
input “spp switch 0” to select the first spp handle
input “spp disconnect” to disconnect with peer device
Procedure to run SPP client
input “bt discover” to discover connctable bluetooth device
input “bt connect [index]” to create basic bluetooth connection with the discovered device
input “spp discover” to discover registered spp server channel in peer device
input “spp connect 3” to create spp connection on channel 3 with peer device
After spp connection on channel 3 is created, input “spp send [1|2|3|4]” to send data
After spp connection on channel 3 is created, input “spp send_rls” to test remote line status command
After spp connection on channel 3 is created, input “spp send_msc” to test modem status command
After spp connection on channel 3 is created, input “spp set_pn client 3” to test parameter command
input “spp get_port client 5” to test remote port negotiation command before spp connection on channel 5 is created
input “spp set_port client 5” to test remote port negotiation command before spp connection on channel 5 is created
input “spp connect 5” to create spp connection on channel 5 with peer device
input “spp get_port client 5” to test remote port negotiation command after spp connection on channel 5 is created