Communications – Interfaces

Chapter 10. Interfaces

If you could pry one of the expansion bus connectors off the motherboard of your computer and solder a length of cable to it, you’d probably ruin your computer. But you’d also make the equivalent of a mass storage interface. This may be educational, but don’t try it at home. Not only will it be expensive and wasteful (of your computer), but unnecessary. Some clever engineers have already done it for you.

In fact, the most popular interface for hard disk, CD, and DVD drives, is nothing more than a pried-off expansion board connector. The AT Attachment interface earned its name by putting the AT expansion bus connector on a short cable that plugged into hard disk drives. The interface has matured somewhat since then—it’s about 16 times faster, has developed its own language, and trimmed off a lot of fat. But deep down, underneath all the gloss and the layers of specifications, is the heart of the AT expansion bus.

At that, AT Attachment is almost the perfect interface. It brings devices both electrically and logically closer to your computer’s circuitry than any other connection system. And that’s exactly what the interface is supposed to do—connect individual devices to your computer.

AT Attachment isn’t the only popular interface, however. It has a number of rivals and predecessors. If you have a high-performance computer and disk system, you’re likely to covet its closet rival, SCSI, for its speed and versatility—or even ATA’s designated successor, Serial ATA, which promises to be the fastest yet lowest cost interface developed so far.

At the other end of the spectrum, your computer likely also has the slowest interface in common use still stuffed within its circuitry—a floppy disk interface. You probably don’t need an engineering degree to figure out what it does. It runs the floppy disk drive that is the one remaining (or at least the most prominent) vestige of the technology of the first personal computer in modern machines. It’s the equivalent of you wearing your grandmother’s locket around your neck.

AT Attachment

The dominant hard disk interface for the computer has become the AT Attachment design—a natural outcome considering that the interface is based on the ISA expansion bus, at one time the most widely used computer bus. Despite its wide application, you still might never have heard of the AT Attachment name. It goes under more aliases than a candidate for the Ten Most Wanted list. The most familiar of its alternate monikers is IDE, which stands for Integrated Drive Electronics and is a term that correctly describes a technology rather than a specific interface. Nevertheless, the name IDE gets used indiscriminately by people in the computer industry for the AT Attachment design. Sometimes engineers call ATA the AT interface, which strictly speaking it is not.

Although engineers created ATA in its original form for low-cost small-capacity drives, it has grown along with the needs of modern computers, keeping in step with the need for both higher capacities and faster access to information. In fact, today’s ATA interface can handle more capacity than any disk drive foreseeable in your lifetime. And its speed far exceeds the capabilities of any current disk drive mechanism.

But AT Attachment isn’t a single interface. During its long evolution since its introduction in 1991 (several preliminary versions were used by products before then and after 1985, when engineers first began work on what eventually became the standard), it has undergone several stages of refinement. Every year or two, a new version of the standard gets approved. The current version is ATA-6, although ATA-7 is already in the works. Table 10.1 briefly summarizes the history of the AT Attachment standard.

Table 10.1. The ATA Standards

Performance

Much of the development of ATA has been focused on improving its performance to keep it in step with disk drive and computer technology. The designers of the interface have done an admirable job, not only keeping it ahead of current technology but also pushing far beyond it. Today’s hard disk drive mechanisms are limited by physical and design factors to far lower speeds than the ATA interface can deliver.

As engineers refined the ATA standard, they increased performance by adding new transfer modes to the operating features of the drive. Each new drive usually supports the fastest mode defined at the time it is made as well as all the older, slower modes. The host computer, its operating system, and the drive negotiate the fastest transfer mode that all understand to use for their transfers. That way, you always get the fastest possible performance from your disk drive. Moreover, even the newest drives can work with old computers (or old drives can work with new computers).

The current ATA standard recognizes 11 transfer modes, each with its own performance limit. Table 10.2 summarizes the principal transfer modes of the AT Attachment standard.

Table 10.2. AT Attachment Transfer Modes and Speeds

AT Attachment supports two broad classes of transfers: Programmed Input/Output (PIO) and Direct Memory Access (DMA). Under the more recent iterations of the ATA standard, DMA is further divided into Single-Word DMA, Multi-Word DMA, and UltraDMA (once called synchronous DMA) modes. With today’s computers, UDMA modes are preferred for their higher performance.

The difference between PIO and DMA modes is how they use the resources in your computer. The DMA modes provide an opportunity for improved overall system performance through bus-mastering, but the full potential of this benefit requires matching hardware and software in your computer. The fastest modes match only with the most recent computers.

Programmed Input/Output puts your microprocessor to work. The microprocessor in your system directly controls every byte that moves through the interface. The microprocessor directly writes values from its registers or memory to a special I/O port, which transfers the data to the control circuitry of the interface. PIO transfers can be of one of two types: blind and flow-control.

Blind transfers don’t give the AT Attachment drive full control of the transfers. It has no information about the ability of the microprocessor host to accept data. In effect, it is blind to the capabilities of the host. By design, any error the system makes will be on the conservative side to maximize the reliability of the system. Because sometimes only a part of the full bandwidth of your computer is available for making disk transfers, blind transfers throttle back to the worst case. Consequently, AT Attachment operates blind transfers at a slow rate regardless of the host computer’s ability to capture the data. It moves bytes at the lower, throttled rate even when 100 percent of the bandwidth is available.

Flow-control transfers use a form of handshaking to ensure that disk transfers take advantage of all the available bandwidth. Specifically, controlled transfers use the I/O Channel Ready (IORDY) line in the AT Attachment interface to signal to the computer host when the drive needs to make a high-speed transfer. Using the IORDY line, the drive can call for maximum drive bandwidth support and increase its transfer rate.

The current ATA specifications allow for five modes of PIO transfers, as listed in Table 10.3. Modes 0, 1, and 2 use blind transfers. Modes 3 and 4 use flow control.

Table 10.3. AT Attachment Programmed I O Modes

The AT Attachment standard allows for Direct Memory Access transfers, which in turn allow for bypassing the host computer’s microprocessor and moving data directly to memory. But their real speed comes from the reduced cycle times, bursting blocks of data, and bus-mastering. Moreover, when the host operating system does not serialize input/output functions, DMA transfers allow a degree of parallel processing. The host microprocessor can engage in other activities while the DMA transfer progresses. Versions of Windows based on DOS (including Windows 95, 98, and Me) serialize their I/O functions, so they do not gain this benefit. Unix, Windows NT, Windows 2000, and Windows XP can achieve gains from this transfer strategy.

AT Attachment allows both single- and multi-word DMA transfers. Single-word DMA transfers move one word at a time. The host sets up the transfer, selects the data to be transferred, and then makes the transfer. The next word repeats the process. The ATA specifications acknowledge three single-word DMA modes, as listed in Table 10.4. But the one-word-at-a-time transfers incur substantial unnecessary overhead, so these modes are classified as obsolete.

Table 10.4. AT Attachment Single-Word DMA Transfer Modes and Speeds

Multi-word DMA transfers replace single-word modes under more recent standards, delivering improved performance by operating as a burst mode. After the host sets up the transfer, it selects the starting and ending words for the transfer; then the interface moves the entire block of data from start to end with no further intervention. Table 10.5 lists these ATA multi-word DMA modes.

Table 10.5. AT Attachment Multi-Word DMA Transfer Modes and Speeds

The UltraDMA modes combine two performance-enhancing technologies. The most straightforward boost comes from quickening the clock or reducing cycle time and taking advantage of bus-mastering technology. By shifting control of the bus to the drive system, the UDMA modes can quicken the pace of transfers.

In addition, UltraDMA doubles-up transfers. Normally a DMA transfer is made on one edge of the clock cycle—typically on the leading or rising edge when the cycle begins—so one transfer occurs during each clock tick. An UltraDMA system can transfer data on both the rising and the falling edge of each clock cycle—that’s two transfers for every clock tick, an effective doubling of throughput. To make this system work reliably, the ATA designers shifted from asynchronous transfers to synchronous transfers. The transmitting device (the computer when writing data; the disk drive when reading) generates the clock and synchronizes the data pulses to the clock. Because one device controls both the clock and the data, it can control them better.

In order for the disk drive to take control of the timing, it must act as a bus master, so this technology is sometimes termed bus master DMA. In addition, error protection is built in to the transfer protocol using a cyclical redundancy check (CRC) algorithm. The CRC applies only to the cable transfer, not the data stored on disk.

Plain UltraDMA takes advantage of the 16.6MHz clocking speed available in ATA PIO mode 4 but enhances it with double-clocking. Other UltraDMA modes use faster clocks to achieve higher peak data rates. These UltraDMA modes are often referred to by their peak transfer rates, so UltraDMA mode 4 is commonly termed ATA/66 or UDMA/66; mode 5, ATA/100 or UDMA/100; and mode 6, ATA/133 or UDMA/133.

Ordinarily you don’t have to worry about the transfer mode used by an ATA drive system. Your computer should automatically use the fastest mode available without your intervention—or knowledge.

Addressing and Capacity

The AT Attachment interface can limit the storage you connect to your computer because of limitations in addressing data in various ATA versions. Although a drive may physically be able to store hundreds of gigabytes, that capacity might not be useful because the interface used by the drive does not allow all the bytes to be addressed. In effect, the bytes on the drive beyond the addressing limit imposed by the interface have unlisted numbers, and no amount of begging or cajoling the operator will get you through to them.

Addressing limitations have constrained the usable capacity of AT Attachment drives almost since their inception. As the need for greater addressing reach has appeared, designers have added new addressing modes to the ATA standard. The latest move finally pushes the upper limit beyond any currently feasible drive capacity.

CHS Addressing

When engineers first conceived ATA, they based its addressing system on physical attributes of the hard disk the interface was to control. They assigned blocks of storage based on the heads, tracks, and sectors of the disk drive. This addressing system is sometimes called CHS addressing for Cylinder (the techie term for track), Head, Sector addressing.

Somewhat arbitrarily, the engineers allowed for addressing disks with 16 separate heads or disk surfaces, each of which may have up to 65,536 tracks spread across it. Each track could contain up to 255 sectors of 512 bytes each—all generous figures for the state of technology at the time. Multiply these numbers, and you’ll see the that CHS scheme allowed for a capacity limit of 136,902,082,560 bytes or 127.5GB (in the days when a large hard disk measured 40MB).

Most people round that capacity number to 128GB, even though it’s a bit less, because of the limit of 255 rather than 256 sectors per track. (For historical reasons, drive-makers start numbering sectors with one rather than zero.) The scheme should have worked until the year 2002, when the drive-makers introduced the first 130GB drive, the first to exceed the CHS imposed limit.

Unfortunately, in practical application, the BIOSs of older computers severely constrained ATA addressing. All software that relies on interrupt 13(hex) code routines in your computer’s BIOS must abide by the BIOS’s own disk addressing system. The BIOS routines originally developed in 1982 for the IBM personal computer XT allowed for disks with up to 255 heads or disk surfaces (IBM started number heads with one so the limit is 255 rather than 256), each with up to 1024 tracks on them. Each track can hold up to 63 sectors. This somewhat different geometry allowed for a small total capacity—8,422,686,720 bytes or 7.8GB—when using standard 512-byte sectors. Most sources round this figure up to 8GB.

A problem arises when the two limits of these two geometries get combined. The largest value that the system can handle for any of the three drive parameters is the smaller of the limits set by the two standards. Table 10.6 summarizes the interaction between the BIOS and ATA limits.

Table 10.6. ATA and Interrupt 13(hex) Addressing Limits

AT Attachment drives with the power-management option also include a built-in standby timer that can shift the drive into its lower-power standby mode after the drive has been inactive for a preset period. This changeover is a function of the drive and occurs automatically without the intervention of the host computer. The host computer can, however, switch off the standby timer so that the drive does not shift to standby automatically. The host computer can then take full command of the power mode of the drive.

To switch the drive from active mode to a lower-power mode, the host computer sends the drive a power-management command. Any drive-access command automatically forces the drive back into active mode. In addition, the AT Attachment standard includes a Check Power Mode command that allows the host computer at any time to determine in which mode the drive is currently operating.

Security

