From: tedm@agora.rain.com (Ted Mittelstaedt) Subject: How to modify cheap com port cards Date: Sat, 3 Oct 1992 21:35:49 GMT Modifying a simple COM port is easy, I'll tell you how I modified an internal modem card that I have to use IRQ2/9. Keep in mind that I have not done this with the COM card I was referring to previously. I don't think it would be difficult, however, as it appears to be the same setup as the internal modem. HARDWARE HACKING: MODIFYING A SIMPLE(CHEAP) COM PORT TO USE HIGHER IRQ's First of all, lets discuss the idea of what an IRQ is, and how it's implimented on an AT, just so we are all clear on the concept. As most people probably know, on a standard AT there are 4 I/O port memory locations commonly associated with serial communication ports, and there are only 2 commonly associated IRQ's that are used with these locations. What does this mean? Well, here goes: A COM port on an IBM AT class computer usually consists of what are known as UARTS. These are physical chips that translate the parallel data from the computer's bus to serial data that the modem needs. These are usually stand- alone chips that reside on a "serial port card", however in the case of the cheaper internal modems they can be a small section of the modem chip, which typically would be a larger chip containing the UART, the modem, and so forth. UARTS take up what is known as "I/O Port Memory" when they are plugged into the computer. The memory locations referred to by COM port card makers and others are actually the starting I/O memory address of a number of I/O ports "a block" that contain various UART programming registers for the chip. The memory locations on an AT that have come to be known as the "standard" locations are: 03F8 02F8 03E8 02E8 (these are hexadecimal numbers) Now, There are 2 ways to program UARTS, the first is "interrupt driven" and the second is "polled" With Polled operation, the subject of IRQ's has no relavence, because the IRQ is not even active. Instead, the Operating System is supposed to periodically read some ports in the port block to see if a character has arrived. Needless to say, this makes for very crude operation since many characters can come and go before the OS gets around to checking the port. Worse yet, if no characters are coming in at all, the OS is wasting CPU cycles on useless instructions to get incoming characters when there aren't any to get! Polled operation is the type of operation that the BIOS sets up for the COM ports when the computer is started, it is what is going on when you TYPE a file to the COM port from the DOS prompt. This is how the designers of the AT could get away with supplying only 2 IRQ's to the 4 com ports. Since the BIOS programs the UART to go into polled mode, there is never an IRQ conflict, at least when the machine starts, there isin't. Of course, communication programs have loads of characters coming in that can't wait for the OS to poll. So, the concept of the IRQ comes into play. An IRQ is simply this: a wire that runs from a chip deep in the bowls of the AT called an "Interrupt controller" and connects to one or more of the UARTS. When a UART receives a character, it "triggers the IRQ" by dropping the voltage on the wire, this signals the Interrupt controller to wake up and do something about the incoming character. If the Interrupt controller is properly programmed, and the UART is programmed to be in the "interrupt driven" mode, what happens is the controller interrupts the CPU and the CPU supposedly starts executing a routine to fetch the character from the port. This is where the fun and games start. With the "standard" AT, if you plug 4 UARTS (com ports) into the 4 I/O memory locations, the default settings on the serial cards (or internal modems) will connect the IRQ wires from COM1 & COM3 together, and COM2 & COM4 together. This pair of wires will then be connected to the Interrupt Controller. This is great for Polled Operation, because the IRQ lines are not active, but less than desirable for Interrupt Driven operation. The reason is that software is generally not written to expect this, the biggest problem is what if 2 ports connected together receive a character at the same time? Software to support IRQ sharing must check each port connected to the same IRQ to make sure that no character came in when the Interrupt controller is triggered. Because of this, various schemes have arisen to obtain more IRQ lines for the COM ports/and or share the IRQ lines available. The problem with them is that there is no standardization, and worse a lot of programmers are "unclear on the concept" so even if there were a standard half the software would probably not impliment it correctly. Another problem is the difference between the XT and the AT. With an XT, you get only 1 Interrupt Controller chip which limits you to a grand total of 8 IRQ lines. Some of these are used for such essentials as the keyboard and the clock, so you really only get 5 free. Of the 5, one is IRQ2, that goes to the video card for the Horizontal Retrace (which is hardly ever used unless you like CGA cards) and 2 others go to the Printer Ports. (of which there are 2 on XT & AT's). So, you really only get 2 good ones, unless you like to lose one of your printers, or take a chance on conflicting with your SoundBlaster/Midi card (which is usually connected to IRQ2). With an AT, you get 2 Interrupt Controllers, so you get 15 total. Wait, I hear you saying, 8 + * = 16. Well, that is true, but the way that the AT designers decided to implement the second Interrupt Controller is by hanging it off IRQ2 on the first one. They then ran the wire from IRQ9 on the second to the same buss connector used for IRQ2, and did some fiddley-fancy with the BIOS so that your cards that expected to see IRQ2 thought that they were. So, you can see that the problem of IRQ's on the AT is not just a hardware one, it is software as well. This article will attempt to tell you how to configure separate IRQ's for the 4 com ports, but if your software is not written to use anything other than the default connections, you won't get anywhere. The first thing you need to know is where the physical contacts are for the various IRQ's Here is the pinout for the standard AT: B4 = IRQ9 } B21 = IRQ7 } B22 = IRQ6 }---- These are all on the "8-bit" buss connector B23 = IRQ5 } B24 = IRQ4 } B25 = IRQ3 } D3 = IRQ10 } D4 = IRQ11 } D5 = IRQ12 }---- These are all on the "16-bit" Buss connector D4 = IRQ15 } D5 = IRQ14 } Standard AT Buss layout: A1 A31 C1 C18 --------------------------- -------------- | | | | Front of Motherboard | | | | --------------------------- -------------- B1 B31 D1 D18 To find out which pin is which, start counting from the back go forward Now, take a look at that port card that you are planning to modify. Find IRQ3 on it and trace the circuit trace. It will usually go to a jumper block that is configured something like this: IRQ3 UART#2 ------------- | . . | | . . | ------------- UART#1 IRQ4 And the instructions with the card for configuring it will go something like this: Uart1 (com1) to IRQ4 set jumper like this: ---------------- | . . | | --- | ---------------- Uart1 (com1) to IRQ3 set like this: ---------------- | | . | | | . | ---------------- Uart2 (com2) to IRQ4 set like this: ---------------- | . | | | . | | ---------------- Uart2 (com2) to IRQ3 set like this: ---------------- | --- | | . . | ---------------- These instructions will usually be combined with other jumper settings, so it may be difficult to see what the card maker is getting at. Remember, these cards are CHEAP you aren't getting the red carpet here! :-) You might be lucky to get docs at all! It is usually best to trace it out. Now, what you want to do is to decide what IRQ you want to connect to. If you are lucky enough to have a com card that is a full length card, you will have access to the higher IRQ's, otherwise you may have to use IRQ5 which is usually used for LPT2. (of course, you can't have a LPT2 printer port in your system, either). If you have 2 printer ports, you may need to use IRQ2, but use this as a last resort, since many card makers seem to have decided that no one else uses it (ignoring the fact that all the video cards ever made use it except for monochrome cards) and conflicts are most likely to result with this IRQ line. Now, take some tinfoil and wrap it around the fingers of the card, so that ALL of them are connected. Run a wire from that to a cold water pipe or other ground(assuming you don't live in a house with plastic pipes) Pick up your soldering iron and wrap some wire around the barrel of it and run it to the same ground. Carefully, solder 6 inches of small hook-up wire to the IRQ you have decided to use. Solder to a point at the very top of the contact on the card finger that correcponds to the IRQ line you have selected. Tin the other end of the wire, and let it cool. Now, gently remove the jumper from the jumper block that corresponds to the UART you want to change the setting on. Turn the jumper so that 1 side of it is positioned over the connection to the UART, and the other side over empty air and push it down. Take the other end of the wire and insert it into the jumper side that is hanging over empty air, and tie bak any excess wire. The end will look like this: |--------- -----------|-- | | . | | | | . . | |--Wire -------------- | | | IRQ Card finger Now, plug in the card and fire up the computer, configure your software and you are done! :-) I AM OF COURSE NOT RESPONSIBLE FOR THE CONTENT OF THESE INSTRUCTIONS. I USED THEM TO CONNECT UP A MODEM TO COM3, BUT IF YOU BREAK YOUR MACHINE DON'T COME CRYING TO ME. CAVEAT EMPTOR! This file released into the Public Domain on this second day of October, 1992 Any editorial remarks please send to me at: Ted Mittelstaedt tedm@agora.rain.com