Monday, March 26, 2012

Spi Bus: theory and Implementation

Spi stands for "Serial to Peripheral Interface", and it is a hardware and firmware communications protocol advanced by Motorola and later adopted by everybody. The Spi Bus is used only on the Pcb. I am inescapable some of you will ask: "Why is the Spi Bus used only on the Pcb? What prevents us from using it exterior the Pcb area?" The Spi Bus was specially designed to exchange data in the middle of varied Ic chips, at very high speeds; say, at 180 Mhz or even more. Due to this high-speed aspect, the Bus lines cannot be too long, because their reactance increases too much, and the Bus becomes unusable. However, if you want, you could use the Spi Bus exterior the Pcb at low speeds, but this is not quite practical--the Spi Bus requires 3 or 4 communications lines, which are a bit too many, when compared to 1 or 2 lines commonly needed to communicate, efficiently, with field devices placed exterior the Pcb.

Anyway, on the Pcb the Spi Bus is very good, because we can roughly attach to the Bus as many Ics (or devices) as we want. Please excuse me for not providing a photo of the Spi Bus, but rest assured you do not need one: the Spi Bus is so simple that you will understand everything in words.

Router D Handle

The next demand is: "Why is this Spi Bus particularly useful?" also from exchanging data in the middle of varied Ic chips, the Spi Bus is a method of multiplying microcontroller's pins. In other words, if you have a tiny 8 pins microcontroller, you could operate with that tiny monster few hundreds of digital Inputs and Outputs. This is impressive, and I am inescapable many doubt my words. Let's construe this.

Spi Bus: theory and Implementation

The Spi Bus contains three lines, and they can be on any normal I/O controller pins. These Bus lines are: Clock, Data-In, and Data-Out. In addition, each Ic related to the Spi Bus needs an personel Enable line. Things work like this: suppose we have four devices, A, B, C, and D; all of them are wired to the Spi Bus lines, and the Bus itself is wired to seven controller pins--this is 3 Bus lines plus the 4 Enable ones. When we want to send a message to device C, we enable its Enable line first, then we send the message serially, one bit at a time. In the same time devices A, B, and D do exactly nothing, because they are not enabled.

The charm with the Spi Bus is, it is Synchronous, meaning, when the controller sends the message to one Ic, it is also able to receive data from that Ic, in the same time. This singular aspect of the Spi protocol is particularly well superior for microcontroller-to-microcontroller communications.

Now, we have seen a small 8 pins microcontroller can operate 4 devices (Ics) using 7 pins. Taking into account one device of type A, B, C, or D could have eight or even sixteen I/O ports, this is still far from the hundreds Inputs and Outputs I promised to you. The next beautiful thing about the Spi Bus is: one device Ic can be serialized with many more of the same type! For example, we could have B1, B2, B3, B4, B5, and so on. All Ics of type B# are serialized together, and they require only 4 microcontroller pins to make them work; the Enable line is tasteless to all of them. Next, we can use each device of type A, B, C, and D as a group of tens similar Ics.

The enabling speed of each I/O port on the Spi Bus it is slower, when multiplying microcontroller's pins, but always take into account I/O field devices don't necessarily need speeds of, say 1000 On/Off activations per second each, naturally because most of them cannot handle that speed. However, there are few, very smart firmware techniques like the "barrel-shift" type of functions, which allows us to declare high-speed messaging on the Spi Bus, even if we have hundreds of I/Os. In the same time, the "barrel-shift" functions allow for great time administration inside microcontroller, so that it has more time to execute other tasks--makes sense to me! To conclude, I believe it is clear now we can, indeed, build hundreds of effective I/O lines on a small 8 pins controller.

Further from this normal presentation of the Spi Bus, you should be aware roughly all Ics implement the Spi protocol in a singular way. For detailed and practical applications I recommend you visit my home site at follow Theorems. There you are going to inspect a good tutorial book about working with hardware, firmware--including the "barrel-shift" type of functions--and software design, in general, and about few nice and practical implementations of the Spi Bus in particular.

Many microcontrollers have built-in Spi Bus hardware modules, but I was never curious too much about using them. What I do, I always design--on the Pcb and for one microcontroller--one, two or more practice Spi Busses, because my practice implementations are far more flexible. Besides, practical implementation of a practice Spi Bus, both in hardware and in firmware, is no ifs ands or buts simple--trust me with this one!

Spi Bus: theory and Implementation

Ata vs Sata

Hard Drives: Ata versus Sata

The execution of computer systems has been steadily expanding as faster processors, memory, and video cards are continuously being developed. The one key component that is often neglected when looking at improving the execution of a computer ideas is the hard drive. Hard drive manufacturers have been enduringly evolving the basic hard drive used in contemporary computer systems for the last 25 years, and the last few years have seen some interesting developments from faster spindle speeds, larger caches, best reliability, and increased data transmission speeds.

Router D Handle

The drive type used most in consumer grade computers is the hearty Ata type drive (commonly called an Ide drive). The Ata approved dates back to 1986 and is based on a 16-bit parallel interface has undergone many evolutions since its introduction to increase the speed and size of the drives that it can support. The most recent approved is Ata-7 (first introduced in 2001 by the T13 Technical Committee (the group responsible for the Ata standard)) which supports data change rates up to 133Mb/sec. This is unbelievable to be the last update for the parallel Ata standard.

Ata vs Sata

