Monday, 21 October 2013

Using crystals in embedded applications - Part 1

Generally, for most of embedded applications we tend to use external crystal. Whether it be processor, micro controller, FPGA, SoC clock source is must. The other frequencies required as per interface (like USB, PCIe, SPI, I2C, etc) are derived from the internal PLL of the controllers. Crystal to be used in a application has some load capacitance which need to be achieved using external crystals also taking parasitic capacitance into consideration.

Along with these load capacitors you might have observed resistors used in two ways:
  • Resistor in parallel to crystal
  • Resistor in series with XTALIN pin

Generally, we follow the processor or crystal datasheet and go ahead using these resistors. These datasheets generally give the values for these resistors to be used and we will be least bothered to know about the purpose of those. Before going to know the purpose of those resistors let us see the types of crystals used in applications:
  • Series resonant crystals
  • Parallel resonant crystals

The oscillator configuration inside processor or a controller  is a pierce oscillator type and we add an external crystal. For a series resonator type there are no reactive components in the feedback where as in a parallel resonator type we have reactive components in feedback. the only difference is that parallel resonant crystal is fixed to oscillate at a specific frequency for a given load capacitance.

But why do we use resistors?

As mentioned, a pierce oscillator is inside a controller. A pierce oscillator is formed by a TTL or CMOS device. The important thing to remember here is that this device (which is inverter) inside the processor or controller must be biased properly to start oscillation or to maintain oscillations.  

parallel resistor helps for DC biasing to keep the inverter in active region. The value preferred is in Kilo ohm to Mega ohm.The only problem with this resistor is that it spoils the 'Q' of crystal. Generally, in micro controllers, this resistor is inside. Check out the micro controller datasheet to know whether to include this resistor outside or if it is already present. If resistor is large, feedback will be less and oscillator tend to be slow.

A series resistor  helps to prevent overdrive of crystal and helps to increase the life time of crystal (aging of crystal). The value of resistor used is less than <500 ohm. The main disadvantage is power consumption and it reduces the gain margin of the circuit.

How does load capacitance effect oscillator?

We have to keep in mind that load capacitance is formed by external capacitors and parasitic capacitance. The sum of these capacitance must match load capacitance of crystal. If load capacitance is less than the desired value, oscillator runs fast. If load capacitance is higher than the desired value, oscillator runs slow.

Sunday, 20 October 2013

Understanding Short circuit protection in regulators - Part 1

Have you ever experienced your tracks getting burnt, ic getting damaged because of excessive current. It is because you don't have a short circuit protection for your circuit. During power on, validation engineers do check for shorts but during the course of validation improper reworks causing shorting due to lead balls falling between ground and power pins may cause over current to flow and damage your circuitry.

This kind of shorts are random and deterministic. So, care must be taken before hand. In a design, it always adds up a additional circuitry to implement such short protection mechanisms. For taking care of such cases, modern day regulators are coming up with short circuit protection within the ic itself. This causes the regulator to shutdown (or restrict the current ti Imax automatically) in case there is a short circuit. As the regulators are the main sources of current, if they are controlled first hand, then, it always provides a shield to the entire circuit. So, applying short circuit protection at the source is a common design trend. Check the old regulators, you may not find these kind of protection mechanisms. The modern day regulators have such protection and be careful to choose such regulators only in your design.

The common protection mechanisms employed in regulators are:

1. Constant current limiting circuit
2. Fold back limiting current or passive current limiting (fold back current is the terminology used to indicate maximum current condition before which protection is applied)
3. If short circuit protection not present in regulators, a high side low resistance MOSFET switch is used to control in case of short circuit. In such circuits the configuration of the circuit can be changed to control the current.

Check out the below graph which shows the variation of output voltage and current in case of current reaching fold back current:


Check out the below circuit from Linear technologies employing a high side switch (LTC1477):


The above circuit employs a control path at the output where the boost regulator connection to load can be cut-off from load using LTC1477. So, a enable pin on LTC1477 will take care of such scenario. There are scenarios where it is desirable to limit the current rather than disconnecting the power. This is from the user convenience prospective because regular switching off rather than limiting may cause annoyance to the end user. For such cases, we use a discrete circuitry.

Monday, 14 October 2013

