RS232 Communication through PAL and PSL

Article Number: ADS-000530

Date: 01 Dec 2006

Summary

This article is concerned with communication between a terminal and a PAL supported board via the serial RS232 connector.

The example available for download connects to a PC using windows HyperTerminal.

Details

The PAL RS232 library contains functions to write and read data to and from an external device via a standard 9-pin serial port.

The code in the download section demonstrates communication between any board which supports the PAL architecture and any device with a read and write serial port.

PAL is designed to run at a baud rate of 115,200bps, so it is important to have the external device set to this baud rate.  If a different baud rate is required, a board-specific PSL call must be made.  For an RC200, this is of the form:

RC200RC232Run (baud rate, parity, flow control, clock rate);

In the attached example, this line is selected by setting the #define USE_115200_BAUD to 0.  Setting #define USE_115200_BAUD to 1 calls the PAL function PALDataPortRun(), which always sets a baud rate of 115,200bps.

Note that using a PSL function makes the design platform dependent.

Running the Example Workspace

  1. Follow the Download and Install sections below.
  2. Load RS232.hw into the DK Design Suite.
  3. Click on Build --> Build (or press F7) and wait for the build process to create a .bit file. 
  4. Use FTU2 from the Platform Developer's Kit to download the .bit file to your board.

Setting up HyperTerminal

  1. Connect a null-modem cable from your Agility board to your external device, e.g. The COM1 port on your PC.
  2. Load HyperTerminal.  The default location in the start menu is Accessories -->Communication-->  HyperTerminal.
  3. Type a name for your new connection, e.g. Serial Communication, and click on OK.
  4. Select the connection port, e.g. COM1, and click on OK.
  5. In the port properties window, if you are using the PALDataPortRun() function (the default in the example), select baud rate 115,200, data bits 8, parity none, stop bits 1 and flow control hardware.  Click on OK.

This should now connect to your board.  The PAL Console will load onto a monitor connected to the video out port of your Agility board and key presses from the PC should appear on the console.  HyperTerminal should display the message 'hello' over and over again, as this is being transmitted one character every quarter of a second from the board.

Download Instructions

Click on the link below. You will then be sent to a page where you can download the software.

Installation Instructions

Unzip the downloaded file into a local folder.

Support Terms

This object and source code is not supported.

Downloads

Topic Areas