2.      Inside the Basics

2.1.    ID's and LUNs

        Every SCSI device need to have a unique ID on the bus. For this
        reason, most devices have three ID jumpers to set the SCSI ID
        from 0 to 7. In most cases, ID 7 is reserved for the host adapter.
        ID 0 is for a boot device and is usually a hard drive. ID 1 is
        normally used for a second hard drive, but this is not a require-
        ment. Some host adapter BIOS' or software drivers will notify you
        that the device for ID 0 is not a hard drive if another type of
        device is using this ID. This is not an error, so don't be too
        concerned with the message. ID 2 and up are normally used for
        other devices with ID 2 being popular with CD ROM's. With the
        exceptions of ID 0 and 7, there is no particular ID that *has*
        to be assigned to any device type. Use what you want, the host
        adapter will sort them out with ease.

        Additionally, every ID can have up to seven sub-units identified
        by a LUN (Logical Unit Number). Thus, you can address multiple
        devices through one ID, like dual drives (Bernoulli did this on
        their external Dual Bernoulli Boxes).
        LUNs are mostly used in bridge controllers, that use the LUN-
        subaddressing scheme to emulate a big disk drive with multiple
        smaller disks. Up to eight disks could be combined to a big
        disk drive, where the single drives are addressed by LUNs. A
        special case of these bridge controllers are RAID controllers.

        By using LUNs, theoretically you could attach 49 devices to
        one bus cable (7 IDs * 7 LUNs, without ID 7 for the host
        adapter), if you use all LUNs for specific devices. But LUNs
        are only very seldom used in PC applications. One reason for
        this might be the possible performance loss with this much
        devices on one bus.
        ID's have an impact on device priority, please see 7.3 on this.

2.2.    Termination

        The SCSI bus needs to be "terminated". This means, both ends of
        the bus must have a circuit of some sort to eliminate signal
        reflections that would occur from the physical ends of the bus.
        There are various circuit schemes of termination, the two most
        popular are drawn below.
        The termination circuit needs some power, and, to deliver this,
        there is a line called TERMPWR or Termination Power on the bus.
        Mostly, the TP source is the host adapter, for this reason you
        can see fuses on most host adapters, mostly about 1.5 Amp types.

        A more thorough diagram of the various termination
        configurations is in App. C.

        18 signal lines need to be terminated:
        All data lines (DB(0) - DB(7) and DB(P)), ATN, BSY, ACK, RST,
        MSG, SEL, C/D, REQ, and I/O.

        Termination power needs to be between 4.25 and 5.25 Volts
        _at the termination resistors_ . For most host adapters use the
        PC's +5V for getting their TP and protect it with a silicium
        diode (0.7 Volts loss) against wrong polarity, you might get in
        trouble with the additional voltage loss on the cable and fuse -
        sometimes like an 'X' mark seeking for the point of trouble....

2.2.1.  "Classic" Passive Termination

        The "old" passive termination ("Alternative 1" in the SCSI-2
        spec) came with SCSI-1 and simply was made of a 220 Ohms pull-up
        and a 330 Ohms pull-down resistor per signal in a circuit like
        this:

             
                 Termination Power (TP) +5V
             
            220 Ohms
                                       Signal
        
             
            
             
            330 Ohms
             
              Ground 0V
            

        This termination scheme mostly works, especially with short bus
        lengths, but it draws a lot of power from the TP provider.

2.2.2.  Active Termination

        Active termination (also called "Boulay"-Termination after Paul
        Boulay, "Alternative 2" in the SCSI-2 spec) consists of a
        110 Ohms resistor per signal pulled up to a 2.85 volts power
        supply. Most SCSI-2 and all Fast SCSI-2 devices i know support
        this termination type.

         TermPWR
                                             R3
                                         \/\/\/  -DB(0)
                                         .              .
           Voltage Regulator             .              .
           Ŀ                   \/\/\/   .
        Ĵ 2.85 V  Ĵ              .
            R1           \/\/\/   .
                         C2  C3                   .
        C1                         \/\/\/   .
                 Ĵ                            .
                                    \/\/\/  -I/O
                        R2               R20
                             
                        