Starting with ATA-3, the T13 committee added device-level password security to limit access to disk storage. Although you set the ATA drive access password through your computer, the drive stores the password on its own media and it uses the same password, even if you unplug the drive from one computer and attach it to another. Consequently, if you activate its password security system and someone later steals your drive, this person cannot access the data stored on the drive.

Depending on the secrecy of your data, you can set security to one of two levels: normal or maximum. The chief ramification of your choice is what happens should you forget your password. Choose normal security, and the drive-maker can recover your data for you. When you set your drive for maximum security, even the drive-maker cannot retrieve your data.

The AT Attachment standard allows for two kinds of passwords:

  • User passwords. These passwords you set yourself to limit access to your drive. The command structure used by the AT Attachment standard allows for passwords up to 32 bytes long. The standard provides a common means of setting these passwords and gaining access to the drive that operates at the interface level. Normally, you’ll deal with a password through your BIOS, operating system, or application software, which links to the drive security system through the ATA interface.

  • Master passwords. These passwords are set at the factory. They are not normally used in the everyday operation of the drive but rather allow for recovery of data by the drive-maker should you forget your password. If you’ve set your drive for normal security, the drive-maker can use its master password to access your data or inactivate the old password so you can change your password to something that you can remember. When you set security to maximum, the master password only allows the drive-maker to erase your drive and restore it to its original condition—blank with no password set. Your files will be gone forever.

Under the ATA security system, your drive operates in one of three modes:

  • Unlocked mode. This is the normal operating mode of the disk drive. The drive carries out all commands sent to it. It can read and write to any of the data areas on the disk. You can also add or change your password in unlocked mode.

    A new drive will normally arrive in unlocked mode. It will operate as unlocked until you set a user password. Thereafter, the drive will always start operating in the locked mode and remain in locked mode until it receives a valid user or master password. Normally, the drive will accept five tries at sending it a password. It will then reject subsequent password attempts until it has been reset.

  • Locked mode. This mode prevents you from accessing or changing any data that’s stored on the disk. In locked mode, the drive automatically aborts all read and write commands without executing them. The drive carries out normally all commands that do not access or alter the data stored on the disk (for example, to enter a low-power mode).

  • Frozen mode. This mode prevents the security features of the drive from being altered. The drive carries out all normal read and write operations but will not change its security level or password. If you value your data, frozen mode will be your standard operating mode so that no one can change your drive password should you leave your computer unattended.

Device Identification

Each device includes 512 bytes of storage for identifying information. Device-makers are free to locate this storage anywhere they want. It can be stored on a nonremovable storage medium, such as a hard disk, or in EEPROM or Flash memory.

Regardless of its location, the AT Attachment standard includes a standard command for reading this identifying block. Using this command, your computer can interrogate the device to find out what it is and automatically configure itself for optimum operation, including maximizing its data-transfer rate. Included are the device parameters, the features supported (including transfer modes and thus speeds), the model number, and the serial number of the drive.

Logical Interface

The AT Attachment interface logically links to the rest of your computer through a series of registers. The standard does not constrain the port addresses used by these registers. Their location is set by the BIOS writer and chipset designer of your computer. The registers are generally inside the motherboard chipset, and the BIOS must be written to match. Add-in host adapters include their own registers and matching add-on BIOS.

Applications and operating systems that use the BIOS never need know the location of these ports. Software drivers for operating systems that bypass the BIOS must be written with the proper register addresses.

Most chipset-makers use the same range of addresses for the I/O ports used in communicating with their AT Attachment interfaces. Consequently, a single set of register addresses has become a de facto standard in nearly all computers. Table 10.8 lists these register addresses.

The result is that ATA disks that are addressed through the interrupt 13 facilities of the BIOS of a computer cannot address more than 63 sectors per track (the BIOS limit), 16 heads (the ATA limit), and 1024 tracks (the BIOS limit again). With 512-byte sectors, the top capacity is 528,482,304 bytes (about 504MB). Bytes beyond this limit simply cannot be addressed through the standard interrupt 13(hex) routines of the standard computer BIOS.

CHS Translation

Because the AT Attachment design as a system-level interface allows the inner workings of the ATA device to be hidden from your computer, manufacturers are free to alter the geometry of the drive as long as they make it look like something recognizable to your computer. The number of physical heads, tracks, and sectors inside the drive are usually totally different from the number of heads, tracks, and sectors your computer uses to address the sectors on the disk. The drive translates the incoming addresses to its own, internal physical addresses when it seeks out a sector.

Engineers broke through the 504MB limit by adding CHS translation to the BIOSs of computers. The BIOS translates commands from your software and operating system to its own CHS addressing system with the 8GB capacity limit. CHS translation is more a band-aid than solution and, thanks to revisions in the ATA specification, is not needed by modern drives (which are larger than the 8GB limit, anyway).

Logical Block Addressing

The ATA-2 specification introduced an alternate way of organizing disks called logical block addressing (LBA). It sidesteps the BIOS and substitutes 28-bit logical block addresses for disk sectors. Each sector on the drive is assigned a unique logical address that would be used by the BIOS to reach its contents. The full 28-bit addressing scheme allows for 268,435,456 sectors—about 137.5GB. The choice of a 28-bit scheme was essentially arbitrary—it simply matched the CHS limit well, allowing slightly more capacity.

Of course, this scheme was foreign to BIOSs and operating systems. BIOSs written after the development of LBA technology accommodate it by translating LBA addresses into CHS addresses (sound familiar?). Operating systems require drivers to understand the technology (which are included with all modern versions of Windows). Problems with some BIOSs limited the capacity of hard disk that could be addressed (sometimes to as small as 2 or 3GB, but more often to 8GB) because the BIOS translated LBA addresses into CHS addresses with all their limitations.

48-bit Addressing

As the ATA standard bearers, known formally as the ANSI T13 Technical Committee, were preparing the fifth version of their specification, they decided to put to rest capacity limits once and forever—at least for the foreseeable future. With the ATA-6 specification, they added a new addressing system that accommodated logical block addresses 48 bits long, equivalent to about a million times more on-disk capacity (a total of 144,115,188,075,855,360 bytes). In more convenient language, that’s 144 quadrillion bytes, or 144 petabytes (PB).

The new addressing scheme uses the same registers as the older 28-bit addressing system. It doubles the width of the registers used for LBA addresses by layering them. (Technically speaking, the registers act as a two-byte First In/First Out buffer.) For example, the operating system first writes the most significant bits of the LBA of a sector and then writes again to load the least significant bits of the LBA.

Just adding more bits is not sufficient to make a new addressing system work, of course. The addressing revision also includes new commands to access and use the longer addresses. At the same time, the committee elected to increase the largest possible transfer per command from 256 sectors to 65,536 sectors, allowing new drives to swallow and disgorge up to 32MB with a single command. The ATA system accommodates such large transfers by doubling the width of the sector count register by layering it in the same way as the LBA registers.

An operating system that’s aware of the ATA-6 specifications can determine whether a drive uses 48-bit addressing using the ATA Identify Device command. For compatibility, all drives with 48-bit addressing also support 28-bit addressing, although only part of their capacity may be available using it.

Unfortunately, 48-bit addressing doesn’t entirely eliminate addressing limits on disk capacity. It just shifts them back to the operating system. Most operating systems are designed for handling only 32-bit addresses, so most (including most versions of Linux and the entire Windows family) cannot handle capacities larger than 2.19 terabytes (trillion bytes, abbreviated TB).

Other Features

Although speed and capacity issues highlight most discussions of disk interfaces, the AT Attachment standard covers other issues as well. The ATA Packet Interface allows you to connect other devices such as CD and DVD drives to an interface that was originally designed just to handle hard disks. Power management under the ATA rubric makes your computer more energy efficient—and lets you keep computing on your notebook computer even after a mixture of fog and pilots lost in the lounge leaves you waiting at the airport gate long after any of your hopes of making your connection have departed. Built-in security features protect you from prying eyes and your data from errant erasures. And the automatic drive-identification capabilities of ATA makes setting up a computer a simpler chore, one that makes lengthy lists of drive parameters as happily behind you as a visit from in-laws who have finally finished an overly prolonged visit.

ATA Packet Interface

As it was originally conceived, the AT interface lacked facilities to control everything that a CD or DVD drive needed to do, such as play audio and video or simply change disks. It was designed for hard disks that never change and merely absorb and disgorge data. When it comes to ordinary data, however, CD-ROMs are simpler still—they only discharge data.

To accommodate other kinds of storage media, the T13 committee added the AT Attachment Packet Interface (ATAPI) to the ATA specifications. The committee based the command set on those used by the SCSI system but otherwise kept the scheme completely compatible with existing ATA hardware and drivers. They did not entirely duplicate SCSI, however. Although ATAPI uses many of the same block and command definitions described by SCSI, it does not use many of the other features of SCSI protocol, such as messaging, bus sharing with multiple computers, disconnect/reconnect, and linking and queuing of commands.

ATAPI changes nothing on the computer side of the AT connection, and it does not affect the design or operation of ATA hard disk drives. It just gives the makers of other storage devices and programmers guidance as to how to link their products to computers in a standard way.

Normally, an ATA hard disk gets its commands through eight registers called the Task File, which passes along all the commands and parameters needed to operate the disk. Unfortunately, these eight registers are not sufficient for the needed CD or DVD control. ATAPI adds one new command, the Packet Command, that initiates a mode in which multiple writes to the Task File will send packets of commands to the CD or DVD drive. Most ATAPI command packets contain 12 bytes, although the standard also defines 16-byte packets for compatibility with future devices.

The first of the 12 bytes in the ATAPI Command Packet (byte 0) is an operation code that defines the command itself. The initial ATAPI specification defined 29 operation codes. The third through sixth byte (bytes 2–5) of each packet hold the logical block address of the data to be used if the command involves the use of data. The logical addresses start with zero as the first block and increase sequentially up to the last block. The eight and ninth bytes (bytes 7 and 8) of the packet define the length of the transfer, parameter list, or allocation involved in the command. Special extended commands add an extra byte for indicating this length. The remaining bytes in the packet were not originally defined but are left reserved for future implementations.

Power Management

In computers where electrical consumption is a critical issue (for example, battery powered notebook machines), the hard disk is one of the major drains of power. Most disk drives meant for portable machines help conserve power by allowing their electrical use to be trimmed when the drive’s fastest response is unnecessary. The T13 committee added power-management commands to the specification starting with ATA-3. This design adds four power modes, which allow frugal computers to economize as the occasions arise:

  • Active mode. This mode means normal operation for a disk drive. All functions of the drive are available, the drive electronics are fully operational, and the disk platters are spinning. The drive can react immediately to any command, including a seek to move its head to read or write data. The only delay is that imposed in normal disk access. The price for this fast access is that this mode consumes the most power, particularly during seeks.

  • Idle mode. This mode is provided more for safety than power savings. The head may move away from the active data area of the disk, but otherwise the drive is fully operational. A seek command sends the head instantly scurrying to the appointed sector with little additional delay. Because the drive does not transfer data in idle mode, the part of its electronics associated with decoding, deserializing, and transferring data from (or to) the disk can be shut down. The part of the electronics that processes commands stays alive, ready to receive instructions from your computer and carry them out.

  • Standby mode. This mode saves power by stopping the spin of the platters and shutting down the spindle motor to eliminate that power drain. The electronics of the drive are left in essentially the same state as idle mode. Only as much of the circuitry is kept awake as is needed to receive commands and activate the rest of the drive when requested. Because the drive must spin up to its normal operating speed before it can read or write data, this mode imposes a delay on all data-handling operations. Typically this delay will be on the order of ten seconds, although the ATA standard allows for a delay of up to 30 seconds.

  • Sleep mode. This mode totally shuts down the hard disk and its electronics. The drive does not listen for commands and cannot act on commands sent to it. The only way of leaving sleep mode is by sending a hardware or software reset command. The reset causes the drive to enter its normal power-up mode as determined by its manufacturer. Sleep mode reduces the power consumption of a drive nearly to zero but incurs the longest delay in accessing data. Not only must the drive spin up its platter, but the rest of the system must also take its normal course through its reset action.

Table 10.7 summarizes and distinguishes the four power-management modes of the ATA specification.