As long ago as 2000 it was seen that the parallel Ata approved was maxing out its limitations as to what it could handle. With data rates hitting the 133Mb/sec mark on a parallel cable, you are interesting all sorts of problems because of signal timing, Emi (electromagnetic interference) and other data integrity issues; thus industry leaders got together and came up with a new approved known as Serial Ata (Sata). Sata has only been around a few years, but is destined to come to be "the standard" due to several benefits to be addressed in this Tech Tip.

The two technologies that we will be looking at are:
Ata (Advanced Technology Attachment) - a 16-bit parallel interface used for controlling computer drives. Introduced in 1986, it has undergone many evolutions in the last 18+ years, with the most recent version being called Ata-7. Wherever an item is referred to as being an Ata device, it is ordinarily a Parallel Ata device. Ata devices are also ordinarily called Ide, Eide, Ultra-Ata, Ultra-Dma, Atapi, Pata, etc. (each of these acronyms surely do refer to very specific items, but are ordinarily interchanged)
Sata (Serial advanced Technology Attachment) - a 1-bit serial evolution of the Parallel Ata physical storage interface.

Basic Features & Connections

Sata drives are easy to distinguish from their Ata cousins by the distinct data and power connections found on the back of the drives. A side-by-side comparison of the two interfaces can be seen in this Pdf from Maxtor, and the following covers many of the differences...

Standard Ata drives, such as this 200Gb Western Digital model, have somewhat bulky, two inch wide ribbon cable with 40-pin data connections and receive the 5V primary to power them from the customary 4-pin connection. The basic data cables for these drives have looked the same for years. A turn was made with the introduction of the Ata-5 approved to best improve the signal potential by production an 80 wire cable used on the 40-pin connector (these are ordinarily called 40-pin/80-wire cables). To improve airflow within the computer ideas some manufacturers resorted to surely folding over the ribbon cable and taping it into that position. an additional one new physical turn also came with the coming of rounded cables. The execution of the rounded cables is equal to that of the flat ribbon, but many prefer the improved ideas air flow afforded, ease of wire management, and cooler appearance that come with them.

Sata drives, such as this 120Gb Western Digital model, have a half inch wide, 7 "blade and beam" data connection, which results in a much thinner and easier to carry on data cable. These cables take the convenience of the Ata rounded cables to the next level by being even narrower, more flexible and capable of being longer without fear of data loss. Sata cables have a maximum length of 1 meter (39.37 inches), which is much greater than the recommended 18 inch cable for Ata drives. The reduced footprint of Sata data connections frees up space on motherboards, potentially allowing for more suitable layouts and room for more onboard features!

A 15-pin power relationship delivers the 250mV of primary power to Sata drives. 15-pins for a Sata gismo sounds like it would wish a much larger power cable than a 4-pin Ata device, but in reality the two power connectors are just about the same height. For the time being, many Sata drives are also coming with a heritage 4-pin power connector for convenience.

Many contemporary motherboards, such as this Chaintech motherboard, come with Sata drive connections onboard (many also together with the Ata connectors as well for heritage drive compatibility), and new power supplies, such as this Ultra X-Connect, ordinarily highlight a few of the primary 15-pin power connections, production it easy to use these drives on new systems. Older systems can surely be upgraded to retain Sata drives by use of adapters, such as this Pci slot Sata controller and this 4-pin to 15-pin Sata power adapter.

Optical drives are also becoming more readily available with Sata connections. Drives such as the Plextor Px-712Sa take benefit of the new interface, although the execution will not be any greater than a comparable visual drive with an Ata connection.

Performance

In expanding to being more suitable to install and drawing less power, Sata drives have execution benefits that surely set them apart from Ata drives.

The most interesting execution highlight of Sata is the maximum bandwidth possible. As we have noted, the evolution of Ata drives has seen the data change rate reach its maximum at 133 Mb/second, where the current Sata approved provides data transfers of up to 150 Mb/second. The farranging execution increase of Sata over Ata can currently be unbelievable to be up to 5% (according to Seagate), but improvements in Sata technology will surely improve on that.

The future of Sata holds great things for those wanting even more speed, as drives with 300 Mb/second change rates (Sata Ii) will be readily available in 2005, and by 2008 speeds of up to 600 Mb/second can be expected. Those speeds are incredible, and are hard to dream at this point.

Another execution benefit found on Sata drives is their built-in hot-swap capabilities. Sata drives can be brought on and offline without shutting down the computer system, providing a serious benefit to those who can't afford downtime, or who want to move drives in and out of execution quickly. The higher estimate of wires in the power relationship is partially explained by this, as six of the fifteen wires are dedicated to allowing the hot-swap feature.

Price

Comparing Ata drives to Sata drives can be tricky given all of the variables, but in normal it is the case that Sata drives will still cost just a bit more than a comparable Ata drive. The gap is windup rapidly though, and as Sata drives gain in popularity and availability a clear shift in prices can be expected. considering the benefits of Sata over Ata, the inherent contrast of a few dollars can surely be justified when considering an upgrade. Computer Geeks currently has a tiny option of Sata drives, but several technical sites, such as The Tech Zone and The Tech Lounge, offer real time price guides to see how comparable drives stack up.

Final Words

The current Sata approved provides primary benefits over Ata in terms of convenience, power consumption and, most importantly, performance. The main thing Ata has going for it right now is history, as it has been the approved for so long that it will not likely disappear any time soon. The future of Sata will be even more interesting as speed increases will help hard drive amelioration keep pace with other key ideas components.

Ata vs Sata