[WLUG] Re: [Yaaarc] Binary serial upload?

Paul Haas paulh at hamjudo.com
Tue Jun 5 09:09:38 EDT 2007


On 6/5/07, Rick Green <rtg at aapsc.com> wrote:
> On Mon, 4 Jun 2007, Paul Haas wrote:
>
> > On 6/4/07, Rick Green <rtg at aapsc.com> wrote:
> >> Dear lazyweb:
> >>    Is there a terminal program for Linux which allows for the uploading of
> >> binary files directly, with no molesting or modification by a 'protocol'?
> >> Essentially, I'd like it to dd a file to the serial port upon command.
> >>
> >> Minicom has several upload protocols available, and its setup script seems
> >> to allow for the addition of others, but I've so far been unsuccessful in
> >> trying to declare 'cat' or 'dd' as the helper app...
> >
> > My serial port is /dev/ttyUSB0.  While minicom was running, I used
> > another window
> > and typed
> >  cat /home/paulh/junk > /dev/ttyUSB0
> > and the contents of /home/paulh/junk came out unmolested from the serial
> > port.
> > minicom's own "ASCII" transfer adds a <CR> after every <LF>, and I
> > haven't figured out how to turn that off.  I hate it when software
> > does me favors.
> >
> Thanks!  That's ugly, but it works.  It never occurred to me that I could
> write to a serial port from two processes without lock problems.
>    I'm still baffled why it doesn't work when I declare /bin/cat as a
> 'binary' option in minicom's config.
>    The manpage for ascii-xfr, which minicom uses for its dumb 'ASCII'
> transfers, has an option to suppress that CR-stuffing, but even when I
> define a 'binary' transfer as 'ascii-xfr' without cr-stuffing and
> EOF-appending, it somehow still scrambles it.
>    Anybody have a datascope?  Or know of a datascope application that will
> give me a 'hex dump' display of whatever is coming in the serial port?


Use a null modem cable to connect two serial ports together.

On the second serial port, use stty to set the baud rate and turn off
all of the goofy historic terminal modes.  stty reads or sets the
characteristics of the port connected to its standard input.  The
command
   man stty
will show you all the gory options to stty.  The stty command is older
than many people on this list.  It dates back to when you could first
change baud rates under software control on a PDP/11 running Unix.  So
the first version was written between 1971 and 1974. People have been
adding options to the command while trying to keep it compatible with
old shell scripts for about 35 years.

   stty -a < /dev/ttyUSB0
Shows how /dev/ttyUSB0 is set up.
   stty 19200 raw cs8  -parenb < /dev/ttyUSB1
will set ttyUSB1 to 19200 baud and "raw" mode, 8 bits, no parity.
    od -t x1 < /dev/ttyUSB1
Read characters from ttyUSB1 and print them in hexadecimal.

> --
> Rick Green
>
> "Those who would give up essential Liberty, to purchase a little
> temporary Safety, deserve neither Liberty nor Safety."
>                                    -Benjamin Franklin
>
>


More information about the Yaaarc mailing list