Table 10.7. AT Attachment Power Management Modes

AT Attachment drives with the power-management option also include a built-in standby timer that can shift the drive into its lower-power standby mode after the drive has been inactive for a preset period. This changeover is a function of the drive and occurs automatically without the intervention of the host computer. The host computer can, however, switch off the standby timer so that the drive does not shift to standby automatically. The host computer can then take full command of the power mode of the drive.

To switch the drive from active mode to a lower-power mode, the host computer sends the drive a power-management command. Any drive-access command automatically forces the drive back into active mode. In addition, the AT Attachment standard includes a Check Power Mode command that allows the host computer at any time to determine in which mode the drive is currently operating.

Security

Starting with ATA-3, the T13 committee added device-level password security to limit access to disk storage. Although you set the ATA drive access password through your computer, the drive stores the password on its own media and it uses the same password, even if you unplug the drive from one computer and attach it to another. Consequently, if you activate its password security system and someone later steals your drive, this person cannot access the data stored on the drive.

Depending on the secrecy of your data, you can set security to one of two levels: normal or maximum. The chief ramification of your choice is what happens should you forget your password. Choose normal security, and the drive-maker can recover your data for you. When you set your drive for maximum security, even the drive-maker cannot retrieve your data.

The AT Attachment standard allows for two kinds of passwords:

  • User passwords. These passwords you set yourself to limit access to your drive. The command structure used by the AT Attachment standard allows for passwords up to 32 bytes long. The standard provides a common means of setting these passwords and gaining access to the drive that operates at the interface level. Normally, you’ll deal with a password through your BIOS, operating system, or application software, which links to the drive security system through the ATA interface.

  • Master passwords. These passwords are set at the factory. They are not normally used in the everyday operation of the drive but rather allow for recovery of data by the drive-maker should you forget your password. If you’ve set your drive for normal security, the drive-maker can use its master password to access your data or inactivate the old password so you can change your password to something that you can remember. When you set security to maximum, the master password only allows the drive-maker to erase your drive and restore it to its original condition—blank with no password set. Your files will be gone forever.

Under the ATA security system, your drive operates in one of three modes:

  • Unlocked mode. This is the normal operating mode of the disk drive. The drive carries out all commands sent to it. It can read and write to any of the data areas on the disk. You can also add or change your password in unlocked mode.

    A new drive will normally arrive in unlocked mode. It will operate as unlocked until you set a user password. Thereafter, the drive will always start operating in the locked mode and remain in locked mode until it receives a valid user or master password. Normally, the drive will accept five tries at sending it a password. It will then reject subsequent password attempts until it has been reset.

  • Locked mode. This mode prevents you from accessing or changing any data that’s stored on the disk. In locked mode, the drive automatically aborts all read and write commands without executing them. The drive carries out normally all commands that do not access or alter the data stored on the disk (for example, to enter a low-power mode).

  • Frozen mode. This mode prevents the security features of the drive from being altered. The drive carries out all normal read and write operations but will not change its security level or password. If you value your data, frozen mode will be your standard operating mode so that no one can change your drive password should you leave your computer unattended.

Device Identification

Each device includes 512 bytes of storage for identifying information. Device-makers are free to locate this storage anywhere they want. It can be stored on a nonremovable storage medium, such as a hard disk, or in EEPROM or Flash memory.

Regardless of its location, the AT Attachment standard includes a standard command for reading this identifying block. Using this command, your computer can interrogate the device to find out what it is and automatically configure itself for optimum operation, including maximizing its data-transfer rate. Included are the device parameters, the features supported (including transfer modes and thus speeds), the model number, and the serial number of the drive.

Logical Interface

The AT Attachment interface logically links to the rest of your computer through a series of registers. The standard does not constrain the port addresses used by these registers. Their location is set by the BIOS writer and chipset designer of your computer. The registers are generally inside the motherboard chipset, and the BIOS must be written to match. Add-in host adapters include their own registers and matching add-on BIOS.

Applications and operating systems that use the BIOS never need know the location of these ports. Software drivers for operating systems that bypass the BIOS must be written with the proper register addresses.

Most chipset-makers use the same range of addresses for the I/O ports used in communicating with their AT Attachment interfaces. Consequently, a single set of register addresses has become a de facto standard in nearly all computers. Table 10.8 lists these register addresses.

Table 10.8. AT Attachment Primary Port Host System Registers

A single ATA connection is meant to handle the control of two drives. Most modern host adapters include a secondary port—another connector to plug in a cable for two more ATA devices. The logical location of the ports used by both the primary and secondary AT Attachment host adapters is not fixed and can be set at any of several ranges of values that the hardware manufacturer chooses. The chosen I/O port addresses only need to be reflected in the BIOS routines for interrupt 13(hex) service and the software drivers used to control the board. Nevertheless, most manufacturers use the same ports and interrupts for their primary and secondary AT Attachment ports.

Signals and Operation

The hardware side of the AT Attachment interface is based on the Industry Standard Architecture (ISA) bus, but it is not the complete bus. For example, hard disk drives are not normally memory-mapped devices, so there’s no need to give a hard disk control of the addressing signals (24 of them) of the ISA bus. Instead, the registers of the interface connect to the input/output address space of the ISA bus, and only those signals used in addressing the ATA registers need to be used.

In addition, AT Attachment uses a 16-bit data bus (although it allows for drives that only use eight) as well as a variety of control signals. These include signals to request reading or writing data, to make DMA transfers, to check the results of running diagnostics, and to indicate which of the two drives that can be connected to an AT interface port is to perform a given function. ATA also allows for a “spindle sync” signal so that two drives can spin synchronously, as is required for some implementations of drive arrays.

Connectors

An AT Attachment interface uses any of three connectors for its interface. The most com mon has 40 pins to accommodate its addressing, data, and control signals. As shown in Figure 10.1, one pin is sometime removed and the connector shell is notched. The connector has a tab corresponding to the notch. Together the tab/notch and missing pin key the connector against improper insertion.

Figure 10.1. The 40-pin ATA connector.

The 44-pin connector used by 2.5-inch drives adds the three essential power connections as well as a coding pin. A 50-pin connector additionally allows four vendor-unique pin assignments, which are typically used for indicating master or slave status for a given drive. (Two pin spaces are skipped.) Figure 10.2 shows how the power and vendor-unique pins are arrayed on a 50-pin connector.

Figure 10.2. The 50-pin ATA connector

Regardless of the connector used by a drive, the function assigned each pin remains the same. Table 10.9 lists the signal assignments of the interface.

Table 10.9. AT Attachment Signal AssignmentsTable 10.9. AT  Attachment Signal Assignments

ATA drives that are built in to PC Cards or CardBus cards use the 68-pin connection of the associated PCMCIA standards. These are essentially bus connections and are covered in Chapter 9, “Expansion Buses.”

Signals

Seven of the connections of the AT Attachment interface (numbers 2, 19, 22, 24, 26, 30, and 40) are grounds, scattered among the signals to provide some degree of isolation of one signal from another. Sixteen pins (3 through 18) are devoted to ATA’s 16-bit data bus.

Beside the 16-bit connection system used by all of today’s devices, the AT Attachment specification allows for eight-bit connections through the interface. Such narrow-bus systems use only the odd numbered eight pins in the standard sequence.

The remaining 16 pins of the standard 40-pin connector are assigned various signal-control functions, such as those to manage reading or writing data, make DMA transfers, and coordinate the operation of two drives.

The AT Attachment signals primarily concerned with controlling the transfer of data across the interface are given their own dedicated connections. Commands to the drives and the responses from the drives (including error indications) are passed through 17 eight-bit registers.

The two drives permitted under the AT Attachment standard share the connection and receive all signals across the interface indiscriminately. To signal which drive should act on a given command, the AT Attachment uses a special control register. The same register also determines the head, track, and sector that is to be used at any given time.

Seven signals are used to select among the registers. The registers are divided into two groups: Control Block Registers and Command Registers, indicated by two interface signals. Activating the Drive Chip Select 0 signal (pin 37) selects the Control Block registers. Activating the Drive Chip Select 1 signal (pin 38) selects the Command Block Registers. When the Drive I/O Write signal (pin 23) is active, the registers that accept commands from the host are accessible through the interface data lines. When the Drive I/O Read signal (pin 25) is active, the registers indicate drive status through the data lines.

Drive Address Bus 0 through 2 are located on pins 35, 33, and 36 and control which register is currently selected and accessible through the data lines. The AT Attachment standard defines two read and one write control-block registers as well as seven read and seven write command-block registers. Of these, one write command-block register selects the active drive and head (up to 16 heads are allowed). Two registers select the drive track (allowing up to 65,536 tracks on a single drive), another register selects the sector to start reading from or writing to, and another register selects the number of the track to be read or written. The read registers indicate which drive and head are active and which track and head are being scanned. Other registers provide status information and define errors that occur during drive operation.

The number of register bits available sets the logical limits on device size: up to 16 heads, 65,536 tracks, and 256 sectors per track. Because many computers are incapable of handling more than 1024 tracks, the maximum practical capacity of an AT Attachment drive is 2,147,483,648 bytes (2GB).

During active data transfers, separate signals are used as strobes to indicate that the data going to or coming from the drive or values in the control registers are valid and can be used. The falling edge of the Drive I/O Read signal (pin 25) indicates to the host that valid data read from the disk is on the bus. The falling edge of the Drive I/O Write signal (pin 23) indicates that data on the bus to be written on-disk is valid.

The Drive 16-bit I/O signal (pin 32) indicates whether the read or write transfer comprises 8 or 16 bits. The signal is active to indicate 16-bit transfers.

Normally, AT Attachment transfers are accomplished through programmed I/O, the standard mode of operation using the standard AT hard disk BIOS. However, the AT Attachment standard optionally supports Direct Memory Access (DMA) transfers. Two signals control handshaking during DMA data moves. The drive signals that it is ready to read data and transfer it in DMA mode by asserting the DMA Request signal (pin 21). The computer host acknowledges that it is ready to accept that data with the DMA Acknowledge signal (pin 29). If the host cannot accept all the data at once, it removes the DMA Acknowledge signal until it is ready to receive more.

In DMA write operations, the host computer uses DMA Acknowledge to indicate that it has data available, and the active drive uses DMA Request for handshaking to control the flow of data. The Drive I/O Read and Write signals indicate in which direction the data should flow (as a disk read or write).

An AT Attachment disk drive can interrupt the host computer to gain immediate attention by activating the Drive Interrupt signal (pin 31). On programmed I/O transfers, the drive generates an interrupt at the beginning of each block of data (typically a sector) to be transferred. On DMA transfers, the interrupt is used only to indicate that the command has been completed. (The interrupt used is determined by the host’s circuitry.)

A drive can signal to the host computer that it is not ready to process a read or write request using the I/O Channel Ready signal (pin 27). Normally, this signal is activated; the drive switches it off when it cannot immediately respond to a request to transfer data.

The Drive Reset signal (pin 1) causes the drive to return to its normal power-on state, ignoring transfers in progress and losing the contents of its registers (returning them to their default values). Normally, the drive is activated briefly (for at least 25 microseconds) when the host computer is turned on so that it will initialize itself. Activating this signal thereafter will cancel the command in progress and reinitialize the drive.

The Passed Diagnostics signal (pin 34) is used by the slave drive to indicate to its host that it is running its diagnostics. The Passed part of the name does not mean that the diagnostics are completed successfully but that the results are ready to be passed along to the host system. Actual results (and the command to actually execute diagnostics) are given through the AT Attachment registers.

The Spindle Sync/Cable Select signal (pin 28) can be used at the drive manufacturer’s option to make the drives spin synchronously (as is required by some drive-array technologies) or to set drive identification as master or slave by the cable rather than using a jumper or switch on the drive. When used as a spindle-synchronizing signal, the master drive generates a periodic pulse (typically once each revolution of the disk, although the actual timing is left to the drive manufacturer), and the slave uses this signal to lock its spin to the master. When this connection is used as a cable-select signal, supplying a ground on pin 28 causes a drive to function as the master (drive 0); leaving the connection open causes the connected drive to act as the slave (drive 1).

