UART.TXT last updated by Roedy Green 1996 Jan 17 PURPOSE ******* UART lets you check that your COM ports are configured correctly, with the standard hex port address e.g. COM4: should be at 2e8, and with the standard IRQ, e.g. COM4 should be IRQ 3. It also tells you what type of UART chip you have, usually the old fashioned unbuffered 8250 or the newer fifo buffered 16450 that is needed for Windows and OS/2. It expects this pattern COM1: COM2: COM3: COM4: port: 378 2f8 3e8 2e8 irq: 4 3 4 3 USAGE ***** Under vanilla DOS, just run UART once for each of your COM ports. e.g. UART COM1: UART COM2: UART COM3: UART COM4: You can also use UART in a BAT file and switch on the errorlevel it returns. UART COM1: If Errorlevel 5 GoTo SyntaxError If Errorlevel 4 GoTo PS2TYPE3 If ErrorLevel 3 GoTo AT16550FIFO If ErrorLevel 2 GoTo AT16450 If ErrorLevel 1 GoTo XT8250 If ErrorLevel 0 GoTo NoSuchPort UART by itself is considered a syntax error and generates a usage message. Sets errorlevel to type of UART detected. LOOPBACK PLUG ************* Sometimes UART may suggest using a LOOPBACK plug to get more accurate results. Peter Norton nows sells such plugs to accompany his utilities. They also come with diagnostic programs such as QAPlus or CheckIt. If you want to roll your own they look like this: 9 pin serial 25 pin serial 02 - 03 02 - 03 07 - 08 04 - 04 06 - 01 - 04 - 09 06 - 08 - 20 - 22 TECHNICAL NOTES *************** The code is based on the MASM routines on page 364 Of PC Magazine May 26, 1992. In DESQview often ports COM1: and COM2: are not accessible. You must have access priviledge in your PIF. If UART says there are no ports, the simplest thing to do is run under pure DOS without DESQview. Under OS/2, virtualization makes all com ports look like 8250s, so it is best to run under DOS. UART supports only COM1: .. COM4:. It looks in BIOS Table to find the corresponding physical addresses. It expects this pattern COM1: COM2: COM3: COM4: port: 378 2f8 3e8 2e8 irq: 4 3 4 3 int: C B C B If, for example, COM1: has port 2f8, then irq 3 would be anticipated and its interrupts would be fielded on int vector B. Port has precedence over com port number in determining irq. So for example, if someone removed your modem on COM2: without reconfiguring your machine, DOS would slide COM3: down to COM2: and COM4: down to COM3:. This is just asking for trouble, since then you have a pattern COM2: = 3e8 = irq 4. UART treats this as an error, even though some programs will survive it. How UART Works ************** If you are very curious, your best bet is to read the comments in the source code UART.ASM. Even if you don't understand assembler, you still might be able to learn a fair bit. The code to discriminate chip types depends on detecting the presence of the scratch register, added after the 8250. Then we check for FIFO buffers, added with the 16550AF. Then we check for the enhanced register and DMA added with the IBM type 3. To check the IRQ we simple send a NULL character to the port, then wait on the CORRECT IRQ for an interrupt. If we get exactly one, we are golden. Five things can then happen: 1. device accepts the char, and we get a Xmit buffer empty interrupt. This is the "nice" case. A loopback plug will also simulate this case. 2. device keeps CTS low, so char never goes out. We never get an int. This is the case for example if a serial mouse is attached that has not been activated. This is a "nasty" case. 3. device is powered off or missing. Then we get a line status interrupt instead. This is the normal case when nothing at all is connected to the port. We can still tell that the irq is correct. 4. IRQ not set properly. We see no interrupt. This is the error UART was designed to detect. 5. Some other device is also using same IRQ. Then we may see spurious extra interrupts from that device. Again we can report the problem to the user. MONEY ***** UART is free. We put out a suite of similar utilities, a mixture of shareware and freeware. If you would like almost the entire shebang of 70 odd utilities with source, preregistered, please send a cheque for $20 US or Canadian to: CMP UTILITIES Canadian Mind Products #601 - 1330 Burrard Street Vancouver, BC CANADA V6Z 2B8 If you do that, I will be willing to give you phone support for UART as well. We are too small right now to accept credit cards. Projects in the works are described in my resume, Roedy.txt GROVELLING I have AIDS. I have been HIV+ since 1985. I was too ill to continue working, and left my job in December 1994. I have been living on my savings ever since. They are just about exhausted. One of the medications (Cipro) I take costs $125 per prescription. I have not been able to afford it of late. I have been supporting a dozen foster kids in the third world. I don't want to abandon them. Receiving a registration for the CMP utilities in the mail is most welcome. -30-