SPI stands for Serial Peripheral Interface, and is a communications protocol that allows hardware and software developed by Motorola and later adopted by all. The SPI bus is used only on the board. " M sure some of you may ask yourself: "Why The SPI bus is used on the circuit, what prevents us from using it outside of the PCB?" The SPI bus is for data exchange between different IC chips for very high speeds, or rated at 180 MHz or higher. With this high-speed –Aspect, the bus can not be too long because their reactance increases too, and the bus becomes unusable. However, if you wish, you can use the SPI bus outside the circuit at low speed, but not very practical – The SPI bus requires 3 or 4 lines of communication that are a bit "on-line compared to 1 or 2 usually necessary to deal effectively with field devices outside of the PCC is to communicate.

In any case, the circuit SPI bus is very good because you can practicallyattach to the Batch-IC bus) (or devices that we want. Please forgive me for not providing a picture of the SPI bus, but be sure that it is not necessary: The SPI bus is so simple that you understand everything in words.

The next question is: "Why is particularly useful SPI bus?" In addition to exchanging data between different IC chip, the SPI bus is a method of propagating microcontroller pins. In other words, if you have a small 8-pin microcontrollers, you can controlWith this little monster of a few hundred inputs and digital outputs. This is awesome, and I'm sure a lot of doubts about my words. Let us explain this phenomenon.

The SPI bus consists of three lines, and can access any I / O pins of the controller. The bus lines are: clock, data input and output data. In addition, each IC connected to the SPI-bus needs a single active line. It works like this: Suppose you have four devices A, B, C and D are all wired to the SPI bus and the busregistered seven-pin controller – is 3 bus lines plus 4 Enable. If you post a message to device C, we let the active line, then send the message in the series, a bit "at a time. Have the same time, the devices A, B and D are not, why is not allowed.

The beauty with the SPI bus is synchronous, ie, when the controller sends the message to a PAC, but is also capable of receiving data from the line at the same time. This particularAspect of the SPI protocol is particularly suitable for the communication microcontroller microcontrollers.

Now we have a small 8-pin microcontrollers, 4 devices (ICs) to see with 7-pin control. In the light of a single unit of type A, B, C or D, could also be eight or sixteen ports I / O is still far from hundreds of entries and had promised retirements. The best thing on the SPI bus is to be done: a device IC can be serialized with many others of the same type! ForFor example, we have B1, B2, B3, B4, B5, and so on. All circuits of the B # together serialized and require only 4 pins for the microcontroller to operate the line you select is common to all. Then we can all types of units A, B, C and D, than to use a group of dozens of similar IC.

The speed that each I / O port on the SPI bus is slower than allowed in the multiplication of microcontroller pins, but I always bill / O field devices do not need to say at a rate of 1000,ON / OFF activations per second each, simply because most of them can not at this speed. However, there are few, very clever techniques, such as firmware "barrel-shift" type of functions to keep us high-speed messaging on the SPI bus, even though we have hundreds of I / O allows the same time to change the price of the "functions" to enable better organization of the microcontroller, then more time for other tasks makes – sense to me! Finally, I think itnow clear that we really are hundreds of effective control, I can build / O on small legs 8th

In addition to this overview of the SPI bus, you must be aware that almost all the circuits to implement the SPI protocol in a certain way. For practical applications and detailed, I suggest you visit my website original sequence sets. Here you will find a good tutorial book for the use of hardware, firmware – including of course the "shift" type of functions – and the software design,in general, and some nice and practical implementations of the SPI bus in particular.

Many microcontrollers have integrated hardware SPI bus modules, but never too interested to use them. What I do, I always design – on the circuit board and a microcontroller – one, two or more custom SPI bus, because my custom implementations are much more flexible. Moreover, the practical implementation of a custom SPI bus, both hardware and firmware is very simple – you trust me with thisa!



Leave a Reply