EZ430 Chat

From Texas Instruments Wiki
Jump to: navigation, search

This report details how to set up peer-to-peer, full-duplex, wireless chat using the EZ430-RF2500 development kit. The software is included and is based on TI’s SimpliciTI stack, used to control wireless communication with the on-board CC2500 radio. This report discusses all necessary hardware & software components required, as well as the topology and theory associated with this wireless network.

Written by: Brandon Elliott

Verifier: Harman Grewal

Introduction

In this report the term “wireless chat” refers to an informal ASCII text-based instant message relay between two people only. The communication is asynchronous and full-duplex.

The EZ430-RF2500 kit is the primary hardware element used for this report. The EZ430-RF2500 is a development kit that leverages the ultra-low power MSP430F2274 microcontroller to control the 2.4GHz CC2500 radio to establish basic wireless networks with minimal power requirements. The two IC’s interface via SPI and there is an antenna on-board which allows connectivity with no additional hardware components required. For more information on the EZ430 See the kit’s User’s Guide (SLAU227).

Figure 1: Basic Setup

EZ-chat.jpg

The setup to establish wireless chat requires two PCs with Windows Hyperterminal (or an equivalent program), each with an EZ430-RF2500 kit (1 EZ430U emulator and 1 target board) connected with the USB drivers installed. See the below image. Messages are transmitted by Hyperterminal sending 8-bit ASCII characters through the EZ430U’s backchannel UART at 9600 baud. Once a character is received by the MSP430 through the USB connection it will configure the on-board radio to transmit the character wirelessly to the other peer.

Hardware setup

For each PC the EZ430 drivers need to be installed. To install the drivers you need:

  • A Windows XP or Vista (32-bit only) machine with an available USB port
  • A Development Environment installed such as IAR (as this report uses)
  • The EZ430U Emulator plugged into the PC
  • The target board plugged into the emulator (when it is time to load the code to the MSP430)


Driver Install Process: See the Hardware Installation Guide of the FET User’s Guide (SLAU138)

Setting up Hyperterminal A COM port is established once the EZ430U’s drivers are installed. To determine the COM port number you need to look for the MSP430 Application UART (COMxx) entry in the Ports (COM & LPT) category of your PC’s Device Manager (see figure 2).

Figure 2: COM Port

Device manager ez.jpg

When configuring Hyperterminal the connection needs to connect using the COM port # associated with the MSP430. For the PC with the Device Manager shown in Figure 2 “COM43” should be chosen. The Port Settings should be set to 9600 baud, 8 data bits, 1 stop bit, no parity and no flow control.

Software

SimpliciTI

  • SimpliciTI is is a low-power RF protocol aimed at simple, small RF networks. It is a software stack used by the MSP430 that enables the use of simple commands to control the state of the chipcon radio (CC2500). This report uses version 1.1.0 of SimpliciTI. It is based on the simple bi-directional 2 end device demo that comes with the download, so the topology is extremely similar.

Brief synopsis of how the demo works, from the SimpliciTI documentation (SWRA243):

"In this example, there are two End-Devices, a Listener and a Talker, that establish a direct peer-to-peer connection. Initially, the Listener (ED2 in the diagram below) waits for a link message, and the Talker (ED1) sends the link message. After a connection has been established, the Talker periodically sends a 2-byte message to the Listener, which then sends a 2-byte reply to the Talker. The connection is actually bi-directional but the initial connection negotiation assigns the roles of Talker and Listener."

Figure 3: Topology

EZ-chat topology.jpg

Important Changes to the Demo Application

First and foremost, this example is not truly "full-duplex". The CC2500 radio can only do one task at a time. It cannot send and receive at the exact same time. Despite this limitation the tasks are so quick that full-duplex communication is emulated.

Another important change is the interrupt-driven backchannel UART is enabled (USCI channel A0). Since the MSP430's internal DCO is configured to 8MHz the baud rate settings are calculated based on that clock source.

The only changes basically involve the top-level application file for the "link to" and "linklisten" master files.

Main Function (main)

A message is displayed to press a key to connect. When a button is pressed thene the network formation (linkTo or linkFrom) function runs and forms the P2P connection.

Network Formation (linkTo, linkFrom)

The formation of the network is exactly the same as the demo. When the network is established a message is displayed indicated you are connected to the other peer.

TX / RX Main Loop

This is a never ending loop contained in the linkTo (or linkFrom) function. As with the original demo application, the code uses the callback handler to check for a Semaphore. In the Main Loop the Semaphore is continually polled and a character is displayed as it arrives. The transmission function is called from the mainloop. A transmission will occur if a return is pressed ("0x0D") or if the character string is longer than 35 characters. In an application like this receiving should take precedence over Transmission.

With each transmission, the transmitter's name is sent to the other peer and displayed prior to the message. When you type a message your name is echoed, then the characters are echoed on your screen.

Limitations

As stated before, the transmission is not literally "full-duplex" but also the EZ430U backchannel UART is limited to 9600 Baud.

Potential Enhancements

There could be a funtion added to include a customized name. As this code stands you must change the "name" array to your particular name.

A GUI could be developed to increase ease-of-use and to help formatting and general asthetics of the interface. The transmission is text only and no emoticons or hyperlinks can be done. This is a limitation of Hyperterminal.

Shortcut commands could be added to give timestamp information and PER (when applicable).


To establish a packet-error rate the newest send command can be used (SMPL _SendOpt(linkID_t lid, uint8 *msg, uint8 len, uint8 opt) instead of SMPL _Send(linkID_t lid, uint8 *msg, uint8 len)) which uses the opt bitmap to add different features for the transmission, such as implementing an ACK (parameter SMPL_TXOPTION_ACKREQ). This will tell the program to request an acknowledgement from the peer and the return status of the SMPL_SendOpt can be checked to determine transmission success. If no acknowledgment is received then the program can perform error checking or implement a resend routine. For more information on these features see the SimpliciTI API guide, most notably page 13.

Conclusion

This document has shown how to establish full-duplex wireless chat with the EZ430-RF2500 while connected to a PC with Windows Hyperterminal. The setup involves establishing a backchannel UART with the host PC, enabling and controlling the CC2500 radio via the MSP430 using the SimpliciTI stack, and typing characters on the terminal window.

References

  • EZ430-RF2500 (slau227)
  • FET User’s Guide (SLAU138)
  • SimpliciTI Sample Application User's Guide(SWRA243 Version 1.0), pp 21 - 23
  • SimpliciTI Application Programming Interface, SWRA221, pp 13
  • The Code is Here: File:EZ-chat.zip