USB HSIC interface

You have seen USB2.0/USB3.0 interfaces which are used for connecting processor to external peripherals. The USB lines extend to a connector from which you connect a key-board, mouse, printer or whatever device you want. There are these other interfaces like I2C, SPI which we use for chip-to-chip connectivity. The only disadvantage of these interfaces is speed. Compare the USB2.0 rate of 480 Mbps with I2C speed up to 3.4 MHz which is very less. So, if we want to achieve such high speeds on a board for chip-to-chip connectivity there is a need for new interface which is USB HSIC which was introduced in 2007. So, this is quite new to many hardware engineers. Design engineers working on latest high end processors, SoCs must be familiar with these interfaces.


USB HSIC is basically a synchronous serial interface used for chip-to-chip connectivity. It is basically a two signal interface that uses  1.2 V LVCMOS signalling for communication. The main difference here with the USB is that USB uses a 3.3V signalling. Another difference is that USB uses analog interface externally where as HSIC uses digital signalling on board. As HSIC eliminates analog transceivers, it is low cost, low power consuming and low complexity interface. Another advantage is the low board space required for signals.  As it is a chip-to-chip connectivity interface, there is no need for external cables or connectors.It does not support plug-n-play. also, hot plug not supported.


USB HSIC is a two signal interface which uses DATA, STROBE signals for communication. USB HSIC strobe signal uses 240 MHz clock. It uses dual data rate to transmit data at 480 Mbps. A dual data rate interface is one which clocks data over both leading and falling edges of the clock. One thing to remember here is data and strobe signals are bi-directional. It uses NRZI encoding on signals.


USB HSIC uses the same software stack as USB and can be said as high speed connectivity interface between chips. The main disadvantage is that latency of USB HSIC is little high. HSIC is used mainly in battery powered applications because of low power consumption. USB HSIC can be expanded to connect external USB interfaces using HSIC hubs like USB2513, USB3503, USB4640.


Applications:

  • Smartphones
  • Desktops
  • Tablets
  • set-up boxes
  • GPS navigators
USB3.0 also has a version of chip-to-chip connectivity which is called SSIC. 

Probing USB HSIC signals:
  • We already have a set ups in place for USB measurements. The same cannot be used for USB HSIC as the PHY structure is different from USB. 
  • High Frequency passive probes cannot be used and you may need a active probes. Only problem is these active probes are too costly to buy.
  • For probing a USB HSIC signal at 480 Mbps you need a probe of band-width minimum 1.5 GHz.
  • If we probe HSIC with a passive probe, there is always a chance that the interface may get reset.
  • As per USB HSIC standard, the load cannot a capacitance of more than 14 pF. So, while choosing a probe keep this in consideration.
  • The following table indicates the state of interface as per the signal states of data, strobe:


Design Engineer considerations:
  • PCB trace length of HSIC signals should not exceed 10 cm (< 4 inches).
  • Signals must be routed with a 50 ohm impedance
  • Trace length matching must happen so that the skew will not exceed above 15 ps.
  • Trace spacing should be 3 times the dielectric thickness
Other salient features of USB HSIC:
  • Power consumed is very less when in idle state
  • HSIC uses the same tiered topology as like USB2.0, the peripheral connectivity as shown in the below figure:


  • There is no speed detection mechanism in HSIC. It defaults to USB2.0 speed.
  • Data is transferred from USB HSIC only after idle condition, then data gets stopped after idle condition is back.
Tools for HSIC probing:
  • Agilent Technologies have a HSIC compliance software which can do the following functions:
    • Rise and Fall time measurements
    • Bus state and timing measurements
    • Packet parameters
    • Data eye and mask testing
    • test report generation
  • Lecroy also has HSIC decode application for their scopes

Saturday, 12 October 2013

Spark gaps

You might have seen capacitors being used for suppressing any noise or to provide sudden surge currents. The basic types of capacitors that we use are electrolytic, ceramic and tantalum. There are several other types in common use of which spark gap capacitor is one type.

What do we use  for ESD and lightening protection in circuits?

We often use ESD or TVS diodes in such cases. Spark gap is one type of capacitor that can be used in place of these diodes.

What are the advantages of these spark gaps?