A single signal, termed Drive Active/Drive 1 Present, located on pin 39, indicates that one of the drives is active (for example, to illuminate the drive activity indicator on the system front panel). The same pin is used by the host signal to determine whether one or two AT Attachment drives are installed when the power is switched on. The drive assigned as the slave is given a 400-millisecond period during system startup to put a signal on this pin to indicate its availability; after waiting 450 milliseconds to give the slave drive time to signal, the master drive puts its signal on the pin to indicate its presence to the host computer. It switches its signal off and converts the function of the signal to drive activity when the drive accepts its first command from the host computer or after waiting 31 seconds, whichever comes first.

Compatibility

As a general rule, all ATA drives support the standard under which they were made as well as all earlier versions of the ATA standard. That is, you can plug the most recent ATA drive into the ATA connector of a vintage computer and have reasonable expectations that it will work. Similarly, you can blow the cobwebs out of drives that conform to earlier ATA standards, plug one into the newest computer, and have it work. (You may have to manually configure your system to accept an old drive by entering parameters into its setup program.)

Plugging a fast drive into a slow system yields a slow drive, however. The interface is not magic and is constrained by the oldest technology in the system. Plug the latest ATA/133 drive into a old computer and you may get a drive the works only in PIO modes. Worse, if your system doesn’t recognize logical block addressing, only a fraction of the total capacity of the drive may be accessible.

In general, you can mix drives with different speed ratings on a single cable. Because ATA handles each transaction individually, the drives should operate at the highest speed at which they are individually capable in the given system.

Wiring

Two different cables are used by the AT Attachment interface. The basic cable is a flat ribbon with 40 conductors and three connectors, all the same. The typical cable puts two connectors close together at one end and a single connector at the other. Sometimes a computer-maker “cheaps out” and only puts two connectors on the cable, so you can connect only one drive (the other end plugs into your motherboard or a host adapter).

The chief problem with the cable design is that it works only for speeds up to 33MHz (that is, ATA/33 or UDMA/33). Higher-speed transfer modes require a more sophisticated 80-conductor cable. The signals in the cable are essentially the same, but every other conductor in the cable is held at ground potential. That way, there is always a ground between two active signals on the cable. The ground effectively shields the two active signals from one another. The ground wires are all linked together in the cable connector. ATA/66 and above interfaces can sense this cable. If they do not find it, they will restrict the transfer speed to 33MHz or less, regardless of the capabilities of the drives you install. Figure 10.3 illustrates the difference between the two cable types.

Figure 10.3. ATA connections for speeds greater than 33MHz require 80-conductor cables

All connectors on an ATA cable are supposed to be keyed (with a missing pin 20) and on the shell of the connectors. In addition, the ATA cable is marked with a red or blue stripe on the edge corresponding to pin 1 on the connector.

Single Drive

All three connectors on an ATA cable are the same, so in theory you should be able to plug any connector into any drive or the host adapter. That’s not the best practice, however. Convenience dictates that you plug the connector spaced farthest from the rest at one end of the cable into your host adapter. Use the two more closely spaced connectors for disk drives.

In a one-drive system, plug the connector at the other end of the cable into the drive and leave the middle connector unconnected. This properly terminates the cable. Otherwise, a fraction of the signal travels down the loose stub and reflects off the unterminated end. The reflected signal travels back and mixes with the signal at the middle drive connector. Because of the time it takes the signal to travel back and forth through the stub, the reflected signal is not a mirror image of the signal at the connector. The signal at the connector will have changed during the travel time. As a result, the combination of the new and reflected signals will be something unpredictable. Figure 10.4 shows how to terminate a single drive properly.

Figure 10.4. Recommended wiring of a single AT Attachment drive.

Two Drives

Connecting two drives to an AT Attachment cable eliminates the electrical concerns. One drive necessarily will be at the end of the cable and terminate it properly. It doesn’t matter which drive connects to which connector—master or slave, big or small, old or new. The connectors are electrically identical.

Three or Four Drives

Most AT interface host adapters enable you to connect more than two drives by providing two distinct interfaces: primary and secondary. Some systems insist you use the primary connection for the drive that boots your computer. Others are more flexible.

In any case, treat both the primary and secondary as an individual ATA interface with its own cable. Always use the last connectors on the cable first, then the connector in the middle of the cable for the second drive. Most dual-interface systems will allow you to connect a single drive to each interface—two drives, two cables, two interfaces.

Master/Slave Designation

The AT Attachment system distinguishes the two drives attached to a single cable by making one the master and the other the slave. The chief distinction is, as a default, the master gets assigned a drive letter first (it gets the letter closer to the front of the alphabet), and the master is usually preferred as the boot drive (although many BIOSs will let you select which drive to boot your system).

All AT Attachment drives have the potential for being masters or slaves. The function of each drive is determined by jumper settings on the drive. These are usually called drive select jumpers or simply indicated with DS near the contact on the drive’s electronic circuit board. Different manufacturers use various designation schemes. A jumper on the pins marked with the “DS,” for example, indicates a master. Other manufacturers might use position-sensitive system. A jumper in one position indicates the drive will act as the master, and the jumper in another position indicates it will be a slave. Most drives have a cable select setting, although few computer-makers implement this feature (by which the cable does, in fact, indicate whether the drive is master or slave).

Only one master and one slave are permitted in a single AT Attachment connection, so each of the two drives in a single AT Attachment chain must have its master/slave jumpers properly set for the system to work. Moreover, most computers will not boot with only a slave drive. Most drives are shipped “jumpered” for operation as the master, so you only have to adjust the second AT Attachment drive you add to your computer—but be sure to check.

Sanctioning Organization

The ATA standards are published and maintained by the American National Standards Institute, Inc., 11 West 42nd Street, New York, New York, 10036. The more recent versions of the ATA standards have been prepared by the T13 technical committee of Accredited Standards Committee NCITS. The committee maintains a Web site that publishes the working documents and drafts of prospective standards at www.t13.org. The final approved standards are available in final form only from ANSI.

Serial ATA

Over the last decade and a half, engineers have used several tricks to extend the life of the ATA interface, such as altering timing and developing new wiring systems. And they’ve succeeded beyond anything that could have been expected at the introduction of the interface. Today’s ATA is potentially 25 times faster than the original. Hard disk drives have yet to exploit the full potential of its latest improvements. But disk developers know they won’t be able to stretch ATA out another 25 times. Nor do they want to. The design has several weaknesses (not all of which are technical).

Looking to the future, on the 15th of February, 2000, Intel, along with several drive-makers including APT, Dell, IBM, Maxtor, and Seagate Technology, announced a radically new conception of ATA that they called Serial ATA. Through an industry association called the Serial ATA Working Group, they published a final specification on August 29, 2001. Although the group expects getting the official imprimatur of a standards organization is still a year off, several companies are already manufacturing to the standard. Seagate demonstrated the first Serial ATA drive in June 2002.

The name indicates the basic concept. Today’s ATA is a parallel interface that uses 16 separate data connections. Serial ATA will use a single data channel operating at a much higher speed—at least 20 times the clock rate of current parallel ATA systems.

The initial specification for Serial ATA calls for an initial peak transfer rate of 150MBps, a little more than a 10-percent improvement over the current top speed for conventional parallel ATA, 133MBps. But parallel ATA has no future, according to the Serial ATA Working Group. It’s unlikely that the speed of the parallel interface could be doubled. The Serial ATA specification, on the other hand, provides a growth path to double and quadruple that initial rate to peak rates of 300MBps and 600MBps. According to the Serial ATA Working Group, that speed potential should be enough to satisfy speed needs for the next decade.

To serialize data on the Serial ATA channel, the system uses conventional 8b/10b encoding (that is, it encodes bytes in ten-bit data groups). To reduce interference levels, it also uses a combination of spread spectrum clock and data scrambling to minimize repetitive bit-patterns in the data stream. The group-coding overhead (ten bits to the byte) results in a 1.5GHz signaling rate on the Serial ATA channel. The higher-speed versions of Serial ATA will push the signaling rate to 3.0 and then 6.0GHz.

The wiring uses four pairs of wires for two balanced signaling pairs—one to the device and one from the device—for full-duplex communications. The total voltage swing between the wires in each pair is only 250 millivolts.

Serial ATA uses a point-to-point connections scheme. That is, only one device connects to each Serial ATA port. Drives will not daisy-chain as they do with today’s parallel ATA systems. To accommodate multiple devices, a host computer needs multiple ports. The typical installation will follow current ATA practice and deliver four ports per computer system—two primary and two secondary ports.

For computer-makers, one of the chief allures of the Serial ATA system is the smaller cable that it used to connect the drive to the computer. Instead of a wide 40- or 80-conductor ribbon cable, Serial ATA will likely use a four-conductor cable with compact connectors, similar to those of USB and FireWire. Such a design will eliminate some of the clutter inside computers. Beside aesthetics, the compact cable will also improve the cooling of the host computer and will likely reduce interference.

Serial ATA retains the ATA designation despite the radical wiring change because it retains full software compatibility with the ATA system. Drives will use the same commands as parallel ATA. Consequently, Serial ATA will work with today’s operating systems and software.

On the other hand, Serial ATA will be incompatible with today’s parallel ATA drives and controllers at the hardware level. You simply won’t be able to plug one directly into the other, although manufacturers may produce adapters to mate one to the other.

The Serial ATA Working Group maintains a Web site at www.serialata.org.

SCSI Parallel Interface

Pronounced scuzzy by much of the computer industry (and much less often sexy by its most fervent advocates), SCSI is a system-level interface that provides what is essentially a complete expansion bus into which to plug peripherals. SCSI isn’t simply a connection that links a device or two to your computer. Rather, it functions like a sub-bus. SCSI devices can exchange data between themselves without the intervention of the host computer’s microprocessor. In fact, they can act across the SCSI bus even while other transfers are shifting across the host computer’s normal expansion bus.

SCSI is even older than ATA. In fact, it’s effectively the oldest interface still in use in personal computers. Originally simply a means to add hard disk drives to minicomputers, SCSI has evolved into a complete interconnection system that can link hard disk drives, CD-ROM players, scanners, and even arrays of hard disks to any kind of computer.

The basic SCSI hardware interface is a parallel connection on a multiconductor cable called the SCSI Parallel Interface (SPI). In original form, the SCSI interface comprised an eight-bit bus with a ninth parity bit for error detection and a maximum clock speed of 5MHz. Since then, four versions of the SPI system have been developed, the most recent of which (SPI-4) pushes the width of the bus to 16 bits (not counting parity) and the peak data rate to 320MBps.

More a place to plug in hard disks, SPI has become an expansion bus that can link up to 15 devices of various types to your computer through a single-port connection. All the devices function independently, under the control of the host system through the host adapter that provides the SCSI port.

Standards

The original SCSI standard evolved from another interface called SASI, the Shugart Associates Standard Interface, developed in 1981 by hard-disk pioneer Shugart Associates working with NCR Corporation. Together they developed SCSI as an eight-bit parallel connection between host computers and disk drives. Later that year, the X3T9 committee of the American National Standards Institute used the SASI specification as the foundation for its work on a parallel interface standard. That standard, now known as SCSI-1, was formally approved in 1986.

Even before the ANSI acceptance of SCSI, manufacturers were wary of the shortcomings in the original specification. In 1985 device manufacturers approached the group working on the standard with proposals to increase the mandatory requirements of the SCSI standard. Because the standard was already near completion and the industry was impatient, ANSI adopted SCSI while at the same time forming a new group to develop a set of commands for SCSI with broader application, eventually published (though not as an official standard) as the Common Command Set.

Because the Common Command Set was not a mandatory part of SCSI, each device manufacturer made its own interpretation of it. As a result, individual SCSI devices often required their own driver software, and many combinations of SCSI devices simply wouldn’t work together at all.

SCSI-2

In 1991, a revision of SCSI was introduced to help fix some of the problems in mating SCSI devices, as well as to increase the speed of SCSI transfers. Referred to as SCSI-2, the new standard integrated the newly developed Common Command Set with several optional hardware enhancements.

