Subject: Re: setting up serial port for GPS NTP source
To: Danny Thomas <D.Thomas@imb.uq.edu.au>
From: Roger Brooks <R.S.Brooks@liverpool.ac.uk>
List: netbsd-help
Date: 08/23/2000 12:39:52
On Wed, 23 Aug 2000, Danny Thomas wrote:

>I'm finally trying to hook up my GPS receiver. I've tested it by booting my
>PC from a DOS floppy and using a simple terminal. The serial stream reports
>the GPS consistently receiving 6-9 satellites at adequate strength, and I
>can also use the terminal to reconfigure the Garmin GPS25LVS module.
>
>So at least the antenna, cable, GPS and connector cables are working, but
>before hooking up the PPS signal and using the generic NMEA driver in ntp4,
>I want to make sure the serial port is properly working. This may not be
>strictly necessary since the NMEA driver does it's own serial setup, but
>I'm also considering using a separate perl script to talk to the GPS.
>Unfortunately my cluelessness intrudes.
>
>1) the MSDOS terminal works using COM2 so that meant /dev/tty01 ?
>
>2) I tried changing the speed of the com port without success
>     www2# stty -f /dev/tty01 speed 4800
>     9600                               <= should it echo this?
>     www2# stty -f /dev/tty01
>     ispeed 0 baud; ospeed 9600 baud;   <= still 9600
>     lflags: echoe echoke echoctl
>     oflags: onocr onlret
>     cflags: cs8 -parenb
>  is that the right way? but why isn't the change at least being reported
>  or coming into effect? I've tried changing other parameters too.
>  NB I've tried this single user, and tried relaxing permissions
>     www2# ls -l /dev/tty0*
>     crw-------  1 uucp  wheel  8, 0 May 20 12:50 /dev/tty00
>     crwxrwxrwx  1 uucp  wheel  8, 1 May 20 12:50 /dev/tty01

This won't work, because on each open of a tty port the driver resets
everything to default values <sys/ttydefaults.h>.  So what you have just
set with stty is discarded when you open the port again with cat.  The
usual way to do this is in a subshell with stdin redirected

    (stty 4800 ; cat )< /dev/tty01

Roger

------------------------------------------------------------------------------
Roger Brooks (Systems Programmer),          |  Email: R.S.Brooks@liv.ac.uk
Computing Services Dept,                    |  Tel:   +44 151 794 4441
The University of Liverpool,                |  Fax:   +44 151 794 4442
PO Box 147, Liverpool L69 3BX, UK           | 
------------------------------------------------------------------------------