These spark gaps can be constructed on the PCB itself without any physical component which itself is a very low cost implementation. These spark gaps can handle high voltage transients (in kV) as such they an be used for ESD and lightening protection. they have a rugged construction and chances of failure are less. they can handle large surge currents.

How is a spark gap capacitor constructed?

The genuine functionality of spark gap is same as normal capacitor but they differ in construction. A spark gap is formed by separating two electrodes with a air gap. One of the electrode is connected to ground.

How does a spark gap operate?


Spark gaps when constructed have a break down rating. when a voltage transient voltage reaches that breakdown voltage value, this spark gap provides a low impedance path to ground. When electrons flow through this low impedance path they collide with the molecules in the air and their electrons get excited and jump to higher orbital levels. So, when they jump back to their normal levels, they emit light. due to which we see a spark. Sometimes, we also hear sounds in case of lightening strikes. So, once the transient voltage goes below spark gap breakdown, the operation comes to normal and the conducting path between the two plates is no more there. even in case, the current goes below a limit specified by holding current, the conductivity between plates is lost. You may observe some heat also being produced in a spark gap.

Spark gap voltage can be calculated by the formula: (3000 * atmospheric pressure * plate distance + 1350)

the only problem with spark gap, this breakdown voltage is always varying.

Symbolic representation of spark gap in a circuit:


Where do we use this spark gap?

  • As spark plug in automobiles
  • For ESD protection of interfaces in a electronic circuit
  • We see them at the input of transformer in a AC-DC circuit
  • other general uses are CRTs, X-ray machines

Friday, 11 October 2013

Why do we need external capacitors on crystal?

Take the case of micro controller where you have option of using either external and internal crystal for clocking. We in many applications use external crystals. We might have used external capacitors for a crystal used in such an application. The below figure also shows the same.


We always follow the datasheet of micro controller to find the value of external capacitor (C1, C2 in above figure). The datasheet clearly mentions value of capacitor to be used for specific crystal frequency. 

Following are some facts about these capacitors:
  • Ceramic caps are preferred for these capacitors as they are stable (with temperature variations)
  • Even though the capacitors look like parallel connected, they are connected in series.
  • XTAL1, XTAL2 pins in above circuit are input and output pins respectively. Some controllers/processors specify them as XTALIN and XTALOUT.
  • These capacitors along with crystal form a band pass filter and are crucial in crystal performance. This filter circuit provides 180 deg phase shift.
  • These capacitors provide protection against stray signals and helps to get stabilized crystal frequency
  • There is slight variation in frequency because of this capacitors. A crystal generates gives out a frequency slight away from the specification and adding these capacitors helps getting stabilized frequency. However, in applications, that doesn't require much stability users tend to ignore this.
  • If you use a very high value of capacitor instead of specified value, response time increases for crystal.
Below is the capacitance values mentioned in a micro controller (PIC16F777) datasheet as per frequency:


If not mentioned in data sheet, you have to manually calculate the capacitance value using the below formula:

                         Load capacitance = Stray capacitance + Pin capacitance + [(C1 * C2)/(C1+C2)]

Load capacitance - You get from the crystal data sheet
Stray capacitance - PCB capacitance
Pin Capacitance - Micro controller pin capacitance
C1, C2 are connected in series, so, the parallel formula used for calculating effective capacitance

The main problem with the above formula comes only with approximation of PCB capacitance which can't be determined accurately. So, the estimation may go wrong sometimes.

Most of these CMOS digital circuits are clocked by pierce oscillator shown in the diagram below:

Wednesday, 9 October 2013

What is ppm rating in crystals/Oscillators?

I was going through a processor datasheet where a system PLL clock output is driving USB controller. It was mentioned that the clock must be having a stability factor 480MHz ± 500ppm. This article is for those who are interested in knowing what this ppm means.

You must have seen the specifications of a oscillator in it's datasheet and it must have mentioned stability as ppm. We generally don't think much about this ppm and tend to select as per the requirements given. If one asks, ±20ppm we just select the oscillator with that stability factor. A crystal frequency may vary as per the environmental conditions and ageing. The amount of variations is indicated by the ppm value. Let us see few points about this ppm.

  • ppm is nothing but parts per million
  • A change in frequency (dF) as per ppm value is calculated using the formula, (crystal frequency * ppm)/(10^6). 
  • This dF when added to crystal frequency gives the frequency variation.
  • So, for one year period, the crystal vary by F±dF
