CS452 - Real-Time Programming - Fall 2010

Lecture 3 - I/O Devices

Pubilic Service Announcements

  1. Assignment 0 Deadline
  2. More about serial I/O: pdf

The Hardware

Provided and maintained by CSCF


`COM' ports

Connected to UARTs

Only really two

Ethernet port

Reset switch


System on chip


Byte addressable, word size 32 bits

Separate instruction and data caches

The Software


GNU tool chain


Partial implementation

Returns when program terminates

Busy-wait IO

COM2 uses monitor; COM1 goes to train

  1. initialization/configuration
  2. output
  3. input

For assignment 0 you need to increase the functionality.

Bug in one function

How Timers Work

Set them up

Start them counting

Whenever they count through zero they trigger an interrupt.

A better solution for this assignment

Read the documentation carefully.

Data Communication using RS-232

Communication protocol existing since forever.

Why do we still use it in the age of USB, etc.

When you get a brand new board

  1. Using JTAG
  2. Using the primitive loader and serial I/O
  3. Reset puts you into the boot loader

Serial Hardware: the Universal Asynchronous Receiver Transmitter (UART)

Really nothing but two shift registers

Also must

Finally there is a bus interface

Very simple RS-232

Three wires

Wired like this

GND ---------- GND

XMIT --\ /---- XMIT
RCV----/ \---- RCV

What could be simpler?

Less Simple RS-232

Distinguish Data Terminal Equipment (DTE) from Data Circuit-terminating Equipment (DCE)

On the DE-9 connector we have for DTE

5 -- GND
3 -- XMIT
2 -- RCV

and for DCE

5 -- GND
3 -- RCV
2 -- XMIT

A very simple `straight through' cable connects these perfectly. But when we conect DTE to DTE we need the cable above, which is called a `null modem'.

Train RS-232

Three wire works fine as long as both ends of the wire are much faster than the wire itself. But the train controller is very slow. Why?

The train controller needs to be able to say STOP, I can't take any more

Software Flow Control


Hardware Flow Control


What Happens if You Omit Flow Control

Return to: