Plug and play - what to do when it doesn't

Originally published in Australian Personal Computer Magazine, December 1997.
Last modified 03-Dec-2011.

 

You plug in a new scanner and now your mouse doesn't work. Your computer thinks it has eight serial ports. Windows thinks the network card is installed properly and working fine, yet does not know what resources the card's supposed to be using, and can't see any connected machines.

Welcome to Plug and Play.

On the face of it, Plug and Play promises to extract hardware setup from its awkward adolescent period, when cards were no longer configured with DIP switches and jumpers but instead used special setup programs which, if lost, left you unable to change any settings. If you've got a modem, you can often download a replacement setup program - but if you're dealing with a yum cha card whose manufacturer has had three name changes in the last year, good luck.

The nice thing about DIP switches and jumpers is that you know, for a fact, what resources a card is set to use. The nasty thing is that changing these settings usually requires you yank the card out of the computer.

In Plug and Play, a standard computer-peripheral communication system allows the PC to see which of its resources are already in use, find out from new peripherals what resources they can use, and juggle settings around to make everything work. No funny setup programs are needed, and you never need to rip your computer to bits to change a card's configuration.

There are two obstacles that must be overcome to achieve this highly desirable aim.

Obstacle one

First, not all computers and not all devices plugged into them are Plug and Play compatible. If your computer has a Plug and Play BIOS, and that BIOS is bug-free, and all of your peripherals are Plug and Play, and you have bug-free up to date drivers for them, you'll probably not have any problems. But if you score a miss in any of these departments, you can be in for an experience that is different from, but no less annoying than, setting up a plain old non-Plug and Play computer.

Any machine made since late 1995 is likely to have a Plug and Play BIOS, but older BIOS versions can have strange quirks. Updating your BIOS is one of those procedures that differs for every machine; some need a whole new chip, others use a "flash ROM" and can be updated with a special utility and a patch file. Flash BIOS updates are less fuss, but an error during the BIOS write procedure can leave you with a stone dead computer.

Driver choice is also important. A driver for a given device may come with Windows, but a more up to date and specific driver is likely to be included with the hardware, and it's wise to use that - or to check with the manufacturer via phone or Internet to see if an even better driver's come out. If your hardware works fine and the latest driver has no extra features that matter to you, you can take it or leave it - but the improvements are often worth the minimal investment needed to get the latest software.

Obstacle two

The second obstacle is that, with or without Plug and Play, IBM compatible computers have some serious expansion restrictions. There are only so many Interrupt Requests (IRQs), Direct Memory Access (DMA) channels and input/output (I/O) addresses, and it's quite possible to have a combination of hardware that may all fit in the box, but can't all work at once.

When sorting out these sorts of problems - and especially when troubleshooting device conflicts - it helps to understand exactly what the three kinds of resources are and do.

IRQs

When a card needs the attention of the CPU, it uses the IRQ "level" assigned to it to signal this fact. Two devices can share the same IRQ, as long as they never both try to signal the CPU at the same time. When I first wrote this column, back in 1997, not many devices could actually coexist like this, though quite a few thought they could. Nowadays, IRQ sharing works surprisingly well. But misconfigured systems and/or older hardware that result in IRQ clashes still work the same way - the clash generally stops all of the clashing devices from working.

There are 15 IRQs, and most of them are reserved for basic system components, leaving IRQ2, IRQ5, IRQ10, IRQ11 and IRQ12 commonly free. In the extensions-and-additions tradition of IBM compatible computers, there are really two interrupt controllers, one for IRQs 0 through 7 and the other for 8 through 15. IRQ2 is the magic conduit between the two controllers, and hence behaves oddly; IRQ9 is "software redirected" to IRQ2, which means a device that's set to use IRQ2 can have its driver set to IRQ9. Since the Plug and Play BIOS in most modern machines occupies IRQ9, users no longer have to worry about this confusing situation.

To free a few more precious resources, try disabling serial or parallel ports from your CMOS setup (press delete right after rebooting). A machine with two parallel ports will use IRQ5 for the second one, but if you don't need a parallel port, disable LPT1 and IRQ7 will be free. IRQs 3 and 4 can be freed by disabling COM2 or COM1 respectively (COM3 and COM4 use the same IRQs, but not the same I/O addresses, as COM1 and COM2, so you can have a machine with four serial ports set up as long as you never use ports 1 and 3 or 2 and 4 at once). If you just remove a parallel or serial port in Device Manager, Windows will helpfully autodetect it and replace it again when you reboot, so you have to use the CMOS setup.

I/O addresses

I/O addresses, also referred to as "I/O ports" or "port addresses" are what a CPU uses to tell which of its peripherals is presently clamouring for its attention. I/O address numbers are always expressed in base 16 (hexadecimal), which explains those letters from A to F in the addresses. Fortunately, there's no need to do hex-to-decimal calculations when dealing with I/O addresses.

Modern PCs have 65536 I/O addresses (numbered 0000 to FFFF), but devices on the ISA bus (old-style cards, as opposed to PCI, MCA, EISA and VESA devices) can only use the first 1024 of these addresses (000 to 3FF). The expanded address space can cause problems in some computers, whose ISA buses get sent commands which also go to one of the more recent buses. The ISA bus cannot tell the difference between, say, address 10F0 and address 0F0, and so these addresses clash in such machines. Keep this last-three-digits problem in mind if you see a mystifying problem in a machine which definitely shouldn't have any clashing settings.

Devices generally each use a block of eight or 16 I/O addresses, which allows several pieces of information to be sent and received at the same time, and generally also wastes a few addresses. This means there's room for more than 64 devices even in the relatively cramped ISA I/O address space.

18 blocks of addresses are likely to be used as a matter of course by the basic hardware - the keyboard, the serial and parallel ports, the hard disk controller and so on - but this still leaves a ton of spare addresses. Unfortunately, most peripherals are capable of using only a few selected blocks of I/O addresses, and if you can't juggle around the I/O possibilities of all your hardware so that everything gets its own address, you're out of luck.

If two devices are set to use the same I/O addresses, it's likely that neither will work.

DMA channels

Direct Memory Access (DMA) allows expansion cards to directly access system memory, without having to send data via the CPU. Only one device can use DMA at a time, and there are eight "channels" devices can use. DMA2 is always used by the floppy drive controller, and DMA4 is eaten by the "link" from the second DMA controller to the first (XT-class computers had a single four channel DMA controller), but the rest are available for use.

Troubleshooting

Whenever a new piece of hardware doesn't work, check to see if everything else in your computer still works. Chances are, the new gear's clashing with the old gear, and you will have lost your CD-ROM drive or your mouse or your network card or your MIDI playback or something like that. If you know what the new hardware clashes with, you know what resources it's trying to use, and you don't have to trust Windows to tell you what's going on.\

Device Manager
Device Manager gives a handy overview of your hardware - but don't trust it.

Also check Device Manager (in System Properties, accessible from the Control Panel or by right-clicking My Computer and selecting "Properties") to see if Windows has helpfully auto-detected things that aren't really there. "Unknown Device" listings are a dead giveaway, as are duplicate listings for ports. Delete these things without changing anything else and they'll all just come back the next time you reboot, but they, again, are helpful indicators of what might really be going on.

Device Manager again
Double click "Computer" in Device Manager and you can view the resources Windows believes are used.

The standard Windows 95 online help covers Device Manager in detail, so it needn't detain us here. The only thing to remember when using Device Manager is not to trust it. Windows is not omniscient. It does not necessarily know what's really going on. If Windows says there are no conflicts, but a device or two still isn't working, there's a good chance that a conflict actually is the cause.

The standard online help also contains the Hardware Conflict Troubleshooter, which will step you through many hardware problems. It has been said that the Windows Troubleshooters are simply a way of spending a restful five minutes before you actually start trying to fix a problem, but this one will keep beginners on the tracks effectively.

Resources At A Glance

Red - definitely used in modern PCs

Blue - possibly used in modern PCs

Green - extremely unlikely to be present in modern PCs - included for completeness

IRQs:

IRQ0

Timer output

IRQ1

Keyboard controller

IRQ2

Route to Interrupt Controller 2, IRQ8 to 15

IRQ3

COM2, COM4

IRQ4

COM1, COM3

IRQ5

LPT2

IRQ6

Floppy disk controller

IRQ7

LPT1

IRQ8

Real time clock

IRQ9

Plug and Play BIOS

IRQ10

Free

IRQ11

Free

IRQ12

PS/2 mouse, if installed

IRQ13

Maths Coprocessor

IRQ14

Primary hard disk controller

IRQ15

Secondary hard disk controller

DMA Channels:

0

Dynamic memory refresh

1

Free

2

Floppy disk controller

3

Free

4

First DMA controller

5

Free

6

Free

7

Free

I/O Addresses

000-01F

DMA controller 1

020-03F

Interrupt controller 1

040-05F

Timer

060-06F

Keyboard

070-07F

NMI - Non Maskable Interrupt and CMOS RAM

080-09F

DMA page register

0A0-0BF

Interrupt controller 2

0C0-ODF

DMA controller 2

OFO-OFF

Math coprocessor

1F0-1F8

Hard disk

200-20F

Joystick controller

278-27F

Parallel port LPT2

2E8-2EF

Serial port COM4

2F8-2FF

Serial port COM2

378-37F

Parallel port LPT1

3B0-3BF

MDA - Monochrome Adapter

3BC-3BE

Parallel Printer on Monochrome Adapter

3C0-3CF

EGA - Enhanced Graphics Adapter

3D0-3D7

CGA - Colour Graphics Adapter

3E8-3EF

Serial port COM3

3F0-3F7

Floppy disk controller

3F8-3FF

Serial port COM1



Give Dan some money!
(and no-one gets hurt)