There are other types of oscillators use instead of normal oscillators to get temperature stability. They are temperature controlled oscillators, oven controlled oscillators, atomic clocks. Oven controlled oscillators have a ppm in the range of ±1x(10^-9). Atomic clocks are much more stable than this.

What is the difference between oscillator and crystal?
  • Crystal is the basic building block of oscillator.
  • Oscillator can be constructed from either quartz crystal or ceramic resonator. Quartz crystal gives more stability.
  • A crystal included with semiconductor elements like transistor, inverter and capacitors form a oscillator
  • If you see a crystal, you need not give power but for oscillator power is required.
  • the output of oscillator is buffered to drive higher loads.
  • Oscillators are available in plastic or metla package. 

Tuesday, 8 October 2013

Zener vs Schottky vs Normal diode

Diode is a semiconductor device with P-N junction. So, when positive voltage is applied to P side of diode, it is said to be forward biased. When this voltage exceeds 0.7V, the diode is set to breakdown and the diode starts conducting and allows current to flow. When forward voltage is below 0.7V, diode doesn't conduct. There are diodes with forward breakdown up to 1.1V. The breakdown depends on the type of semiconductor material used for diode construction. There are When the same voltage is applied to N side of diode, the diode is to be reverse biased and never conducts. but when this reverse voltage is above some threshold, it starts conducting.

The voltage characteristics of a normal diode and it's symbol are shown below:




The diode symbol is as shown in the figure and you can see a strip around the cylindrical diode which actually represents the cathode. Diodes are generally available in cylindrical or glass packages. Some of the applications of diodes include power conversion, over voltage protection, reverse current protection and in other logic circuits. The general application where the normal diode is used can be seen from the below figure.


The forward drop of D1 is 1.1V in the above figure. So, the voltage seen at the resistor R1 is (12 - 1.1) = 10.9 V. If you check the data sheet of D1, the reverse voltage specification is 50 V. If the current has to flow from R1 through D1, the voltage at the load has to exceed by 50 V. This is the normal functionality of diode and it's application. Anyways in the above simple circuit we are not much bothered about the reverse voltage.

Various diode symbols can be seen in the below figure:


What happens if we replace D1 in the above with Schottky diode?

Schottky diode best suits this application. Schottky diode has low voltage power drop and not more than 0.5 V. Schottky diodes have a voltage drop in the range 0.2 - 0.45 V. So, the voltage at the first node of R1 will be measured as 12 - 0.2 = 11.8 V. This is with reference to forward drop. The main advantage we are getting here is less voltage drop and hence less power consumption.

So, in applications where reverse current need to be gated and forward drop must be very less schottky diode is preferred. Let us consider a case, where from the other end of D1 we have a voltage greater than breakdown voltage. In this case, the diode is reverse biased and current flows in other direction. In this case, let us assume the reverse voltage goes below supply voltage. In this case, the diode has to switch back to forward biased condition. This happens pretty quickly in schottky diode. A normal diode may take time to switch back to forward biased mode. So, important point here is Schottky diode has rapid turn on and turn off times. One has to consider the fact that the reverse voltage drop of Schottky diode is less than normal diode. But in this application, reverse voltage doesn't matter much.

Can we use a zener diode in the above application?

Definitely, a zener diode can be used if we consider a forward biased condition. The forward drop is same as normal diode. But it has voltage drop greater then Schottky diode. So, Schottky is always preferred in this case compared to zener.

What is the case of reverse breakdown when we consider Zener, Schottky and normal diode?

Zener - Reverse voltage varies from 1.8 V to 200 V as per the diode selected
Normal diode: Available with forward drops in the range 50-1000V
Schottky: In the range 20-45 V

So, considering above cases, when is a zener diode used?

Consider, the previous circuit and let us assume that we want a specific voltage of 3.6V at the load even though the supply is +12V. We can connect a zener diode at the load end to clamp the voltage or in other words to regulate the voltage to desired level. the same circuit with zener diode as per requirement gets modified as follows:


