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 Beginners Guide

From Texas Instruments Wiki
Jump to: navigation, search

Return to CC256x Main Wiki

CC256x Beginners Guide walks you step-by-step through the SPP demo which is one of many demo and sample applications available.


Demo Overview[edit]

This demo allows users to evaluate TI's CC256x Bluetooth device by using the PAN1323EMK and the MSP-EXP430F5438 board/ Tiva DK-TM4C129X. 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:

  1. Send Bluetooth commands
  2. Setup a Bluetooth Device to accept connections
  3. Connect to a remote Bluetooth device
  4. 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 MSP-430 or Getting Started Guide for Tiva C pages before trying the application described on this page.

Running the Bluetooth Code[edit]

Once the code is flashed, connect the board to a PC using a miniUSB to USB cable. Once connected, wait for the driver to install. It will show up as MXP-EXP430F5438 USB - Serial Port(COM x) under Ports(COM & LPT) or Tiva Virtual COM Port(COM x) under Ports(COM & LPT)in the Device manager. Attach a Terminal program like Tera Term to the serial port (COM x) for the board. The serial parameters to use are 115200 Baud, 8,N,1 and no flow control. Once connected, reset the device using Reset (S3 button for MXP-EXP430F5438) and you should see the stack getting initialized on the terminal.

Initial Screen of SPPDemo application



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.



Server setup on the demo application[edit]

a) We will setup the first board as a server. Perform the steps mentioned earlier in "Running the Bluetooth Code" section to initialize the application. Once initialized, note the Bluetooth address of the server. We will later use this to initiate a connection from the client.
b) On the "Choose mode>" prompt, enter "Server".
c) You will see a list of all possible commands at this time for a server. You can see this list at any time by entering "Help" at the Server> prompt.
d) Now we are ready to open a server. To open a server, at the "Server>" prompt, enter "Open 1". You can replace 1 with any number between 1 and 30, as long as there is no server open on that port. Once you see "Server opened: 1", you have a SPP server open on port 1.
Server Setup



Client setup and device discovery on the demo application[edit]

e) We will setup the second board as a client. Perform the steps mentioned earlier in "Running the Bluetooth Code" section to initialize the application. On the "Choose mode>" prompt, enter "Client".
f) You will see a list of all possible commands at this time for a Client. You can see this list at any time by entering "Help" at the Client> prompt.
g) At the "Client>" prompt, enter "Inquiry". This will initiate the Inquiry process. Once it is complete, you will get a list of all discovered devices.
h) You can access this list any time by choosing "DisplayInquiryList" at the Client prompt.
Client Setup



Initiating connection from the client[edit]

i)Note the index number of the first board that was configured as a server. [If the list is not on the screen, issue "DisplayInquiryList" command on the client to display the list of discovered devices again. ]
j) Issue a "Open <index number> <server port number>" command at the command prompt.
k) Wait for SPP Open confirmation.
l) When a client successfully connects to a server, the server will see the open indication.
Client Connection


Server Connection


Data Transfer between Client and Server[edit]

m) Now we have a SPP connection established and both devices are ready to transmit data to each other.
n) On Client or Server you can send some data to the remote side by issuing a "Write" command. This command sends a hardcoded test string to the other side.
o) The remote side will receive a data indication
p) The user can read the data by issuing a "Read" command.
q) The connection can be closed on either side by issuing the close command. In the example the client closes the connection and the server receives a close indication.
Client Connection and Data Transfer
Server Connection and Data Transfer


Note: In the shipped SPP application that is a part of the SPP/SPPLE application , using the write command sends 76 bytes to the other device. It is not possible for the sender to send all 76 bytes at once because of the limitations on buffers that are smaller to reduce RAM usage. So the code sends 31 bytes and waits until the other side is ready to receive more. The other side will not be ready until it reads the sent data by calling a "read" operation. So the idea is to call Read whenever the receiver receives an SPP Data Indication and all data that was sent will be read.

An example communication

Client Side:

SPP+LE>write

Wrote: 76.


SPP+LE>

Transmit Buffer Empty Indication, ID: 0x0001


Server Side (Receiving Data):

SPP+LE>

SPP Data Indication, ID: 0x0001, Length: 0x0026.


SPP+LE>read

Read: 31.

Message: ~!@#$%^&*()_+`1234567890-=:;"'<

Read: 7.

Message: >?,./@A

Read: 0.


SPP+LE>

SPP Data Indication, ID: 0x0001, Length: 0x0026.


SPP+LE>read

Read: 31.

Message: BCDEFGHIJKLMNOPQRSTUVWXYZ[\]`ab

Read: 7.

Message: cdefghi

Read: 0.


So we have:


31+31+7+7=76.

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 Beginners Guide 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 Beginners Guide here.

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