Collecting GPS serial string data

Setting up the DOR Driver to utilize GPS time strings, and external clock oscillator

For the following discussion, assume the bash shell, unless otherwise indicated

To interrogate the clock mode, issue the command
$ cat /proc/driver/domhub/card*/clksel

To enter the external clock mode for all installed DOR cards, issue these two commands

$ for dor in /proc/driver/domhub/card*; do echo 'external' > ${dor}/clksel; done
$ for dor in /proc/driver/domhub/card*; do echo 'reload 1' > ${dor}/fpga; done

If you only want to control one card, then, instead,  use 

$ echo 'external' > /proc/driver/domhub/card0/clksel ;  echo 'reload 1' > /proc/driver/domhub/card0/fpga

To enter the internal clock: mode, issue the command

$ for dor in /proc/driver/domhub/card*; do echo 'internal' > ${dor}/clksel; done
$ for dor in /proc/driver/domhub/card*; do echo 'reload 1' > ${dor}/fpga; done

If you only want to control one card, then, instead, use   

$ echo 'internal' > /proc/driver/domhub/card0/clksel; echo 'reload 1' > /proc/driver/domhub/card0/fpga

Collecting Time String Data from the Driver

To deliver readings directly to the screen (regardless of shell) use

$ readgps /proc/driver/domhub/card0/syncgps

To log time output from a particular DOR card to a file, if using a tcsh shell, use

$ readgps -d /proc/driver/domhub/card3/syncgps >& capture.txt

or, if using a bash shell

$ readgps -d /proc/driver/domhub/card3/syncgps 2>&1 > capture.txt

To log time output from all DOR cards to a file, use

$ for dor in /proc/driver/domhub/card*; do   readgps -d ${dor}/syncgps 2> ${HOSTNAME}-DOR`echo ${dor} | sed 's/^.*card//1'`.txt & done

Collecting Time Strings from the Serial Port

Setting up the DOM Hub communications ports

Make sure the serial interface connector strip is installed adjacent to the CPU end strip.
The two 10 pin headers for the serial ports are below the pair of IDE disk drive cables. The one nearest the front is the higher numbered comm port. the one nearer the back, adjacent to the USB connector, is the lower numbered comm port.

It is possible that the lowere numbered serial port will come up as /dev/ttyS0 (/dev/ttyS1).  The higher numbered comm port will be /dev/ttyS1 (/dev/ttyS2) depending on bios settings.

Check the protections on the serial port devices, and if they are not user readable, then,  to make them accessable to the ordinary, non-privileged, user,  by chaning the protection with
$ chmod 666 /dev/ttyS0 ; chmod 666 /dev/ttyS1 ; chmod 666 /dev/ttyS2
(all three in order order to cover all the bases.)

Setting up Minicom to listen to GPS Clock Serial data on the COM port

Edit the /etc/minicom.dfl to add the following line:
pu baudrate 9600

Capturing data using minicom

For help use the <Ctrl-A> z command.
Enter a <Ctrl-A>  character to gain access to special minicom features.
Enter a <Ctrl-A>  followed by an L to start 'logging' data to the indicated file name.
Enter a <Ctrl-A>  followed by an L to  terminate logging.

Using minicom to log from the serial port

To launch the terminal emulator program, execute the command
$ minicom

Using cat to log from the serial port

Logging using the cat command depends on previously having set up port /dev/ttyS1 using minicom
$ cat /dev/ttyS1 > capture_file.txt
The capture file will contain extra line feeds, and will not be searchable using grep, because grep conisiders it to be a binary file. See hints on processing below.

Useful scripts

Script useful for mapping out the forbidden timing regions.  The script pops a separate Xll terminal window running readgps on the desired DOR card.
watch script
Usage:
Log into the DOM Hub of choice via the console, or via the network (if network, make sure to enable X forwarding).
Set up the oscilloscope to monitor relative timing.
execute the command
$ ./watch
Comments:
All the windows must be closed before new windows can be reopened.

Script for launching readgps on all installed DOR modules in the DOM Hub
loggps script
Usage:
Log into the DOM Hub of choice via the console or via the network.
cd to the desired logging directory.
execute the command
$ ./loggps
Comments
You may log out. The processes launched by the script continue to collect data as detached processes. The processes may be stopped by the kill command.  Use ps to identify the process ID numbers of the processes executing readgps.

Parsing and Scanning

This one-line shell command shows all the lines in the text file that don't match the regex. It's for processing the output of the serial-port data capture. It is still theoretically possible that the bad character '^' could be not caught in the time string, but not very likely as it is different by 6 bits...

$ cat capture_file.txt | tr '\001' '^' | egrep -v '^\^[0-9]{3}:[0-9]{2}:[0-9]{2}:[0-9]{2}[ \.\?]$'

This works by translating the \001 characters into '^' and then matching against the regex; the translation is necessary because grep and egrep consider files that begin with non-printable characters to be binary data, not text.

Stripping out blank lines with sed, and other tricks

Execute the command
$ sed -e '/^$/d' capture_file.txt
The results are written to standard output.
To subsequently extract a range of times,  try (substituting your own range tring expression into grep)
$ sed -e '/^$/d' capture_file.txt | grep '099:10:33:2.*'  > results
which writes the result to a file named results.    The results file contains leading special <SOH> character, and trailing quality character.

Troubleshooting

To interrogate the status of the software and firmware load, use the command

$ fvers

The file /usr/local/bin/fvers.pl may or may not be linked to fvers.
If  both the pci and fw item are zero, then, either the DOR requires a firmware reload, or possibly reprogramming via JTAG.  Consult an expert, like Kalle, or Arthur.