So, when there is a need to regulate the voltage a zener diode is used. Here, even a schottky diode can be used but the problem is in schottky diodes the breakdown voltage is less than the reverse voltage at which current flows. Where as in a Zener diode, the breakdown voltage is little greater than actual reverse voltage.

Porting RTOS on LPC2148 - Step 3

As LPC2148 is a ARM based micro controller, you require GNU ARM tool chain for compiling the code. Eclipse is one platform which has compatibility for GCC tool chains. Why GCC is preferred by many is because it is open-source. emIDE is another IDE which comes with integrated GNU tool chain

Before going to know, we have to know what a compiler does? A compiler basically translates high level language to machine language. So, when you write a code in eclipse or any other IDE it is basically the compiler in the background that that converts it to downloadable format, .hex in our case.

One more thing to understand here is about the cross compiler. To understand this, let us assume that we are porting a code to embedded system running on Linux and let us assume the code is written in eclipse installed on windows system. To generate a executable code such that it runs on linux system, you must have a cross compiler.

Some of the tool chains/compilers that you can use are:

  • Yagarto
  • MinGW
For integrating YAGARTO to ECLIPSE, download YAGARTO from the following link:

Saturday, 5 October 2013

SSD vs HDD

We are aware of different kinds of memory, classified as volatile and non-volatile. Volatile is a kind of memory which looses it's stored contents when power is removed. Non-volatile is kind of memory which retains it's contents even when power is removed. Hard drive in your system is one kind of non-volatile memory. Hard disk can be of two types, either HDD or SSD. Many of us are unaware of the primary differences between the two types.

Before going to discuss more about those types, let us first know the basic purpose of storage devices on systems:

  • Used to boot the system
  • Store your personal files
  • Store multimedia data
  • Store your applications
  • Store your operating system 

HDD (Hard Disk Drive):


Hard drives have a rotating arm with read/write header. The header moves over a metal platter with magnetic coating for read/write operation. There are several sizes available for HDDs. For example 2.5" for laptop and 3.5" for desktop. These drives moves at a speed of 5400 or 7200 or 15000 rpm. Faster the rotation speed, faster is the read or write operation. HDD used serial interface to communicate with the processor initially, then it moved to IDE, then SCSI and SATA now-a-days. These days we have HDDs with capability up to 4TB (Tera Bytes). The 2.5" inch drives are available in sizes up to 2TB and 3.5" drives up to 4TB.


SSD (Solid state drive):

A solid state drive is made from solid state devices like transistors which have charge carriers. SSD is basically a interconnected flash chip architecture which is mostly used in netbooks and ultrabooks. These SSDs can be mounted on mother board, connected as like HDD or slotted into a PCIe slot. SSD is basically a NAND flash .with read and write cycles faster as compared to a normal thumb drive. Processor reads and writes data as per the addressing and speed of operation of SSD directly gets effected by that. As like HDD, these are available in 2.5" inch size and up to size of 1TB storage capacity for that size. But it is very rare that you see that huge storage capacity with SSDs. Adding to this there is mSATA short term for mini-sata which fits into mini PCIe slot of a laptop.


The main differences between HDD ans SSD are tabulated below for quick reference:


By seeing the above table, we can tell that the choice of storage must be SSD. But SSD has to go a long way to replace HDD in environments like servers, large multimedia storage requirements.

the below figure shows the noise recording near a SSD and HDD:




Other than SSD and HDD, there are other variants like hybrid drives and multi-drives.

Hybrid drives:
  • Flash chipsets on the same HDD making a combo kind
  • Flash chips are used only for booting and application storage
  • Flash chips are not directly accessible by user for storage and programming
  • System boot speed is increased because of flash and applications can be launched quickly
Multi drives:
  • One approach is to use both HDD and SSD in  a system
  • Again SSD is only for booting and application storage
  • HDD for files storage
  • This manages cost as well as speed in one attempt
  • Only problem is to integrate both on a space constrained system
Systems with SSD:
  • HP Elite Book Revolve 810 has 128GB SSD. HP Elite Book is basically a ultra-flexible laptop. 

ESD protection

