This README describes version 0.2 of the serial logic analyzer suite, written in 1999 by Terran Melconian The serial-la suite are a set of programs designed to use the four status lines on a serial port as a sort of "logic analyzer". Programs are also provided to decode the data as RS232 of an unknown nature (assuming you've connected the data pin to one of the status pins). This is a short instruction reference for the programs. Giving any program the -h (help) option will cause it to print a brief summary of its options and their arguments. ** LASAMPLE ** lasample is the program which actually reads data from the serial port and writes it to a file. It is quite simple, and has only two options. One is the address of the serial port (-a), which defaults to 0x3e8, the first serial port. The second is the number of ticks (-t) to sample for. One tick is 1/100 of a second, and there is a compiled-in maximum of 1000 ticks. The default is two ticks. The output of lasample, which should usually be redirected to a file, looks like: 1 0 0 1 75 10 1 573 0 1 1077 10 1 1577 0 1 2078 10 1 2579 0 1 3082 10 1 3580 0 1 4083 10 1 4584 0 1 5087 10 1 5585 0 1 6088 10 1 6589 0 1 7089 10 1 7590 0 1 8093 10 1 8591 0 1 9094 10 1 9595 0 2 10000 0 2 10085 10 2 10583 0 0 0 0 The first number is the number of ticks. It servers no purpose, and is present for historical reasons. The second number is the time in milliseconds. The third number is the current state of the signal lines. The upper four bits are used, and represent CTS, DSR, RI, and DCD (with CTS low). The last line of all zeros indicates the termination of the data file (only the tick being zero is actually required/used). ** LACHART ** lachart produces a text bar chart of the signals. It has three options. -u tells it how many microseconds to display per line, defaulting to 10. If there is more than one transition between lines, a warning will be printed that aliasing is occurring and you should use a smaller value. -I n m sets the interval to be displayed from n to m microseconds; -i does the same using milliseconds for convenience. The output, which is fairly straightforward, looks like this: uSec CTS DSR RI DCD 0 | | | | 50 | | | | 100 | | | | 150 | | | | 200 | | | | 250 | | | | 300 | | | | 350 | | | | 400 | | | | 450 | | | | 500 | | | | 550 | | | | 600 | | | | 650 | | | | 700 | | | | 750 | | | | 800 | | | | ** LARS232 ** In some sense the flagship of the LA suite, lars232 determines timing, word size, and parity information for any RS232 data which is recorded using one of the status pins on the port. This allows for rapid and fairly reliable determination of the parameters of an unknown signal, without resorting to trial-and-error methods. The -s option selects which signal pin to look at, defaulting to CTS. The -v option produces verbose output. Lines which are indented one space are printed only with verbose output enabled: Logic Analyzer RS232 Timer version 0.2 Total of 2252 transitions on indicated line. Shortest transition 4 microseconds. 0 segments within 10% of this. Shortest transition 12 microseconds. 1 segments within 10% of this. Shortest transition 67 microseconds. 3 segments within 10% of this. Shortest transition 76 microseconds. 2 segments within 10% of this. Shortest transition 86 microseconds. 3 segments within 10% of this. Shortest transition 98 microseconds. 960 segments within 10% of this. Calculated baud rate is 9708 bits per second. Baud rate is 9600 bits per second. First break ends at 29127 usec. Polarity is reversed Word size 5: 73 errors Word size 6: 73 errors Word size 7: 73 errors Word size 8: 73 errors Word size 9: 0 errors Word size is 9 bits, including any parity bits. Parity errors for 8o: 304 Parity errors for 8e: 177 Parity errors for 8m: 401 Parity errors for 8s: 80 No error-free parities detected. First, lars232 attempts to determine the bit size, and thus the baud rate. There are likely to be glitches in the data, so we cannot simply look at the shortest bit. Thus, the shortest bit for which at least 2% of the bits are within 10% is used. The baud rate is calculated from this. If the calculated rate is close to one of the standard rates (50, 75, 110, 150, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200), it is rounded; otherwise it is used directly. In the example above, the calculated rate of 9708 (which would not be displayed without the verbose option) is rounded to 9600. The program then looks for a break (a MARK pulse at least 11 bits long). If breaks are found with SPACE polarity instead of MARK, the program notes that the polarity is wrong and reverses the data. If breaks are found with neither or both polarity, the program aborts. Then, an attempt is made to determine the word size in bits. At first, no distinction is made between parity bits and data bits. The data after the first break is examined starting at 5 bits; the number of errors (places in which there was not a stop bit where one was expected) is counted. If a glitch (a bit more than 6.6% shorter than the selected bit size) is encountered, all data until the next break is skipped. The process is repeated for 6 to 9 bits. The word size with the least number of errors is selected. If more than one word size has no errors, the lars232 prints the options and exits. A word size can be forced by rerunning the program with the -w option. Parity determination is attempted by looking through the same data again, and seeing whether the last bit fits for Odd, Even, Mark, or Space parity. Those parities which were error-free are printed; of course None is always an option unless the word size is 9. To see the actual number of errors with each parity, use the verbose option. One additional option, the -x option, forces lars232 to examine word sizes larger than 9, up to whatever number is specified after -x (up to 100). Note that this also has the effect of increasing the length of the shortest break that can be detected, so it should not be used unless there is reason to believe that the data really does have nonstandard-length words. Using the -x option also examines words below 5 bits in length. ** LADUMP ** ladump takes data from lasample and decodes it as RS232. It takes options specifying the word length (-w), baud rate (-b), parity (-p), whether the polarity is reversed (-r), and of course which signal to use (-s). It is capable of decoding word sizes longer than 8 bits. As a sample command line, one might run: % ladump -b 9600 -w 9 < data Output looks like: 6 8 2 e1 * * 8 8 24 a 0 9 2 25 f * a 2 22 a c6 3 b 2 23 f f6 c 2 20 b 42 d 8 2 7 14 e 8 2 6 0 10 0 ** * Newlines indicate breaks. A single asterisk indicates a glitch (a too-short bit); everything after a glitch is ignored until the next break. A double asterisk indicates a lack of stop bit where there should have been one, and is treated the same as a glitch. In verbose mode (-v), output looks like: Logic Analyzer Data Dumper version 0.1 Total of 2124 transitions on indicated line. [15785] 2 0 a1 * [68758] * [69124] 4 14 6 0 [15841] 2 38 2 26 [10862] 1 46 4 ab The number is brackets is the number of microseconds since the last data (i.e., the length of the break that the newline represents.) In debugging mode (-d), output looks like: Logic Analyzer Data Dumper version 0.1 Total of 2124 transitions on indicated line. Raw data reversed. Bit length is 104 usec Word length is 9 bits Parity number is 0 End of first break at 35615 usec Glitch of size 70 at 40066 usec using bitsize 104 usec Glitch of size 71 at 110043 usec using bitsize 104 usec Glitch of size 70 at 1910066 usec using bitsize 104 usec Glitch of size 75 at 1930023 usec using bitsize 104 usec (35615)[15785] 106 (36763)2 (37911)0 (39060)a1 (40172)* (109972)[68758] * (184728)[69124] 100 (185881)0 (187029)8 (188178)6 (189327)0 The numbers in parenthesis indicate the absolute positions of the word which follows. This is useful if one wants to locate a particular word in chart view. When it is run with a parity other than none, words with incorrect parity bits are indicated with a trailing underscore: 4 1 a8 26_a0 22 40 a0 0_