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.

CC256x Bluetopia Software Add-on: Multiple SPP Connections

From Texas Instruments Wiki
Jump to: navigation, search

Disclaimer[edit]

The app described here is deprecated and should not be used. The version of SPPLEDemo provided with the SDKs now supports multiple BR/EDR SPP connections and multiple BLE SPPLE connections by default. It has all of the features that were originally described here. This page is left online for legacy purposes only and will eventually be removed.

Sample Code[edit]

The file below is deprecated and multiple SPP support is included out of the box with SPPLEDemo in the latest Bluetopia Distribution. To download the code click the file below.
http://processors.wiki.ti.com/images/1/19/SPPLEDemo_MultipleConnections.zip

Memory Requirements and Link Key Settings[edit]

For using Multiple SPP servers, the memory on the device needs to be increased. To change the memory in IAR go to Project->Options->C/C++ Compiler->Preprocessor. In the list of defined symbols you will find BTPS_MEMORY_BUFFER_SIZE=3600.

You need to set this to a higher value depending on your requirements. For CCS, go to Project->Properites->Advanced options->Predefined Symbols to access the BTPS_MEMORY_BUFFER_SIZE

Also, MAX_SUPPORTED_LINK_KEYS in the demo file needs to be changed for the number of connections you are making.

To Accept connections from Multiple devices:[edit]

  • The application will have to open multiple servers.
  1. The sample application uses the function OpenServer to open a user defined maximum number of server ports (MAX_SPP_SERVERS in the sample code). Bluetooth BR/EDR has a maximum limit of 7 simultaneous connections as master (* explained further below) so this number should be less than 7. Also this is absolute maximum, there can be other factors restricting it to a number less than 7.

  • Once a remote device connects to a server successfully, the application will get a etPort_Open_Indication. At this time the remote device is the master if there was no role change. The local device is the slave. A Bluetooth device can be a slave in at most two piconets at the same time. This means to let more than two devices connect to the local servers, the local device needs to be the master for all these connections.
  1. To achieve this, the sample app sets a flag (MasterOfAll)
  2. When the flag is set, the sample application initiates a role switch to become the master in etPort_Open_Indication by calling HCI_Switch_Role with HCI_ROLE_SWITCH_BECOME_MASTER.

  • Once the application is the master to all the incoming connections, the only thing to do is maintain a context for all the different connections by using the connectionID for the individual connections. This will be used for writing to or reading from or closing different remote devices. The sample application uses a SPP_Server_Info_t structure to maintain this context. This is implementation dependent and there is no recommended way for the same. The sample application just gives an example.

To Connect out to multiple devices using SPP[edit]

Although the sample application does not have the code to do this, this is very similar to the above.

  • Perform an Inquiry, find the remote server port number using SDP and connect to the remote device.

  • The local device is the master as it is initiating the connection.

  • In case there is a role switch triggered by the remote device during the connection process, perform HCI_Role_Switch to become the master in etPort_Open_Confirmation (code in sample application)

  • Save the Connection handles returned by SPP_Open_Remote_Port to read from, write to or close this remote device connection. This is implementation dependent.

Example connection using Blueterm[edit]

We will demonstrate multiple SPP connections using Blueterm. Blueterm is an app that can be used to connect an Android device to the SPPDemo. For more about the app refer to BlueTerm-Google Play . Note: The app requires Android V2.1 and above

SPP Connection
[edit]

a) Open the number of ports required on the MSP430. If we are making two connections, open 2 ports using Open 1 twice.

MultipleSPP1-SS1



b) To connect to the device, open blueterm, press the menu button and hit connect to device.

MultipleSPP4-SS1



c) The app should show a list of paired devices. If the device is not already paired, select scan. It should search for available bluetooth devices.

MultipleSPP4-SS1



d) Select and Pair it with the device running the SPPdemo. If it needs a pincode enter a pincode on the app/phone. The MSP430 will prompt for a PINCodeResponse. Type PINCodeResponse <the pin code you used for the phone> in the prompt. It will pair and you should see an open indication and a Initiating role switch message on the MSP430.

MultipleSPP2-SS1



e) The two devices are now connected. Data can be sent/received from the two devices as shown here.

MultipleSPP3-SS1



MultipleSPP5-SS1



f) Follow the same steps with another phone running Blueterm to connect the second device to the MSP430.

Note: If you are having difficulty connecting to the sppdemo, first pair with the device under bluetooth settings and then select the device from the list of paired devices when you select connect device in blueterm.

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 CC256x Bluetopia Software Add-on: Multiple SPP Connections 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 CC256x Bluetopia Software Add-on: Multiple SPP Connections here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article CC256x Bluetopia Software Add-on: Multiple SPP Connections here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article CC256x Bluetopia Software Add-on: Multiple SPP Connections here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article CC256x Bluetopia Software Add-on: Multiple SPP Connections here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC256x Bluetopia Software Add-on: Multiple SPP Connections here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article CC256x Bluetopia Software Add-on: Multiple SPP Connections here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article CC256x Bluetopia Software Add-on: Multiple SPP Connections here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article CC256x Bluetopia Software Add-on: Multiple SPP Connections 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