Through the Common Command Set, SCSI-2 embraces communications as well as other storage devices. It incorporates specific command sets for read-only and erasable optical devices, in addition to CD-ROM. Other commands control devices that can change the medium on which they store data (for example, cartridges), such as optical jukeboxes. SCSI-2 also includes commands for printers (carried over from the original SCSI), scanners, and communications equipment.

Hardware improvements included the broadening of the eight-bit SCSI data bus to Wide SCSI, which doubled the bus width to 16 bits. In addition, the top speed of SCSI transfers was doubled with the addition of Fast SCSI. With an eight-bit bus width, Fast SCSI pushed transfer rates up to 10MBps; Wide and Fast SCSI could peak at 20MBps. Wide SCSI also expanded the number of possible devices connected to a single host adapter channel from 7 to 15.

SCSI-3

Almost immediately after the SCSI-2 standard was approved, the industry began work on its successor, SCSI-3, to refine the standard further. Although not formally approved at the time this was written, SCSI-3 has been out in draft for long enough that most manufacturers have incorporated its requirements into their designs. For the purposes of this discussion, SCSI-3 is considered the current standard.

Rather than a single standard, SCSI-3 has become an umbrella that covers a multitude of individual hardware and protocol standards. Notably, it divorces software from hardware so that the Common Command Set and the various cabling systems go their separate directions. At that, SCSI itself becomes a command protocol, and the various interconnection standards control how you wire your peripherals together.

At the hardware level, SCSI-3 brought with it the first generation of the SCSI Parallel Interface, along with three other interconnection systems. Serial Storage Architecture currently delivers two channels of 20MBps transfer rate for full-duplex operation (a device can transmit and receive simultaneously at that data rate). P1394 gives a 100MBps serial system that plugs together like a set of stereo components. Fibre Channel Arbitrated Loop provides a 100MBps system that uses simple plug-in connections for the disk drive and a bridge to optical fiber with even higher speeds. These hardware standards give SCSI-3 enough headroom to take peripheral connections into the next generation—and the next incarnation of SCSI.

After the introduction of the SCSI-3, the parallel interface was independently revised as SPI 2 through 5 (currently). Table 10.10 summarizes some of the various SCSI standards, their official designations, and the popular names of the speed modes included under them.

Table 10.10. SCSI Standard Documents

Clocking

SCSI Parallel Interface allows for both asynchronous and synchronous transfers. Asynchronous transfers allow data to be sent at irregular intervals using start and stop bits to mark the beginning and end of data bytes. Synchronous transfers use system timing to define data bytes. Because synchronous transfers require less overhead—fewer bits need to be transferred and less processing of the data is required—they can be faster. The first implementation of synchronous SCSI is sometimes called Fast SCSI, usually with a designation of the bus clock speed.

Asynchronous SCSI

Asynchronous SCSI operates as a handshaking system. First, a device issues a request (signaling REQ) and waits for an acknowledgment (ACK) to be sure its request was received before doing anything else. In every step and every byte of the transfer, this two-step process must take place. Actual transfers require four steps: First, one device sends the REQ and it is answered by ACK. The first device turns off its REQ and waits for the other device to switch off its ACK before the first device can go on to the next byte.

Each of these handshakes must travel down the SCSI cable, so the signal must go back and forth through the cable twice for each transfer. Although electrical signals are fast, they travel at a finite and measurable speed, about one-third the speed of light in a vacuum. In typical SCSI cables, it takes a signal about 5.25 nanoseconds to move one meter. This travel time is termed the propagation delay, and it is the primary constraint on the speed of asynchronous SCSI transfers in long cables. The longer the cable, the longer the delay.

Although the original SCSI standard puts a speed limit of 1.25MBps on asynchronous transfers, that rate applies only to the longest permitted cables, 25 meters. Shorter cables can achieve higher rates using asynchronous transfers.

The overhead involved in transferring each byte across the parallel SCSI bus using asynchronous signaling is about 160 nanoseconds. Adding in the propagation delay sets the minimum cycle time and maximum transfer rate of the connection.

Synchronous SCSI

Synchronous SCSI requires an acknowledgment for each request sent, but it allows the acknowledgment to be delayed. Consequently, a device can send packets one after another without enduring the propagation delays required in interlocked handshaking. Synchronous SCSI operates at a speed determined by its cycle time without regard to propagation delay. In other words, the speed of synchronous SCSI is independent of cable length.

The first clock speed specified for synchronous transfers was 5MHz. Through the years, the standard has raised this speed, with each improvement doubling the speed of its predecessor. Each improvement also earned a distinctive name. Fast SCSI boosts the clock speed to 10MHz. Ultra SCSI kicks it up another increment to 20MHz. Ultra2 SCSI doubles the speed again to 40MHz. Ultra160 SCSI doubles it again, to 80MHz. Today’s fastest, Ultra320 SCSI, leaves the bus speed alone but double-clocks the data so that transfers are made on both the rising and falling edge of each clock cycle. Therefore, data moves at twice the clock speed.

The most recent SPI standards also permit double-clocking, the transfer of two data bits on every clock pulse—one on the rising edge, one on the falling edge. In fact, double-clocking is necessary to achieve the highest peak rates for all the most recent SPI standards. Double-clocking was introduced with the SPI-3 specification.

Bus Width

The current SCSI parallel interface standards allow the use of either an 8- or 16-bit data bus, with the latter moving data twice as fast as the former. The 16-bit version usually is called Wide SCSI. Under early SCSI standards, a wider, 32-bit bus was also allowed, although it was never commercially implemented. The SPI-3 standard declared the 32-bit bus obsolete.

Under the SCSI-3 standard, Wide SCSI is an optional implementation. However, the wide bus is mandatory for Ultra160 and Ultra320 SCSI connections.

Table 10.11 lists the nomenclature and speed limits (more correctly, peak transfer rates) of today’s common parallel SCSI connection systems.

Table 10.11. Comparison of SCSI Parallel Interface Performance Specifications

Capacity and Addressing

SCSI devices store data in the form of blocks. Each block is assigned an address, and a host indicates which block to read or write by its address. The size of each block and the number of available addresses constrain the capacity of any given device.

The original SCSI command structure provided 21 bits for identifying block addresses, sufficient for 2,097,152 blocks. With hard disk drives that used blocks of standard 512-byte sectors, this addressing scheme allowed for drives storing up to 1GB.

The SCSI-2 refinement allows for a full three bytes (24 bits) for encoding block addresses by taking advantage of three bits reserved under the earlier implementation. SCSI host adapters designed to that standard can access up to 16,777,216 blocks, which with sector-size blocks limits capacity to 8GB, or 8,589,934,592 bytes. Larger drives could be accommodated by defining blocks as multiple sectors.

Increasing block size is a band-aid solution, one that only covers up an underlying problem. Consequently, the current SCSI Block Commands now include a second form of read, write, and related commands that allocate four bytes (32 bits) for block addresses. Using the new commands, the system can address up to 4,294,967,296 blocks, enough to handle devices storing 2TB (2,199,023,255,552 bytes) of data.

Note that some early SCSI host adapters suffered addressing limits imposed by design choices made by their manufacturers. In particular, many old host adapters made before about 1995 may limit addressing to 1GB or less. In other words, large-capacity SCSI devices may not work properly with older host adapters.

Signaling

SCSI systems can use any of three kinds of signaling: single-ended and two forms of differential signaling. Early generations of SCSI devices used single-ended signals, as do many modern low-cost and/or low-speed devices. Differential signaling allows for higher speed and is mandatory under the fastest SPI standards.

Single-ended SCSI uses an unbalanced (or single-ended) electrical signal—a single wire for each signal, with all signals in the bus using a single common ground return. Differential SCSI uses balanced (or differential) signals. Each signal on the SCSI bus has its own return line that is isolated from the reference ground. Differential SCSI signals use twisted-pair wiring. Most SCSI implementations have been single-ended because they require half the pins, cheaper wire, and simpler electronics than do differential SCSI implementations.

As with all single-ended electrical systems, single-ended SCSI is more prone to picking up noise and interference than differential SCSI. As a result, the specifications for SCSI systems that use single-ended signals limit cable lengths to no more than 6 meters (just under 20 feet). Differential SCSI allows for bus lengths up to 25 meters (about 82 feet). You must have at least one-third meter (about 12 inches) of cable between SCSI devices, so the shortest possible SCSI cable is that length. External SCSI cables should be shielded.

The voltages on the single-ended SCSI vary a bit with speed. The levels used are summarized in Table 10.12.

Table 10.12. Single-Ended SCSI Signaling Levels

Instead of centering the logic signals on zero volts, differential SCSI signals are designed so that the currents flowing during logic transitions exactly cancel out each other in the two signal conductors. When one of the two differential signal lines transitions from low to high, the other goes from high to low. Even though both high and low are positive values, the current flows cancel. The current flow generates the magnetic field that limits performance as well as generates interference.

The first differential signaling system used by the SCSI system was quite tolerant of high common-mode voltages (for instance, noise). Called High-Voltage Differential (HVD) SCSI, the difference between low and high signals was required to be one volt or more. The maximum voltage for a low signal is 1.7 volts; the minimum for a high signal is 2.7 volts. The common mode voltage, which is the same on both the positive and negative signals lines, can range from –7 to +12 volts.

The SPI-3 standard declares HVD signals obsolete. They should no longer be used in new SCSI devices.

The SPI-2 specification introduced another differential signaling scheme that ensured the appearance of only lower voltages on the SCSI lines, making the system compatible with single-ended signaling. Called Low-Voltage Differential (LVD) SCSI signaling, this scheme is optional for speeds of 20MHz and under and mandatory for clock speeds of 40MHz and higher, including Ultra2 SCSI, Ultra160 SCSI, and Ultra320 SCSI.

Wiring

Because SCSI is a bus, its wiring is essentially simple. The pins of the connectors on one device are directly linked to the pins of the same position (and function). You can run a straight cable (no twists or crossovers) from the host adapter to one SCSI device, then on to the next. Unfortunately, reality interferes with this idealized connection system. All the variations of the parallel interface need to be taken into account. As a result, the mechanics of the actual cabling vary with bus speed and width, whether your SCSI connections are strictly inside your computer, external to it, or both.

SCSI also saddles you with two other worries: device identification and termination. The proper operation of a SCSI system requires that you get both of these setup chores right.

SCSI Identification

As a bus, all devices are simultaneously connected and receive all transmissions (commands and data). Commands are routed to individual SCSI devices by identifying them by their SCSI address. Standard SCSI systems use eight dedicated lines in the SCSI cable for identifying devices. Each device uses one line, allowing eight unambiguous addresses that translate into SCSI identification (SCSI ID) numbers. In eight-bit SCSI systems, these are usually designated in standard Arabic numerals as SCSI ID numbers 0 through 7. Wide SCSI systems expand the identification possibilities to 0 through 15. In either case, one number (usually the highest) is reserved for the SCSI host adapter. The other addresses, 0 through 6 or 0 through 14, can be assigned to any device connected anywhere in the SCSI chain. Each address is assigned a priority to the device using it, with the host adapter having the highest address (7 or 15) and therefore the top priority. The device with a SCSI ID of 0 always has the lowest priority.

In the latest SCSI systems that operate under the Plug-and-Play aegis, you don’t have to worry about these numbers. The SCAM system (which stands for SCSI Configured Automagically) does exactly what its name implies—it queries each SCSI device and assigns nonconflicting ID numbers to each one it finds. For SCAM to work, of course, your host adapter, operating system, and SCSI devices must comply with the standard. Note, by the way, the magically part of the name was applied in the initial standard, although some less inspired engineers are apt to interpret the name to be SCSI Configured Automatically.

If you have an older host adapter and a mess of old SCSI devices, you’ll be left to configure them without prestidigitation. And that’s where the complication of SCSI begins. Except for the arbitrary address of 7 assigned to the host adapter (or 15 in Wide SCSI systems), you assign the addresses that each SCSI device uses. The most basic rule is simple: Each SCSI ID number must be unique, so never assign the same ID number to two or more devices in the same SCSI chain.

In the formal SCSI scheme of things, you can assign any number to any device, as long as you configure your software properly. The SCSI specification does not reserve any particular number for any device. As a practical matter, you cannot be so cavalier about the ID numbers that you use for different devices. One concern is matching your software. A SCSI driver may require that you indicate the SCSI address that you assign to your CD-ROM player. The software for the CD-ROM player may demand that you assign a particular address to the player in order for it to work.