2.2.3.  Forced Perfect Termination (FPT)

        There is another Termination scheme out, called FPT.
        According to what I heard of it, it uses diode clamps to
        two regulated voltages to eliminate under- and overshoot.
        Clamp values should be at about 3.0 and 0.5 volts.
        The clamping to two regulated voltages in the signal range
        instead of clamping to TP and ground gives the diodes an
        earlier switching point and thus enhances signal quality, as
        the over- and undershoot elimination process begins earlier
        in the signal.
        From the concept below, FPT should be even better than "normal"
        active termination.
        I have no FPT circuit, as I have never seen a FPT terminator,
        but the rough schematic below (from the Internet SCSI FAQ)
        should be not too far away from reality....

        TP ĿVoltage Regulator
            Ŀ
             VR1 
            
       about     Ŀ           + 3 V
       3.6 V ?Ĵ VR2 
                          -+-
                                 /_\ D1
                                  
                      pull-up     
              /\/\/\ Signal
                      resistor    
                                 -+-
                                 /_\ D2
                 Ŀ          
              Ĵ VR3 
                            + 1.2 V


        However, i got another concept for FPT, also called "Trung Le"
        Termination, that seems to be the 'original' FPT. It uses mostly
        diodes and seems to have two nasty little drawbacks - it allows
        about 10 milliamperes higher current than allowed in the spec,
        thus being a bit risky for the line drivers - 10 milliamperes
        means 25 percent over spec; also it seems a bit unstable with
        low TP voltages.
        So, it seems that the above diagram is a different sort of
        "second-generation" FPT, maybe the variant that Aeronics sells.

2.3.    SCSI Connectors

        There are many different connectors for SCSI. Some of them were
        defined with SCSI-1 and now obsolete, like the DB-50 connector.
        The most common ones today are the 50-pin Centronics-type SCSI-1
        connector, the 50-pin High Density SCSI-2 connector and the DB-25
        connector Apple introduced on their Macintosh computers.
        Most new host adapters and external devices use the SCSI-2 HD
        connector and in this case you normally can trust that it's a
        "real" SCSI-2 device.
        The pinouts of the common connectors are shown in Appendix A.

2.4.    Cables, Cable Lengths, Repeaters

        Cable lenghts are defined up to 6 meters maximum in SCSI-1 and
        SCSI-2 for a single-ended SCSI bus and up to 5 MHz data rate.
        So, the variants

        - "standard" asynchronous transfer (mostly up to 3.3 MBytes/sec)
              -and-
        - "standard" synchronous transfer (5 MBytes/sec)

        can have up to these 6 meters _total_ cable length for the bus.
        Keep this in mind, if you use long cables, and don't forget the
        cable lengths for the internal device cables.
        With Fast SCSI-2 the highest possible data rate doubled to 10MHz
        in synchronous mode and - you might guess it - the cable length
        was halved. So, if you use Fast SCSI-2 devices, your _maximal_
        SCSI bus length is 3 meters.
        SCSI-2 allows up to 10 cm cable "stub" length from the device
        to the main bus cable. Sometimes this length is exceeded,
        causing higher capacitive loading. Sometimes this even works,
        for the maximal allowed stub length for any device-to-device
        connection is 20 cm, but don't _expect_ that to work reliably
        over 10 cm, especially with 10 MHz Fast SCSI-2 signalling.
        Also, if you have two or more devices on the bus with 30 cm or
        less (about 12 inches), their capacitance might add up and give
        you an impedance discontinuity. This could give you additional
        reflections - _real_ trouble. So, although this is not an
        'official' rule, keep it in mind when making your own cables.

        A differential SCSI bus can use the full cable length up to 25
        meters (approx. 82 feet) and keep the max. data rate of 10 MHz.
        This is especially important with external devices, as most
        external single-ended cables can't cope with 10 MHz.

        All cables should have matching impedances - not easy (means
        impossible) with flat and round cables on the same bus. Mainly
        for this reason, IBM uses shielded flat cables on their higher-
        end SCSI subsystems, for example on the AS/400 systems.

        There are a lot of rules and rules-of-thumb for SCSI cables
        that make a good external SCSI cable an _expensive_ cable.
        The SCSI documents have lots of technical details about cabling.
        For example, a three-layer twisted-pair wire placement scheme
        with defined impedance rules is recommended for external cables
        that makes the cable not so easy (means expensive) to produce.
        Therefore, there are a lot of external cables made from standard
        wire with too low impedance in the 50 to 70 Ohms range instead
        of the recommended 90 to 110 Ohms.

        In a few years of practice with SCSI, I saw a lot of errors and
        faulty behaviour suddenly go away with a change to high-quality
        cables.
        Without trying to advertise - Amphenol seems to be one source of
        high-end SCSI cables - at least Adaptec recommended them until
        they started selling (very good !) cables themselves.

        There are some "repeater" devices for SCSI that seem to work.
        Basically, these are fast(!) bidirectional signal amplifiers
        including termination for each side. Personally, i don't know
        one, but iX, a german Unix magazine, mentioned a device called
        "ACI-1074A" from a company called "Applied Concepts" - whoever
        is this...

