|
|
|
|
|
|
|
|
A "SPI" system consists of "master" and one or more "slave" type systems exchanging data accross a serial connection. The "master" device is responsible of clock generation while all the slaves use that clock. There are four basic signals : MOSI (Master Output/Slave Input), MISO (Master Input/Slave Output), SCK (Serial Clock) and SS (Slave Selector). All data transferred is synchronized using the clock signal provided by the Master device. The most significant bit is always sent first.
Our project main is goal was to implement a master SPI system using VHDL, and to realice this design using a EPF10K20RC240-4 device from Altera. Our design was to have a parametrized amount of SPI slaves and also a parametrized maximum word length.
As a result of our work, two different implementations were found to be needed depending on the concrete realworld application:
The number of slave devices that the master system can handle is given by a parameter (GENERIC VHDL). According to this value, the interface has a register associated to each device. This register stores all the characteristics each slave device needs. In each of these registers one can configure:
By using other parameters it is possible to determine the range of variation of some of these fields. In other words, the number of bits reserved for each field is configurable. In this way, the range of action of each of those parameters is also affected. For example, there is a parameter that allows one to select the amount of bits for the selection of transfer speed. By modifying this value, the amount of different selectable speeds and their range is also modified. There is another parameter for the range of possible word lengths.
Documentation and VHDL sources can be found here.