Devices are susceptible to high voltage transients. Let us assume a device operating at +5V. If due to transient, the voltage suddenly raises in terms of kV, then there is every chance that internal circuitry of the device may get damaged. A voltage transient is a short duration surge of electrical energy due to stored statics, lightening or due to heavy inductive loads. These transients are divided into repeatable and random. Repeatable transients are due to motors, reactive component switching in a circuit, generators. A random transient is always unpredictable and this is due to lightening or a static discharge. This is where we have to use some kind of suppressors of this high voltage. Electrostatic discharge diodes or transient voltage suppressor diodes (TVS) are used in this case. They protect the I/O, digital and analog signals lines from transients. Available in different packages and are a fit for form factor boards also.

Check the following graph which shows a sudden transient:


The spike exists for a duration of sub nano seconds with high current. With modern day circuits operating at low voltages, arresting this spike is of primary importance for circuirt to function properly in case of such high transients.

Why does a static gets built up?

Static is due to friction between two dissimilar materials. This static gets discharged when it comes in contact with a conducting surface. Static above certain kV is pretty dangerous to the circuit. Generally, they say if any static above 1kV, it is always better to have static protection. there are some certain specifications like IEC61000-4-2 which is further divided into several levels showing the extent of ESD voltages. The below table indicates such levels:


What does a ESD diode do?

The below figure shows a ESD diode connection:


When supply exceeds due to ESD, the diode breaks down and shunts down the current. In this state, the voltage is clamped to the reverse stand-off voltage of the diode. The diode then automatically resets to the original state once the transient is OFF>TVS diodes have the faster response than any other devices so mostly preferred. These TVS diodes can be unidirectional or bi-directional. An avalanche diode can be thought of as combo of zener and normal diode. As a normal diode it allows current to flow in and as a zener it clamps the voltage level to safe value. Mostly, avalanche diodes are preferred for TVS operation compared to zener diode. When breakdown occurs, avalanche settles at a little drop from the breakdown point where as in a zener diode the breakdown voltage is always less then the maintained voltage.


The problem with using the TVS diodes available in market is in the case of high current transient. In such a case, the clamping voltage is high and may damage the circuit. So, in case of a high frequency, high current transients, it is always better to use a TVS diode which gives specifications in that case.

Requirements for using a TVS diode:

  • Must have low input capacitance. Else, can't be used on a high frequency data line. with high capacitance it may degrade the rise and fall time of the signal.
  • Must have low leakage in case of normal operation. This is very important in battery powered application.
  • The clamp voltage must be lowest possible.
  • Reverse stand off voltage of TVS diode used must be greater then the operating voltage of circuit
  • Inductance is the main cause of slow response of TVS diode to transient, so, eliminate it as much as possible. this is why we tend it keep it close to the device for which ESD protection is desired.
  • Exposed interfaces like HDMI, USB, Audio are very much effected by ESD and TVS diodes on such interfaces is a must
  • Place the TVS diode as close as possible to the connectors.

Porting RTOS on LPC2148 - Step 2 (download eclipse)

Eclipse IDE is used by many users worldwide and it is freely available for download. You may use Eclipse integrated with cross compiler tools. Other than Eclipse there are some other tools which we will see in coming articles.

Step 1:

The first step to installing Eclipse is to check if your system has a java runtime (JRE) installed or not.  Eclipse is basically written in Java and requires a JRE to execute.  To check if JRE is installed or not, type the following command in the command prompt (start->run->Type cmd and press enter):

Java –version

The following response must be seen:


If you don’t see a version, download JRE from the following link:

Step 2:

The next step is to download eclipse.

Download eclipse from the following link:

Use “Eclipse IDE for C/C++ Developers” as most of our applications will be written in C/C++. An important point here is that, this setup comes up with plugins for C/C++ program development. Plug-ins are nothing but compiler kind of support for executing C/C++ programs. Once the eclipse is downloaded you can install the desired plug-ins also. Note that Eclipse doesn’t have a setup procedure.  Download the eclipse and run the .exe to start working.

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.

Wednesday, 2 October 2013

Antenna Polarization