2.5.    Signal levels

        Single-Ended SCSI signal levels vary from 0V to +5.25V. All
        signals are active low. 'True' is a voltage level between 0
        and +0.8 V and 'false' is a voltage between +2 and +5.25 V.
        Differential SCSI signals conform to the EIA RS-485 interface.

2.6.    Single-Ended and Differential SCSI

        There are two different electrical SCSI interfaces,
        Single-Ended and Differential SCSI.
        Single-Ended, "Standard" SCSI has (sic! <g>) single ended TTL
        transceivers that allow up to 5 MHz data transfer rates with up
        to 6 meters cable length or up to 10 MHz data transfer
        (Fast SCSI) with up to 3 meters cable length.
        Differential SCSI has RS-485-style transceivers that allow up to
        10 MHz data transfer rate, but with cable lengths up to 25 meters
        and with much better S/N conditions.
        Important is, Single-Ended and Differential devices are _not_
        electrically compatible with each other. If you try to mix them,
        you'll likely end up in destroying the Single-Ended devices on
        the bus and - less probably - even the differential device(s).
        The DIFFSENS line enables a security circuit - if you connect a
        differential device to a single-ended bus, the DIFFSENS line is
        grounded and this should disable the drivers on the differential
        device. However, years ago when i had a few contacts with
        differential SCSI devices, not all devices had this security
        feature enabled, so "better safe than sorry".

2.7.    Synchronous and Asynchronous Transfers

        For the data transfer, SCSI can use two handshaking modes,
        Asynchronous and Synchronous. The used signals and handshake
        mechanism is basically the same, with a REQ requesting each
        byte of information, and an ACK acknowledging it.
        The main difference is, Asynchronous transfer is a "classic"
        REQ/ACK handshaking system for each data packet, while
        Synchronous Transfer Mode allows overlapping of multiple
        REQ/ACK cycles. For example, the initiator could request data
        and request the next ten bytes with ten fast REQ pulses. The
        target would assert the data, pulse the ACK signal, asserts
        the next data byte and pulses ACK again and so on...
        Only data transfers can be synchronous. Command transfers
        always are asynchronous. (See also 7.4)

        By default, only asynchronous transfers are used. Synchronous
        transfer must be negotiated between the host adapter and the
        device, before it is used. The same is true for Wide
        transfers.


2.8.    Synchronous and Wide Data Transfer Requests

        Synchronous Transfer Negotiation includes a timing agreement.
        If devices negotiate a data transfer period of less than 200 ns,
        it is called a "Fast synchronous data transfer". Here you see
        that Fast-SCSI-2 is only an extension to synchronous transfers.
        A similar negotiation happens for Wide transfers. Only if both
        devices agree on using Wide data transfers and which sort (16 or
        32 bit), they are used. This ensures logical compatibility with
        older devices, as all Wide devices _must_ also support 8 bit
        transfers. More details about this in chapter 7.

2.9.    SCSI Disconnect / Reconnect

        Typically, not all SCSI commands can be processed immediately.
        For example, rewinding a tape or scanning a page with an image
        scanner can take a long time, as can seeking to a sector on a
        CD-ROM or hard disk.
        Such operations can tie up the CPU unnecessarily while waiting
        for the device to complete the task. For these cases, SCSI has
        a defined way for a device to disconnect from the SCSI bus, thus
        freeing the SCSI bus for other SCSI transactions or at least
        freeing the CPU from being tied to the SCSI bus waiting for the
        operation to complete.
        When the disconnected device completes this operation, it can
        reconnect to the bus, causing a hardware interrupt.
        When this interrupt occurs, bus control is returned back to that
        SCSI operation, which then completes.

        This SCSI "disconnect/reconnect" mechanism provides overlapped
        I/O functionality, thus allowing multiple outstanding SCSI
        requests with different devices to be processed at the same
        time. Especially with devices with higher typical command times,
        this is a very valuable SCSI feature.

        Disconnect/Reconnect is virtually useless for DOS, but is a big
        bonus point for SCSI on multitasking operating systems like Unix,
        OS/2, or Windows NT. Windows doesn't count here, for it is based
        on DOS. Maybe Windows 95 (or 96 <g>?) will change that.