If there is any one guide to follow, it is the model set by Adaptec, the largest maker of SCSI host adapters. To provide some consistency for its host adapters that emulate Western Digital WD1002 controllers so they can boot your computer, Adaptec chose rather pragmatically that you must assign your boot hard disk drive (if it is a SCSI drive) ID number 0. Newer SCSI systems allow you to choose the ID number for the boot device.

The SCSI ID controls the arbitration priority of the device to which it is assigned. In the SCSI scheme, device ID 0, oddly enough, receives the lowest priority in arbitration. Device 7, usually the host adapter, receives the highest priority. In Wide SCSI systems with a 16-bit bus, the priority system is a bit more complex, but device 7 maintains the greatest priority. Table 10.13 summarizes the relationship between device ID and arbitration priority on the Wide SCSI bus.

Table 10.13. Wide SCSI Arbitration Priorities by Device ID

Early host adapters had built-in BIOSs that enabled the boot drive and one additional drive to link to your computer without an additional software driver. In order for your second drive to be recognized when using this kind of controller, the second hard disk must have ID number 1. Many of the latest SCSI host adapters include an advanced BIOS capable of recognizing up to seven hard disk drives, giving you the freedom to assign them any ID, providing you give the boot device ID 0. The BIOS recognizes disk drives (and dispenses drive letters) according to the order of the ID you assign. The lower numbers get the first drive letters.

Some host adapters put one more restriction on your freedom in assigning device IDs. If you cannot get a device to be properly recognized in a SCSI system based on an older host adapter, you may need to check the host adapter manual to see if it enforces any restrictions on SCSI ID assignment.

Internal SCSI devices such as hard disks typically have several jumpers or switches on each device that set its SCSI ID. The location of these selectors varies, but they’re usually easy to find. Look for a set of jumpers with some form of the legend “ID” silk-screened on the circuit board. Older drives often offer a row of seven jumper pairs numbered 0 through 6, with one jumper spanning a single pair. With these, setting the ID is easy. Move the jumper to the ID number you want. Other drive manufactur ers use a binary code to set the ID, so you’ll face a set of three header pin pairs that require from zero to three jumpers, depending on the ID you want.

Newer drives typically use a binary code for assigning the ID number. Four pairs of pins allow the choice of any ID from 0 to 15. Figure 10.5 gives an example of this binary coding scheme.

Figure 10.5. SCSI ID binary code shown as jumper positions.

Drives vary in the location and labeling of these identification pins, so you should check with the instructions supplied with a given drive or the drive-maker’s Web site for guidance in setting the ID number you want.

External SCSI devices commonly use two forms of selector switches for choosing the SCSI ID number assigned to the device: pushbutton and rotary switches. Figure 10.6 illustrates both of these selectors.

Figure 10.6. The pushbutton (left) and rotary selector switches for setting the SCSI ID.

Pushbutton selectors allow you to ratchet up and down the series of identification numbers by pressing two push-tabs on the selector. Some switches cycle around and around without stopping; others limit their movement from 0 to 7. You only need to push the appropriate button until you see the SCSI ID you want in the small adjacent window.

Rotary switches select the SCSI ID numbers like an old-fashioned television channel selector, the miniature equivalent of the rotating knob. Most of these rotary switches require a small screwdriver to adjust, preventing them from getting inadvertently changed by bumping the back of the SCSI device.

Note that nothing in the design of the SCSI Parallel Interface precludes two computers sharing one chain of SCSI devices except for SCSI identification numbers. Because each device in a single chain must have a unique ID, two host adapters assigned SCSI ID 7 cannot coexist. If you can alter the ID number assigned to the SCSI host adapter in either computer, however, you can connect both in a single SCSI chain. Either computer will be able to access the various devices. In theory, the two computers could transfer files between one another as well, but most SCSI software makes no provision for such installations.

Cable Connections

Once you’ve manually configured your SCSI devices with the proper ID numbers (or left matters to the Fates under SCAM), you have to connect them all together. The SCSI system uses a straightforward daisy-chain wiring system—each device connects to the next one down the line.

The exact mechanics of the wiring system depends on whether you have internal or external SCSI devices or a mixture of both.

Internal Devices

An internal SCSI system is like a flexible expansion bus. Instead of connectors to a printed circuit board, the bus takes the form of a ribbon cable, and the expansion connectors are plugs on the cable. One end of the cable plugs into your SCSI host adapter. Each drive attaches to one of the plugs in the cable.

All plugs on the cable have identical signals, so you can use any convenient connector for any SCSI device. The devices and host adapter use SCSI ID numbers to sort out which commands and data go where.

For best operation, always plug a device into the last connector at the end of the cable. When this device is terminated (explained later in this chapter), it prevents signal reflections from the end of the wire that might interfere with the operation of the SCSI system.

Modern SCSI devices may use 50-, 68-, or 80-pin connectors. The last two (and one form of the first) are molded in a vague “D” shape that acts as a key, so you cannot plug in a drive improperly. Older 50-pin connectors sometimes are not keyed and can pose orientation problems.

As with nearly all ribbon cable systems, a red (or sometimes blue) stripe on one edge of the cable used by SCSI devices marks the polarity of the cable. The stripe corresponds to pin 1 of the SCSI connector. Most internal 50-pin SCSI connectors and receptacles are also keyed with a tab and corresponding notch in the middle of one long edge of the connector and receptacle. When you look into the holes of the cable-mounted female SCSI connector with the keying tab on top, pin 1 (and the red stripe) appears on the left, as shown in Figure 10.7.

Figure 10.7. The keying of an internal SCSI cable connector.

The SCSI cable in systems with 50-pin and 68-pin connectors links both control and data signals. However, it does not provide power to the individual internal SCSI devices. Each SCSI device will also require you to plug in its own power connector. The 80-pin SCA system includes power in its connections.

Drives that use the 80-pin system are designed for hot-swapping. You can plug them in at any time, even when your computer is running. The other connection systems require that you switch off your computer before you plug in a drive.

External Devices

External SCSI cabling is somewhat different from that of internal devices. Using the external SCSI cabling system, you run a cable from the host adapter to the first device in the external SCSI chain. For the next device, you plug another cable into the first device and then plug the other end of the cable into a second device. Just continue in the same manner, adding another cable for each additional device.

Most external SCSI devices have two SCSI connectors to facilitate their daisy-chain connection. It doesn’t matter which of the two connectors on the SCSI device you use to attach each cable. Functionally, both connectors are the same; each is equally adept at handling incoming and outgoing signals.

The empty jack on the last device gets a terminator (unless the device has other provisions for termination). The complete wiring system is a daisy-chain as shown in Figure 10.8.

Figure 10.8. External wiring of the SCSI Parallel Interface.

Wider bus SCSI systems may require two cables to link each device in the chain. The cables run in parallel following the same daisy-chain path as a single cable SCSI system.

As long as the SCSI system is properly terminated, cable length is not supposed to matter, providing that each of the cables is between 18 inches (one-half meter) and six feet (two meters) long. High-frequency electrical signals such as those used by SCSI sometimes act differently from what the rules predict, so the length and placement of the cables may affect SCSI operation. Rearranging the cables in a recalcitrant system can sometimes bring the entire SCSI chain to life.

After you finish connecting your SCSI cables, be sure to snap in place the retaining clips or wires on each SCSI connector to be sure that each connector is held securely in place. This mechanical locking is particularly important with SCSI connections because the wiring works like old-fashioned Christmas lights—if one goes out, they all go out. Not only will whatever SCSI device that has a loose connector be out of touch, all other devices after the loose connector in the chain also will lose communication. Moreover, because the chain will no longer be terminated properly, even the devices earlier in the chain may not work reliably. Locking the wire on each SCSI connector will help ensure that none of the connectors accidentally gets loosened.

Mixed Devices

When your SCSI system has a mixture of internal and external devices, the wiring is exactly as you would expect—a mixture of both of the preceding schemes. Most SCSI host adapters have connectors that allow you to link both internal and external devices at the same time. The individual rules for internal and external wiring apply to the respective parts of the system. The only change is in terminating the system, as discussed in the next section.

Terminations

Eventually all SCSI daisy-chains must come to an end. You will have one last device to which you have no more peripherals to connect. To prevent spurious signals bouncing back and forth across the SCSI cable chain, the SCSI standard requires that you properly terminate the entire SCSI system. The SCAM system can automatically activate the proper terminations in a SCSI system. For manually settings, the SCSI-2 standard allows for two methods of terminating SCSI buses.

Alternative 1 is the old-fashioned (original SCSI) method of passive terminations using only resistors. Alternative 2 uses active terminations, which means the terminator uses a voltage regulator to ensure the voltage on the SCSI line remains constant.

In classic SCSI implementations, the three most popular physical means of providing a SCSI termination are internally with resistor packs, externally with dummy termination plugs, and using switches. SCSI-2 systems with active terminations usually use switches.

Resistor packs are components attached directly to circuit boards. Unlike the other interfaces, SCSI devices typically use three resistor packs (instead of one) for their terminations. Most computer-based SCSI host adapters and hard disks come with termination resistors already installed on them.

You can easily identify terminating resistors as three identical components about an inch long, one-quarter to three-eighths of an inch high, and hardly an eighth inch thick. Most commonly, these resistor packs are red, brownish yellow, or black and shiny, and they are located adjacent to the SCSI connector on the SCSI device or host adapter. When neces sary, you remove these terminations simply by pulling them out of their sockets on the circuit board. Figure 10.9 shows two of the most common styles of terminating resistor packs—those in DIP and SIP cases.

Figure 10.9. Passive terminators

External SCSI terminators are plugs that look like short extensions to the SCSI jacks on the back of SCSI devices. One end of the terminator plugs into one of the jacks on your SCSI device, and the other end of the dummy plug yields another jack that can be attached to another SCSI cable. Some external terminators, however, lack the second jack on the back. Generally, the absence of a second connector is no problem because the dummy plug should be attached only to the last device in the SCSI chain.

Switches, the third variety of termination, may be found on both external and internal drives. Sometimes a single switch handles the entire termination, but occasionally a SCSI drive will have three banks of DIP switches that all must be flipped to the same position to select whether the termination is active. These switches are sometimes found on the SCSI device or on the case of an external unit.

A few external SCSI devices rely on the terminators on the drive inside their cases for their terminations. For these, you must take apart the device to adjust the terminators.

According to the SCSI specification, the first and last device in a SCSI chain must be terminated. The first device is almost always the SCSI host adapter in your computer. If you install a single internal hard disk to the host adapter, it is the other end of the chain and requires termination. Similarly, a single external hard disk also requires termination.

With multiple devices connected to a single host adapter, the termination issue becomes complex. Generally, the host adapter will be one end of the SCSI chain, except when you have both internal and external devices connected to it. Then, and only then, should you remove the terminations from your host adapter. In that case, the device nearest the end of the internal SCSI cable should be terminated, as should the external device at the end of the daisy-chain of cables (the only external device that likely has a connector without a cable plugged into it). Remove or switch off the terminators on all other devices.

Maximum Cable Length

SCSI host adapter maker Adaptec provides these rules of thumb as recommendations for the maximum cable length under various SCSI standards, speeds, and number of connected devices. Table 10.14 lists these recommendations.

Table 10.14. Maximum Recommended SCSI Cable Lengths

The general rule underlying these recommendations is to divide 30 by the bus clock to derive the maximum recommended cable length in meters. The rule does not apply to Ultra2 SCSI because of the special low-voltage differential signals used under that standard.

Cables

In the current SCSI scheme of things, only two different cable types are used. These are designated the A cable and the P cable.

The A cable has 50 conductors and serves for all eight-bit SPI systems, both single-ended and differential. Similarly, the 68-conductor P cable serves wide signaling systems.

The purpose assigned each conductor in the cable varies with the type of signaling used and the connector system. The allowed variety is wide. In fact, the cable is a minor concern compared to connector considerations.

Connectors