For any wireless transmission, whether it be mobile, satellite, radio antenna is a must. Choosing desired antenna for particular application needs some study. An antenna can be described as a transducer which converts electrical energy into electromagnetic energy and radiates in the air and viceversa. Electromagnetic signal requires no introduction which is described as combination of electric and magnetic fields oscillating perpendicular to each other and orthogonal to the propagation of wave. It is the electric field component component that is important for us in deciding the antenna type. One way of classifying the antennas is by knowing the type of orientation of E-plane. Types are,

  • Linear polarization
    • Vertical Polarization
    • Horizontal Polarization
  • Circular Polarization
    • Right hand circularly polarized
    • Left hand circularly polarized
    • Elliptical polarization 


Linear Polarization: The direction of radiation is in the direction of propagation. In other terms, it is in plane with the direction of propagation.
Circular Polarization: The plane of polarization rotates in a circle. For a time period of one wave, the plane rotates one cycle.

Vertical Polarization:
  • The electric filed is perpendicular to the surface of earth
  • In case of broadcasting requirements, we use this type of polarized antennas.
  • Mobile antennas use vertical polarization
  • Other applications include AM broadcast, Whip antennas on all automobiles
  • Man made RF noise also is vertically polarized which may cause interference to actual signal of transmission
Horizontal Polarization:
  • The electric field is in plane (parallel) with earth's surface.
  • Local TV transmissions use this type of polarization
  • Generally for less distance, when user feels other noise may interfere with their transmission, they use horizontal polarization
Circular Polarization:
  • If the rotation of field is clockwise when looking at the direction of propagation, then it is Right hand circular propagation
  • If the rotation of field is counter clock wise when looking at the direction of propagation, then it is called left hand circular polarization.
  • This type of antennas are preferred when change in environment conditions should not effect the polarization, satellite communications is one example.
  • This polarization is little difficult to generate and is costly.
  • Helical antennas, Yagi antennas are also used.
  • Patch antennas used for satellite communications generate circular polarization
Elliptical polarization:
  • When electric field rotates through all angles in circular polarization, the distance between maximum and minimum peaks is represented by a term called Axial ratio or Ellipticity.
  • If Axial ratio is 0 dB, then it is circular polarization
  • If axial ratio is >0 dB, then it is elliptical polarization
Other considerations:
  • The transmission and reception must have antennas with same type of polarization to get maximum signal reception. Any variations from this may cause signal drop in reception in dB.
  • When more than one antenna need to be placed on top of buildings, care to be taken that they should be placed at a distance from each other, so that both doesn't interfere.
  • The surroundings also have a effect on transmission. whether it be buildings, hilly areas, the signal strength gets reduced by some amount described by terminology fading. Fading can be short term or long term. For a receiver at a short distance, short term fading is due to multiple reflections from buildings and other obstacles. for a receiver at longer distances, long term fading is due to hilly terains, buildings.
  • To enhance reception, engineers employ more than one antenna, which is described by the term diversity reception. combining two outputs and determining a strongest signal is always cumbersome. Even the placement of antennas at a distance causes maintenance costs to increase.

Tuesday, 1 October 2013

Understanding eye diagram

With the recent trends of increase in complexity of designs, accelerated data rates going up to Gbps and reduced time to market, the designers must have a tool in hand which can predict the problems and report before production. Eye diagram is one such tool which analyzes the quality of high speed signal over a channel. It may be any interface standard, any data rate, it has to comply with the certification standard before releasing to market. Eye diagram comes handy in these cases. 

Eye diagram can be thought of as a amplitude vs time graph over a oscilloscope formed by continuously sampling a high speed signal. Using this user can analyze,

  • Transmission line effects
  • Termination requirements and effects
  • Any impedance mismatch over the line
  • Routing problems on a PCB
  • Grounding requirements
  • Jitter of the signal
  • Any crosstalk, inter symbol interference effects
  • Signal-to-Noise ratio of a channel
  • Overshoot and Undershoot 
The below diagram shows a noisy eye diagram visualized over a oscilloscope:


Few points to remember while using a scope for measuring eye diagram:
  • Scope used must have sufficient bandwidth
  • Probes with low capacitance
  • Scope calibration before measurement
  • Keep a check on the probes, oscilloscope vendor may suggest a specific probes for measurement
  • To do the eye diagram, user has to transmit data pattern specific to the interface being tested
  • Oscilloscope vendors like Agilent, Tektronix provide different applications for interface wise eye diagram measurements
  • For eye diagram analysis of a specific interface, user has to transmit data at a rate specific to that interface for unbiased analysis
