Controlling Target board pins from a Parallel Port

This page describes a module which can control (turn on or off) up to 4 switches on target board using the parallel port on a standard PC.

How to use the module (overview)

Building the Module

The module is very simple, essentially just consisting of a single board which uses optical isolators to use the data bit from the parallel cable to control the switch status of the PINs connected on the other side.

Circuit Diagram: circuit_diagram.gif

How to connect the module to the PC and the target

See the diagrams below for pictures of how to connect the module to the PC and to the target board switches.

Basically, it is very simple:

RemoteResetFig0.jpg

RemoteResetFig1.jpg

RemoteResetFig2.jpg

Fig 0 - attach module to PC parallel port

Fig 1 - Attach switch headers to target board switch pins

Fig 2 The control module (switch order: 4th 3rd 2nd 1st)

How to control the module with software

The program 'paraport' can be used to control the data signals on the parallel port on the PC.

It can be downlaoded from here: paraport.c

Building and installing 'paraport'

The program can be compiled with: {{{gcc paraport.c -o paraport }}}

/!\ Note that in order to control the I/O ports for the parallel port, the program must be run as root. It is easiest to make it setuid root, so that an ordinary user can run it without having to login as root.

Also the program should be installed somewhere in the user's PATH (usually /usr/local/bin).

This can be done as follows: {{{<become root> chown root paraport chmod u+s paraport cp paraport /usr/local/bin }}}

Running 'paraport'

This program is simple and accepts one argument, which specifies the switches to turn on and off. The bits in the argument stand for each corresponding switch.

For instance,

% paraport 1      "Push the 1st. switch, release others"
% paraport 2      "Push the 2nd. switch, release others"
% paraport 4      "Push the 3rd. switch, release others"
% paraport 8      "Push the 4th. switch, release others"
% paraport 0      "Release all switches"

On many boards, switches are edge-triggered. For instance, to reset the board, you have to push down the reset switch then release it.

If you connect the 1st connector to the reset switch PIN on the target, you can reset the target with following procedure;

% paraport 1
% usleep 1000
% paraport 0

Sample scripts

Here are sample scripts which control the power and reset on an IBM Ebony (PowerPC 440) board: Note that switch 1 is connected to the Ebony reset switch pins, and switch 2 is connected to the Ebony power switch pins.

Script to "press and release" the reset button on the board:

ebony-reset.sh:

paraport 1
sleep 1
paraport 0

Toggle the power switch on the board:

ebony-power.sh:

paraport 0
sleep 1
paraport 2
sleep 1
paraport 0

The following script will make sure the power is removed and restored to the board. (This performs a complete power cycle, making sure the board is on independent of whether the power was on or off to start with.)

ebony-power-cycle.sh:

paraport 0
sleep 1
paraport 2
sleep 1
paraport 0

sleep 2

paraport 2
sleep 1
paraport 0

TargetSwitchControlFromParallelPort (last edited 2008-05-07 18:22:02 by localhost)