More than any other standard computer wiring system, SCSI suffers from a plague of connectors. Not only do internal and external devices use different connector styles, but both also come in a wide variety. Beside separate internal and external connector styles, the system also suffers from generational differences.

The SPI-3 specifications acknowledge eight connector systems—four nonshielded alternatives for internal devices and four shielded systems for external devices. In the past, computer-makers have used other designs to suit their particular requirements. Table 10.15 summarizes the SPI connector options.

Table 10.15. SCSI Versions and Cabling Requirements

The oldest SCSI devices use 50-pin connectors. More recent devices use 68-pin connectors that support wide as well as narrow SCSI implementations. Many hard disk drives use 80-pin connectors (also called SCA for Single Connector Attachment) that integrate power as well as the SCSI signal onto a single connector, allowing for the easier hot-swapping of devices—in particular, the hard disks used in massive disk arrays (see Chapter 17, “Magnetic Storage”).

For the most part, a SCSI connector is like a shoe. If it fits, use it. All too often, however, your SCSI device comes equipped with a connector that looks weirdly different from the one on the cable you’re trying to snap onto it. You can prevent problems by checking the connector type used by the SCSI cables in your computer and matching any device you buy to your cabling. SCSI devices—hard disk drives in particular—often have several connector options. When buying a new drive, choose the one that fits. Adapters are also available for matching unlike connectors. Within the limitations noted in the next section, an adapter is often sufficient to get any SCSI device to link up with any host adapter.

50-pin Internal Connectors

The initial incarnation of the SCSI interface was the basic 50-contact pin connector used on the first SCSI drives. Officially, this system is termed the nonshielded connector alternative 2.

Basically a glorified header, this connector featured two parallel rows of pins in a rectangular array, the centers of the pins separated at increments of 0.1 inch, both horizontally and vertically. Figure 10.7 shows the male connector of this type as you would find it on the rear of a SCSI device.

At one time, nearly all SCSI devices that used the eight-bit implementation of the standard used this connector. However, both SPI-2 and SPI-3 offer another 50-pin nonshielded design that’s more compact and more consistent with current circuit design practices.

Termed the nonshielded connector alternative 1, this design also uses two parallel rows of pins. As with the older connector, the rows are spaced on 0.1-inch centers, but the individual pins in each row are spaced at only half that distance, 0.05 inch. The female receptacle is molded with a vague “D” shape. The male connector has a matching extended D-shaped perimeter that protects the pins. Drives use the female connector as a jack. Figure 10.10 shows this connector.

Figure 10.10. The 50-pin nonshielded connector alternative 1.

Although both nonshielded connector alternatives 1 and 2 have 50 pins, the functions assigned each pin differ between the two alternatives. In fact, there are four variations: single-ended alternative 1, single-ended alternative 2, differential alternative 1, and differential alternative 2. You cannot tell the four options apart by merely looking at the connector. You must check the specifications of the drive to determine the signal type it uses.

50-pin External Connectors

The most common form of external SCSI connectors has 50 pins arranged in two rows of 25 and looks like an enlarged Centronics printer connector. This connector is termed the shielded connector alternative 2 under SPI-2 and SPI-3. It is still the most common 50-pin connector used by external SCSI devices and is shown in Figure 10.11.

Figure 10.11. The 50-place ribbon connector, shielded connector alternative 2.

The shielded connector alternative 1 also offers 50-pins to external devices. It uses the same layout and signal system as the alternative 1 nonshielded connector, except the mating portions of the connector are metal shields. Figure 10.12 shows this connector.

Figure 10.12. The 50-place external shielded connector alternative 1.

As with the nonshielded 50-pin connectors, shielded connector alternatives 1 and 2 differ in the functions assigned each pin. The pin-outs of the connector alternatives are the same as for the nonshielded versions. Because of the physical similarities and identical pin-outs, you can plug a raw drive into an external shielded alternative 1 connector (providing you don’t mix the single-ended and differential signaling systems). The nonshielded and shielded versions of alternative 2 also share the same signal assignments with their pins, but the connectors are physically incompatible.

Some older external SCSI devices and host adapters used classic 50-pin D-shell connectors with the same signal assignments as the A connector. They never attracted a following because they were simply ungainly, about four inches long. These resemble the alternative 1 connectors but the pins are round rather than square, more widely spaced, and staggered. Figure 10.13 shows this large connector.

Figure 10.13. The nonstandardized 50-pin D-shell connector.

More popular was a design that trimmed the length of the D-shell connector in half by similarly trimming the pin count. These shorter, 25-pin D-shell connectors saved space and were popularized by Apple Computer for its Macintosh equipment. The connectors are identical to those used by most computer-makers for their parallel port connections. Despite the similarity, the signals on the SCSI and parallel ports are entirely different and should never be connected together.

To reduce the number of pins required, this style of connector eliminates many of the ground return signals used in single-ended SCSI. These connectors do not have enough connections for differential signals. Figure 10.14 shows this connector.

Figure 10.14. The female 25-pin D-shell connector used by some SCSI products.

68-pin Connectors

Wide SCSI requires more connections than are possible with a 50-pin connector. To accommodate all the required signals, the SPI standards specify a set of 68-pin connectors. This connector system offers both nonshielded and shielded alternatives for internal and external devices.

Both the nonshielded and shielded versions use essentially the same design and the same signal assignments. The chief difference is the roughly D-shaped metal shield surrounding the contacts of both male and female connectors, with the shield also protecting the bare pins of the male connector, much as in a classic D-shell connector.

Both connectors are termed alternative 3. That is, the internal set make up nonshielded connector alternative 3, and the external set nonshielded connector alternative 3. Many sources refer to either the shielded or nonshielded connector simply as a SCSI-3 connector. Do not be misled by this label, which is best seen as an abbreviation for SCSI alternative 3 connector. All SCSI-3 systems do not use this connector system. In fact, the SCSI-3 standard allows any of the eight connector alternatives—as well as the connectors for the various other physical interconnection systems besides SPI.

The pins of the alternative 3 connectors are arranged in two rows of 34 male contacts. The pins within each row are located on 0.05-inch centers, and the two rows are spaced on 0.1-inch centers. Figure 10.15 shows the shielded version of this connector.

Figure 10.15. The 68-place shielded connector alternative 3.

The SPI specifications allow for a second style of shielded 68-pin connector that looks like a miniaturized version of the classic 50-place external SCSI ribbon connector. Termed the shielded connector alternative 4, it uses the same pin-out as alternative 3. Instead of pins, it has two rows of ribbon contacts spaced at 0.0315-inch intervals. Figure 10.16 shows this connector.

Figure 10.16. Shielded connector alternative 4.

80-pin SCA

Hot-swapping drives requires that both control signals and drive power be connected quickly and easily. To accommodate the needed power signals, drive-makers developed the 80-pin SCSI connector system. Under the SPI rubric, this is the nonshielded connector alternative 4. Figure 10.17 shows this connector.

Figure 10.17. The 80-pin SCA connector.

The SCA connector is designed chiefly for internal use—for sliding drives into racks. There is no external equivalent to the SCA connector.

All the pins on the connector on the SCA device are the same length. On the host end, however, several of the pins are extended so that they make contact first when the drive gets plugged in. These longer pins (numbers 1, 36–43, 45, 46, and 78–80) ground the drive, supply power to it, and set its SCSI ID number. The added length ensures that the drive powers up properly and is properly identified before it presents signals to the bus.

Mixing SCSI Standards

SCSI comes in so many flavors that you’re likely to have devices that follow two or more standards that you’ll want to hook together in a single chain. With modern host adapters that allow you to configure the transfer characteristics assigned to each SCSI ID, you can freely mix standards with a reasonable chance that you can get everything to work together. Better still, you can tune all devices to operate at their maximum transfer rate, with only a few exceptions.

In most cases, however, you can’t just string together a mixed collection of SCSI peripherals with complete impunity. You still have to consider issues of bus width, signal type (single-ended or differential), and clock speed to make optimal connections. Some things just won’t fit—and others you may not want to fit.

Bus Width

In theory, you can mix wide (16-bit) and narrow (8-bit) SCSI devices in a single chain. However, you must follow some rules.

With an internal chain of mixed devices, the wide ribbon cable carries the full compliment of signals to all the devices in the chain. The last device in the chain (the one that provides the termination) should be wide. You may need an adapter for each narrow SCSI device you want to plug into the wide chain.

To mix wide and narrow SCSI devices together in an external SCSI daisy-chain, you need to follow one rule: Wide goes first. The most important rule is that you must chain all of the wide devices together, plugged into the host adapter, then chain the narrow devices after the wide chain. A narrow device won’t pass through the signals of a wide device, so any wide device after a narrow one in the chain will lose its wide-bus option.

Signaling System

The original SCSI specifications allowed for two types of SCSI buses: single-ended and differential. These quite different signaling systems are inherently incompatible. Although adapters help mate them together, dangers remain. For example, connecting a single-ended device such as a CD-ROM drive to a differential host adapter or a differential drive to a single-ended host adapter may physically damage both the host adapter and the drive. Because the SCSI connector system does not distinguish between signal types, you must be sure of the signal types used by all the devices in your SCSI system before making the first connection.

The single-ended and high-voltage differential signaling systems are incompatible and cannot be used on the same bus. In addition, high-voltage and low-voltage differential signaling types are also incompatible. Connecting a single HVD device to an LVD system could damage all the LVD devices in the system. In theory, single-ended and LVD devices can be chained together, but you need to be sure the full array of differential signals get to the LVD devices—which means not only differential signals but also the wide bus signals for Ultra160 and Ultra320 SCSI, which demand a wide bus for proper operation.

Clock Speed

Although the different top speeds of SCSI devices might appear to be a problem and limit all the devices, no matter how fast, to the speed constraints of the slowest, the issue never arises. The SCSI host adapter only communicates with a single device at a time, and those communications monopolize the SCSI bus while they are taking place. In today’s SCSI systems, transfers do not go directly between devices but instead must travel through the host adapter. For example, to back up a hard disk, the disk first sends a block of data to the host adapter, which temporarily stores the data in system memory. When the disk finishes sending its block, the host adapter moves the data from memory to the tape drive. Consequently, the two SCSI devices—hard disk and tape drive—communicate with the host adapter independently of one another and may operate at different speeds.

A modern host adapter can adjust its speed to suit whatever devices with which it communicates. In general, it will set itself to transfer data to each device at the top speed at which that device can operate.

The one big exception to the “any speed” rule is Ultra2 SCSI. Put simply, you cannot attach an ordinary SCSI device to an Ultra2 SCSI port and expect Ultra2 SCSI peripherals to operate at top speed. The issue is not really speed, however. All Ultra2 SCSI devices use LVD signaling. Most ordinary SCSI devices use single-ended (SE) signaling. When you plug an SE device into the Ultra2 bus, the bus reverts to SE operation; otherwise, damage would result. The SCSI host adapter would send the negative-going differential voltages into a direct short-circuit because the associated signal pins are grounded in the single-ended device. Although reverting to single-ended operation minimizes the chance for damage, it also limits the speed potential to ordinary Ultra SCSI because the highest speeds of Ultra2 SCSI require the added integrity of differential signaling.

Operation and Arbitration

All devices connected to a single SCSI bus function independently, under the control of the host system through the SCSI adapter. Rather than just using signals on dedicated conductors on the bus that can be understood by devices as dumb as a light bulb, SCSI presupposes a high degree of intelligence in the devices it connects and provides its own command set—essentially, its own computer language—for controlling these devices.

Boot Up

Most software drivers search for their target devices when they are booted into your system. Consequently, all your external SCSI devices should be running when you switch on your computer. Turn on your SCSI devices before you switch on your computer, or use a power director (outlet box) that ensures that your entire computer system—computer and SCSI peripherals—switch on simultaneously.

Arbitration

Not only is SCSI more like an expansion bus of a computer than a traditional hard disk interface, but it also resembles today’s more advanced Micro Channel and NuBus designs. Like the latest computer buses, SCSI provides an arbitration scheme. Arbitration enables the devices connected to the bus to determine which of them can send data across the bus at a given time. Instead of being controlled by the host computer and suffering delays while its microprocessor does other things, the arbitration of the SCSI bus is distributed among all the devices on the bus.

