Serial Port Configuration

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I've got a problem with serial port config.  Basically the problem is
this: we run a linux box as a cash register.  Connected to the cash
register via serial ports are a customer display (just a panel full of
LEDs that can spell out text) and receipt printer, a scanner/scale
unit and an EFTPOS pin pad (not sure if its called EFTPOS outside of
Australia - it's the thing you swipe your credit card through when not
paying cash).

One of the more common problems with these registers is that the
EFTPOS stops working, and the most common cause of this is that the
serial port the EFTPOS attaches to has blown up.  However, its
expensive to fix, and we have to run all kinds of tests to rule
everything else out.

So what we want to do is to be able to take the customer display out
of its serial port and plug it into the EFTPOS serial port, and send
some text to it.

But, it doesn't work.

We can plug the customer display into the receipt printer serial port
and it works fine (and vice versa), and we can plug it into the
scanner/scale serial port and it will print garbage (although it has
the right number of characters, it just looks like a garbage alphabet
is mapped to the output).  But in the EFTPOS port, nothing prints out.

I have a feeling that this is a really dumb question that I really
should know the answer to.  But then again, I work in an office with
five other guys, all with tertiary education in computing and more
field experience than me, and none of them know either.  But it really
would be useful to know how to configure the port to send text to the
customer display, then reconfigure it back to talk to the EFTPOS
device once the test is done.



Re: Serial Port Configuration

Quoted text here. Click to load it
Replace the Serial port/s

Re: Serial Port Configuration wrote:
Quoted text here. Click to load it

Serial ports have a baud rate. A baud rate mismatch, will either cause
garbage characters, or a complete lack of response, depending on whether
the baud rate is too high or too low.

Something like:

    setserial -g -a /dev/ttyS0

will display the baud rate of COM1. Note that the capitalization of the
letter "S" in the device name is important. ttys0 won't work.

The rest of the device config information, such as number of bits,
whether parity is even or odd, and how many stop bits to use, is
controlled by "stty". stty is complicated, and the above FAQ page
has a list of parameters relevant to a serial port.

This command might list all the parameters of COM1. The -F is used
to select the port, and the -a says list all the parameters used.

    stty -F /dev/ttyS0 -a

The FAQ page gives an example of using the stty command

    "The next example combines some of these flags and sets the ttyS0
     device to 19,200 bps, 8 data bits, no parity, and hardware handshaking
     with echo disabled:

     stty 19200 cs8 -parenb crtscts -echo -F /dev/ttyS0             "

Between those commands and the FAQ page, you should be able to
figure it out. My guess would be, that the EFTPOS runs at a lower
baud rate than the others.


Site Timeline