SPI Description
SPI Description
Concept
The Serial Peripheral Interface (SPI) slave module is designed to serially receive information,
bit by bit, displaying it later in parallel. It works by transmitting information in 16-bit rounds, and
then displaying the received data in a 64-bit parallel output after each round, comprising four
rounds i.e., one full cycle. The concept behind using SPI with these specifications is that each of
the four drivers are assigned to one of the 16-bits set of the output, which will be responsible for
its control, i.e., bits 0 to 15 control driver 1, bits 16 to 31 driver 2, bits 32 to 47 driver 3, and bits
48 to 63 driver 4. To facilitate the understanding of how the SPI module works and its usefulness
in the project, a conceptual diagram is shown below.
As it can be seen from the schematic above, the device has four inputs and two outputs and
their functions are described below:
• Chip select (CS): Input responsible for selecting and enabling the SPI operation.
0 = Chip selected | 1 = Chip not selected
• Reset (RST): Input pulse that resets the circuit, i.e., returns the circuit to its initial condition.
The module was designed to work for 3 full cycles (12 rounds/3 rounds for each driver),
so it must be reset after the end of the third one.
0 = Reset | 1 = Information can be transmitted
• Clock (CLK): Oscillating input that tells the SPI exactly when to sample the bits on the
data line;
Clock off = Information is not transmitted | Clock on = 1 bit transmitted per clock pulse
• Write flag (WR): Output flag that indicates the module is receiving data;
0=No data | 1=SPI is receiving data
In the first round of the first cycle the numerical value 1280 (0000010100000000 in binary) is
being received serially through the MOSI input, stored, and then exhibited in the output at the end
of the next round, occupying its first 16-bits position. In the following 16-bit round, new data
(0000000000000011 in binary) are received and sent to the second position of the SPIs 64-bits
output. By combining with the information from the previous round, the number displayed in the
output after the end of the second round is 197888 (0000000000000011 0000010100000000 in
binary). It is worth noting that this whole process does not stop after one cycle, which is possible
because the prior data stored are overwritten when all bits are filled in the next cycle. For example,
after 1 full cycle all 64 bits of the output will be filled with information, which means that in the
fifth round (beginning of the second full cycle) the data contained in the first position (bits 0 to 15)
will be overwritten.
It is also worth noting that the output has a 1-round delay. This is because the information must
be stored first in a 16-bit register and then shifted to the 64-bit one.