Arbitration on the SCSI bus is handled by hardware. Each of the up to seven SCSI devices is assigned a unique identifying number, usually by setting jumpers or DIP switches on the drive in a manner similar to the Drive Select jumpers on an ST506 device.

When a device, called the initiator, wants to access the SCSI bus, it waits until the bus is free and then identifies itself by sending a signal down one of the SCSI data lines. At the same time, it transmits a signal down another SCSI data line corresponding to the other SCSI device, called the target, that it wants to interact with. The eight data lines in the SCSI connection allow for the unique identification of seven SCSI devices and one host.

Note that SCSI devices can initiate arbitration on their own, independent of the host. Two SCSI devices also can transfer information between one another without host intervention. A SCSI hard disk, for example, may back itself up to a SCSI tape drive without requiring the attention of (and thus robbing performance from) its host computer. Better than background operation, this form of backup represents true parallel processing in the computer system.

In addition, SCSI provides for reselecting. That is, a device that temporarily does not need bus access can release the bus, carry out another operation, and then resume control. You can command a disk drive to format, and it can carry out that operation without tying up the bus, for example. The net result is, again, true parallel processing.

Because SCSI is a high-level interface, it also isolates the computer from the inner workings of the peripherals connected to it. The SCSI standard allows hard disks to monitor their own bad tracks independently from the computer host. The disk drive reassigns bad tracks and reports back to its computer host as if it were a perfect disk. In addition, hard disk drives can be designed to automatically detect sectors that are going bad and reassign the data they contain elsewhere, all without the host computer or the user ever being aware of any problems.

Sanctioning Organization

The American National Standards Institute (ANSI) maintains the official SCSI standards. SCSI standards in their final, published form are available only from ANSI.

The SCSI T10 Committee actively develops the various SCSI standards. It provides recommendations to ANSI, which, on its approval, sanctions the specifications as industry standards. The committee acts as a forum for introducing and discussing proposals for the standards. The committee maintains a Web address at www.symbios.com/t10.

The SCSI Trade Association promotes the use of SCSI and devices that adhere to that standard. The association maintains a Web site at www.scsita.org.

Fibre Channel

At one time, some engineers regarded Fibre Channel as the successor to the SCSI Parallel Interface for high-performance disk drives. Although it has been used successfully in many drive products, it has yet to earn the following of the other interfaces. The steady advance in the speeds of other interfaces has severely eroded its edge in performance. Both AT Attachment and the latest versions of parallel SCSI outrace Fibre Channel’s 100MBps capabilities. Among personal computers, it remains a viable, but not popular, interface.

The current implementation of Fibre Channel used for mass storage systems is actually a specialized derivative subset of the technology called Fibre Channel Arbitrated Loop (FC-AL). Although even this slice of the standard allows a variety of cabling options, including twinaxial, coaxial, and optical connections, its chief use in mass storage currently is as a backplane interface. That is, FC-AL drives link directly to printed circuit boards in their computer hosts without any cabling between.

At that level, you don’t have to understand FC-AL to use it. If you are physically capable of putting a drive in a bay, you’ve mastered all you need to know. In modern computers, the drives and interface are self-configuring and should require no intellectual intervention on your part.

Development of FC-AL began in 1992 with the creation of the Fibre Channel Systems Initiative, a group of three leading workstation manufacturers (Hewlett-Packard, IBM, and Sun Microsystems) with the specific goal of overcoming the inherent problems with the SCSI Parallel Interface.

As with all modern serial systems, Fibre Channel is packet based. The same circuit and protocol that carry the data also handle all control information. Commands to retrieve a particular block from a disk drive, for example, are carried through the system as data in the form of standard SCSI-3 commands. The drive collects the packets sent for it, interprets them, and carries out the commands. It sends data back, when requested to, in the same data packet form.

Although with hard disk drives you’ll probably only have to deal with the backplane connector, the Fibre Channel Arbitrated Loop specifications allow for a great variety of wiring systems. All FC-AL systems take the form of a loop, even the backplane connection. Each device in the loop has separate input and output connections. The output of one device connects to the next device in the loop, until the last device, which connects back to the first and completes the loop. Disconnecting a device from the loop may interrupt communications. Consequently, systems such as drive arrays that permit hot-swapping of devices have built-in port bypass circuits that route the loop signaling around the removed device.

The principal body governing the promotion and development of Fibre Channel standards is the Fibre Channel Association. You can get in-depth information about Fibre Channel, products using it, and meeting schedules, from the association at the following address:

Fibre Channel Association

12407 MoPac Expressway North 100-357

P.O. Box 9700

Austin, TX 78766-9700

Phone: 800-272-4618 or 512-328-8422

Fax: 512-328-8423

E-mail: fca@fibrechannel.com

The Fibre Channel Loop Community, a working group that’s part of the association, is focused on the FC-AL standard. The address of the Fibre Channel Loop Community is as follows:

Fibre Channel Loop Community

P.O. Box 2161

Saratoga, CA 95070

Phone: 408-867-6630

Web site: www.symbios.com/fclc/fclcmain.htm

Floppy Disk Interface

Some things are immutable, changing not at all as the years pass—the constellations in the sky, the crags and rocks of tall mountains, your credit card balance. The floppy disk interface fits in there pretty well, too. It’s basically the same connection used on the first personal computer more than two decades ago. It sits there, waiting for you to slide in a boot disk so it can show you all of its stuff.

Part of the reason for this immutability is that the function of the floppy disk hasn’t changed over the years. The floppy disk remains a boot device, a data-exchange system, and a backup system—although an increasingly feeble one. At one time, however, it was your only choice for each of these functions. The world has, of course, changed in the intervening years, and the floppy disk is at best the fallback choice for each of these functions. Your needs and the rest of your computer hardware have long passed by floppy technology. In the next few years, the floppy disk and its interface may be left behind.

But the floppy disk interface is not as unchangeable as you might think. During its short history, its speed has notched up twice, its connectors have changed, and the range of devices linking to it has broadened. And its role has changed. CDs have replaced the floppy disk for just about every purpose except emergencies. You could live without a floppy disk drive. Many sub-notebook computers get along perfectly well without them. Every once in a while, though, the need for a floppy arises, and the interface proves useful.

Controller

The floppy disk controller brings the interface to life. Its basic purpose is to convert the requests from the BIOS or operating system, couched in terms of track and sector numbers, into the pulses that move the head to the proper location on the disk. In this translation function, the controller must make sense from the stream of unformatted pulses delivered from the drive. It first must find the beginning of each track from the Index pulse and then mark out each sector from the information embedded in the data stream. When it identifies a requested sector, it must then read the information it contains and convert that information from serial to parallel form so that it can be sent through the computer bus. In writing, the controller must first identify the proper sector to write to—which is a read operation—and then switch on the write current to put data into that sector before the next sector on the disk begins.

Most of the hard work of the controller is handled by a single integrated circuit, the 765 controller chip, or rather the equivalent of its circuitry inside your computer’s chipset. The 765 circuitry works much like a microprocessor, carrying out certain operations in response to commands it receives through registers connected to your computer’s I/O ports. This programmability makes floppy disk controllers extremely versatile, able to adapt to changes in media and storage format as the computer industry has evolved. None of the essential floppy disk drive parameters are cast in stone or the silicon on the controller. The number of heads, tracks, and sectors on a disk are set by loading numbers into the registers of the 765 circuitry. The values that the controller will use are normally loaded into the controller when you boot up your computer.

Special software can reprogram your controller to make it read, write, and format floppy disks that differ from the computer standard. The most common alternate format is the Distribution Media Format used by Microsoft to stuff extra information on floppy disks used for distributing software in the years before programs came on CD.

Operation

In its heart and in operation, the floppy disk interface is a glorified serial port to which Dr. Frankenstein’s son, the mad engineer, grafted a cable and drive. The control electronics help the drive keep spinning at the right speed and know where to move its head.

It’s so simple that if two drives get connected to a floppy disk controller, they get all the same signals all the time, except for one. Two Drive Select signals are used to individually select either the first or second drive, usually drives A or B. If the signal assigned to a particular drive is not present, all the other input and output circuits of the drive are deactivated, except for those that control the drive motor. In this way, two drives can share the bulk of the wires in the controller cable without interference. However, this control scheme also means that only one drive in a pair can be active at a time.

Two signals in the floppy disk interface control the head position of each of the attached drives. One, Step Pulse, merely tells the stepper motor on the drive with its Drive Select active to move one step (that’s exactly one track) toward or away from the center of the disk. The Direction signal controls which way the pulses move the head. If this signal is active, the head moves toward the center.

To determine which of the two sides of a double-sided disk to read, one signal, called Write Select, is used. When this signal is active, it tells the disk drive to use the upper head. When no signal is present, the disk drive automatically uses the default (lower) head.

Writing to disk requires two signals on the interface. Write Data contains the information that’s actually to be written magnetically onto the disk. It consists of nothing but a series of pulses corresponding exactly to the flux transitions that are to be made on the disk. The read/write head merely echoes these signals magnetically. As a fail-safe that precludes the possibility of accidentally writing over valuable data, a second signal called Write Enable is used. No write current is sent to the read/write head unless this signal is active.

Four signals are passed back from the floppy disk drive to the controller through the interface. Two of these help the controller determine where the head is located. Track 0 indicates to the controller when the head is above the outermost track on the disk so that the controller knows from where to start counting head-moving pulses. Index helps the drive determine the location of each bit on a disk track. One pulse is generated on the Index line for each revolution of the disk. The controller can time the distance between ensuing data pulses based on the reference provided by the Index signal.

In addition, the Write Protect signal is derived from the sensor that detects the existence or absence of a write-protect tab on a floppy disk. If a tab is present, this signal is active. The Read Data signal comprises a series of electrical pulses that exactly matches the train of flux transition on the floppy disk.

Cabling

The original computer floppy system is the standard for nearly all floppy disk systems. It was designed so that you can install floppy disk drives with a minimum of thought—which gives you an idea of what manufacturers think of their assembly line workers. Once you understand a few simple rules, you can do as good a job as they can—or even better.

Drive Select Jumpers

New floppy disk drives simply plug into a floppy drive cable with no changes or settings. Old drives, however, had drive-select jumpers or switches that allowed you to adjust a given drive as unit zero or one. These settings allowed you to adjust a drive to suit systems that did not follow the current fashion (it’s not really a standard) in personal computers. When you install one of these older drives, you must adjust the switches or jumpers to identify the drive as unit one rather than zero. Typically you install a jumper on the pins marked DS1 (for Drive Select One).

Terminations

Similarly, older systems required the last drive (the one at the end of the cable) to be terminated with a small chip full of resistors. The second drive (if installed) was left unterminated. For practical reasons, termination is no longer a concern. The problems of improper drive termination have proven minimal; manufacturers simply include a termination on all drives and design floppy disk controllers to work adequately whether they have one or two terminations on a given cable.

Drive Cabling

The cable used by your floppy disk system is key to its proper operation. A twist in the cable actually sets how the two drives get identified. The twist occurs in five conductors in the ribbon cable between the two drive connectors. This twist reverses the drive-select and motor-control signals in the cable as well as rearranges some of the ground wires in the cable.

Because all drives are set up as the second drive, this reversal makes the drive attached to the cable after the twist the first drive, drive A. In other words, drive A is attached to the connector at the end of the cable, the one where the wire twist takes place. Drive B is attached to the connector in the middle of the length of the cable. The third connector, at the end of the cable with no twist, goes to the floppy disk controller or host adapter. Figure 10.18 illustrates the floppy disk cable and the proper connections.

Figure 10.18. Classic floppy drive cable showing proper connections.

Connectors

Physical aspects of the floppy disk interface have changed subtly over the years. The original computer floppy disk controller used an edge connector to attach to the floppy disk cable. Since about 1984, controllers generally have used pin connectors, although edge-connector products appeared into the 1990s. Similarly, the connectors on floppy disks migrated from edge connectors to pin connectors. With older computers, this difference can be critical when you need to get the correct cable. With modern computers, you’ll want a cable that uses only pin connectors. Figure 10.19 contrasts the two connector styles.

Figure 10.19. Floppy disk cable connectors—edge connector (left) and pin connector.