Eye diagram measurements:

One level:Mean value of high level measured over a channel
Zero Level:Mean value of zero level measured over a channel
Eye Amplitude: Difference between high and low level in the eye diagram. It should not exceed interface specific standards.
Eye height: Measure of eye vertical opening. Lower the height, higher the noise over the channel. So, an eye must never get closed, which indicates noisy channel.
Eye width:Mean of crossing points of sampled digital signals.
Bit Period: This indicates horizontal opening and indicates the data rate in the channel.
Rise Time:Mean transition time in the upward direction
Fall time:Mean transition time in the downward direction
Jitter: Measured in picoseconds, this indicates deviation from the actual bit event.

Compliance mask overlay:


For a specific interface, a standard will be defined and the signal timing and other parameters have to comply to that standards. Compliance mask is like a ideal situation as per the interface standard.The time and amplitude limits as per the standards need to be maintained. By seeing the above figure, you can see a keep out area for eye and then maximum and minimum amplitude requirements. If signal either comes into keepout area or crosses the maximum and minimum limits, then that interface is not compliant as per interface standard.

So, regarding eye diagram we have to keep in mind that it is indicator of system performance. 

Porting RTOS on LPC2148 - Step 1

RTOS porting is of interest for many engineers. We are trying to port RTOS onto LPC2148 using resources available over internet. Before proceeding with the RTOS porting let us list the specifications of LPC2148 relevant to porting:
  •          16-bit/32-bit ARM7TDMI-S CPU
  •          512kB Flash
  •          40kB SRAM
  •          Max. Frequency – 60MHz

Can we port Linux based RTOS/Linux on LPC2148?

Linux porting requires MMU on processor. Also, the RAM/ROM requirements of processor are high. LPC2148 doesn’t have MMU. Also, the memory is less on LPC2148. It doesn’t have a direct addressing capability for an external memory (external memory bus). Even the extendable memory like SD card is used only for data storage and not for programming. So, clear that Linux can’t be ported on LPC2148. Expanding this none of the ARM7 can have Linux ported because of above disadvantages. From ARM9 onwards, we can port Linux.

What are some of the RTOS available for porting?

Free or Open source RTOS:
  • ·         FreeRTOS
  • ·         uCLinux
  • ·         eCOS

Closed or Propeitary RTOS:
  • ·         VxWorks
  • ·         ThreadX
  • ·         uC/OS2
  • ·         QNX
  • ·         Windows CE
  • ·         Symbian
  • ·         RT Linux

GNU WinARM Tool Chainis used by many people around the world for RTOS compilation and porting.

How a no-voice can understand RTOS?
RTOS is a real-time operating system in which tasks are handled efficiently. Tasks are nothing but simple sub-routines. The processing of such tasks is done as per the pre-defined time constraints. An algorithm named scheduling efficiently handles the tasks.

Some of the terminologies in RTOS:

Non-Preemptive multitasking: It is a scheduling algorithm in RTOS where each of the tasks cooperates with each other to share the processing. Other task Priorities are given respect by the running task. High priority task can interrupt the running task and go to Ready-to-Run state. So, a high priority ISR interrupts the low priority task and once the ISR is executed, the low priority task is executed again. The main disadvantage with this algorithm is that high priority task has to wait. This generally is not used in real time systems.

Preemptive multitasking: It is a scheduling algorithm in RTOS where high priority task is always given priority. Until high priority task releases the CPU, low priority task will not be executed. The exact execution time of high priority task can be determined, hence, kernel using this type of tasking is said to be deterministic.

Semaphore: Consider two tasks competing for a usage of common source. Let us say, they have to output data over same UART or something, in that case someone has to synchronize the resource and allocate it to task. This is said to be resource synchronization and is done by semaphore. There is another case where we read from a UART and write it to memory and we read the same from memory to do some other operation. In this case, the task that is reading must be quick enough to be launched after write task is done. This is what we call task synchronization and also is done by semaphore. Semaphores are two types namely, binary semaphore and counting semaphore. Binary semaphore is used in case of resource synchronization. If two tasks have to share a memory, then in that case we use a counting semaphore.