Friday 4 October 2013

Learning PCI

PCI also known as conventional PCI these days is short form for peripheral component interconnect. Basically, PCI is a backplane interconnect bus. PCI is used to connect external hardware to computer local bus.

Brief history:

Before PCI, buses like ISA, EISA and a standard proposed by VESA were used. ISA supported 16-bit bus and operated at 4.77MHz. EISA supported 32-bit bus and operated at 8MHz. The VESA bus was 32-bit and was a direct connection to CPU. It operated at 25MHz. the problem was that it was directly connected to CPU and if more than one device was connected, it used to overload the CPU. Considering all these scenarios, Intel brought PCI into picture which was initially connected to front side bus through a bridge.



PCI is a 32/64-bit bus which is used to connect network card, modems, USB, serial, TV tuner cards, modems to processor. It has a 33MHz and 66MHz variant speeds. The next version of PCI, PCI-X operates at 133MHz. PCI bus extends from main processor to PCI connector which is also called PCI slot. Then the expansion cards (network, sound, etc) are connected to these slots. A device can also be placed on the main board and connected via PCI bus without the need for slots. In such a case, we call it a planar device. PCI bridges are used to connect two PCI buses.

PCI has a variant of +3.3V, +5V cards. The type is decided by the slot on the PCI cards. The notch distance from the back plate determines supply variants. A +3.3V card has notch at a distance of 56.21mm from the back plate. a +5V version card has notch at a distance of 104.47 from the back plate. there are universal cards which have +3.3V as well as +5V support and they have two notches.

PCI uses reflected wave switching technique for transmission. This technique can use a unmatched line for signal transmission. so, due to PCB constraints and signal mismatch, the leading edge at the receiver may have a low level and gets reflected. the reflected signal adds up to the forward signal and this level must be enough for signal detection at the receiver. This helps to have low power consumption, low cost. but only problem is that frequency of transmission will be less as transmitter has to synch up and stop transmission until round trip delay of first bit of data. The opposite of reflected wave switching is incident wave switching which is used in VME bus. This requires stringent matching mechanism as the signal must be received in the first trot without any reflection. This eats up some power.


PCI pin out:

Hardware design considerations of PCI:
  • A PCI device connected to slot should not have capacitance of mare than 10pF, else it may cause timing issues
  • The maximum routing length for clock is 2.5"
  • PRSNT1#, PRSNT2# pins must have pull-up on the main board. These help in detecting the PCI device.
  • The routing of INTA# till INTD# to PCI slots is not parallel. they are rotated for each slot. 
  • The status of PRSNT1#, PRSNT2# determines power (25W, 15W, 7.5W)
  • The routinglength of 32-bit bus is restricted to 1.5" and routing length of 64-bit is restricted to 2"
  • A maximum of 10 loads can be connected on a 33MHz PCI bus. Motherboard is treated as one load. A PCI card is treated as two loads. So, a maximum of 4 PCI slots can be present on the PCI bus.
  • For a 66MHz operated bus, the load size will be half and with above consideration only two PCI slots can be present.
  • For an on-board PCI devices, maximum load is two.
  • To enable 66MHz operation, M66EN must be pulled high.

Some important points about PCI:
  • PCI in little-endian
  • 66MHz devices use only 3.3V
  • PCI latency timers work at PCI clock rate. PCI device holds the bus until the counter internally reaches zero. then it releases the bus and any PCI device waiting for the bus can take control in this time.
  • When a PCI device is inserted into PCI-X slot, it's speed is limited to that of PCI only. 
  • Mostly available devices in market are 5V
  • PCI best suites for Wi-Fi applications when compared to USB.
  • The PCI frequency can vary from 0 to 33MHz. the actual frequency is 33.333MHz
  • When a reset signal is issued, all the PCI signals are tristated.
  • The start/stop of transaction in PCI is indicated by FRAME#
  • IRDY# is asserted by device to convey that it is ready to transmit/receive data
  • PCI specification specifies the timing, electrical, mechanical, protocol requirements of PCI bus.
  • Initiator, Agent, Target are the terminologies used to describe PCI devices. Initiator is the master which holds the bus and initiates transaction. Target is the slave and is the target of initiator for data transfer. Either an initiator or target connected to PCI bus is called an agent.

Mini-PCI:

Mini-PCI is a computer bus standard mainly for laptops where as PCI is used for desktops. This is because it is not feasible to have that big slots on a lappy. It is again a 32-bit interface with 33MHz operation switching at 3.3V. This Mini-PCI is power limited and maximum power supported is 2W. there are even options for driving low power modes using pins like CLKRUN# which disables clock. Wi-Fi, BT, Fast Ethernet, modems and other devices use this mini-PCI.  Like PCI, this also supports bus mastering and DMA access. there are 3 form factor cards supported on PCI namely Type I, Type II and Type III. Type I and Type II standard defines 100-pin stacking connector. Type III defines a 124-pin edge connector.

How does interrupts work in PCI?

There are 4 interrupt lines (INTA#, INTB#, INTC#, INTD#) in PCI. These lines are available to all the PCI devices connected to a system. Based on these interrupt lines, the interrupt request is processed by the system BIOS. If two card slots are present, the INTA# position on slot is taken by INTB# on second slot,In this way, the interrupt pins are rotated in the PCI slots. the interrupt service mechanism is little bit complex and may lead to leading edge issues if more than one PCI device tries to drive the interrupt signal. To avoid this problem, Message signaled interrupts are used in PCIe, where device writes to memory to indicate that it is ready to communicate.

Let us assume, a PCI card is plugged in, what are the initial sequence of events that are going to happen?

The device gets the master access to the PCI bus. The presence of PCI bus is determined by the hardware signals. The BIOS is going to read the configuration data of the device plugged in and is stored in configuration space of the memory. This determines the type of card and other characteristics of the card. This further read by operating system determines the memory address space and I/O address space to be assigned. Generally, the address space is in GB and configuration space is 256B.

No comments:

Post a Comment