Saha 2014
Saha 2014
Abstract— The Serial-Peripheral Interface (SPI) protocol is design this SPI so that the testing complexity can be reduced.
one of the important bus protocols for connecting with peripheral This system can be fabricated into a single chip. Verilog HDL
devices form microprocessor. The complexity of the circuits has is used for the coding of this system & designed, tested and
aroused with the enormous advancement of IC technology. So, in evaluated using the ISE 6.0 tool of Xilinx and VeriloggerPro
order to lessen the product failure self-testability in hardware is
6.5. For the design implementation the Xilinx Spartan-2
demanded a lot in recent times. The necessity of self-testability
will lead to a solution called Built-in-self-test (BIST). BIST is an FPGA (XC2S150) is used [8].
effective solution to reduce the huge circuit testing cost. This The SPI protocol architecture, implementation technique of
paper represents designing and implementation of SPI protocol the system, circuit schematic and simulation results will be
with BIST capability over FPGA. The need of programming for discussed briefly in the following sections. The system
setting up a network with two devices is no longer needed in this demands of high integration, low bit error rate and low cost
proposed system. To accomplish compact, stable and reliable can be satisfied by this SPI.
data transmission, the SPI is designed with Verilog HDL
language and synthesized on Spartan 2 FPGA. An EEPROM and II. SPI PROTOCOL ARCHITECHTURE
FPGA Spartan 2 are used for the communication testing where
the FPGA is master and EEPROM is a Slave.
In this paper, the SPI protocol implementation uses four
logic signals: SCLK, MOSI (Master Output-Slave Input),
Keywords— Serial-Peripheral Interface; Embedded built-in- MISO (Master Input-Slave Output), SS (Slave Select).SCLK
self-test architecture; Verilog HDL; FPGA is the clock, a unidirectional bus, which fed into the slave
devices. MOSI is defined as output from master which is also
I. INTRODUCTION known as serial data out. MISO is defined as output from
slave which is also known as serial data in. SS is an active low
SPI or Serial-Peripheral Interface is a worldwide accepted signal which is used to select the slave devices. A full duplex
standard communication protocol. SPI protocol was invented data transmission is occurred in SPI clock cycle. Fig. 1 shows
by Motorola. SPI protocol is considered as one of the very the data transfer system of SPI.
best among the systems that are connected to a number of
devices and make the communication smooth and fast. SPI as
well as others serial protocols such as I2C and 1-wire for
instance, are well fitted for data communications from
integrated circuits for low or medium data transfer speed to
peripherals which are on chip board [1].
Several works have been done using VHDL in designing
SPI. A comparison between SPI and I2C Implementation over
FPGA is shown in [2]. On that paper, a comparative study of
those two protocols on FPGA platform is presented and the
entire design has been coded in VHDL. For various
controlling purposes SPI is implemented. SPI is presented for
motion controller in [3]. FPGA Implementation of SPI of
FlexRay Controller is presented in [4].
This paper emphasizes on a new approach of designing SPI
with embedded BIST capability using Field Programmable
Gate Array (FPGA) technology. Testing of a circuit has
become increasingly tough as the scale of integration grows. Fig. 1. Data Transfer Type of SPI.
SPI with the BIST capability provides the specified testability To transfer a data from master device to slave, there are
requisites and lowest-price with the highest performance three types of data formats required. Fig. 2 shows the data
implementation. Much lesser blocks and modules are used to format of SPI protocol.
1 0 ON OFF
A. Circuit Schematic
Fig. 5 & Fig. 6 show the pin diagram of SPI and SPI with
BIST capability respectively. Table II & Table III shows the
pin descriptions of the top level schematics of the Verilog
HDL implementation shown in the Fig. 5 & Fig 6. In those
tables, the input and output pins are also specified.
Fig. 5. Pin Diagram of SPI. TABLE III. SPI with BIST PIN DESCRIPTION
Pin IN/OUT Description
TABLE II. Main SPI PIN DESCRIPTION CLK IN Clock generator
Pin IN/OUT Description reset_n IN Control Bit for Normal & BIST
CLK IN Clock generator Mode
reset_n IN Control Bit for Normal & BIST reset IN Control Bit for Normal & BIST
Mode Mode
GO IN Control bit of the SPI enable IN Enables the Random Pattern
in_data IN Input data byte of the SPI Generator
in_control IN Input control byte of the SPI GO IN Control bit of the I2C
in_address IN Input status address of the SPI SD_COUNTER OUT CLK pulse counter for BIST Mode
Out_data OUT Output Data byte of Master SPI_SCLK OUT Output pin for I2C CLK for BIST
SD_COUNTER OUT CLK pulse counter for BIST Mode Mode
SPI_SCLK OUT Output pin for SPI CLK SPI_SDAT OUT Output data bus for BIST Mode
SPI_SDAT OUT Output data bus bit_correct OUT Output pin of Comparator for
SPI_SDI IN Input data bus correct bits
bit_error OUT Output pin of Comparator for
wrong bits
B. Simulation Results is 10101 then, the signature value should be 101 which mean
The timing diagrams are achieved from Testbencher no error in the data. Afterwards, when the output stream
(VeriLogger Pro 6.5). The design is tested in the Xilinx FPGA changed to 100101, there is an error occur. And the bit_error
where it also gave the correct output. In the timing diagram, line goes to 001. So, form these two signature values, the error
the 8 bits of outputs are converted here into 2-digits can be easily tested. In this process, the efficiency and bit error
Hexadecimal numbers. rate of the SPI can be self-tested.
Table III. COMPARATOR OUTPUT FORMAT
1) Simulation Results for BIST Mode Comparator Signature Value Hexadecimal
Output Value
a) LFSR 8-bit Random Bit Pattern Generator
Bit_Correct 101 5
Bit_Error 001 1
Fig. 8 demonstrates the output of the LFSR 1 in random
pattern generator. Same type of outputs also come from the 2) Simulation Results NORMAL Mode
LFSR 2 and 3. These ouputs from LFSRs are directly goes
into the main SPI module. Fig. 10 depicts the output of the SPI bus at “NORMAL
Mode”. When the signal “GO” is high, the SD_Counter starts
counting. The Control address, Status Address and Data in
hexadecimal are “14”, “00” and “AA” respectively which are
found in the SPI bus as “00010100”, “00000000” and
“10101010” respectively when the “reset_n” and “SS” are
low. By the SPI_SDAT line it is clearly seen that, the given
data are accurately obtained. SD_Counter values from 3 to A
represent the first 8 bits which are control bits. Then 1 bit is
left intentionally blank to reduce the data collision.
SD_counter values from C to 13 & 15 to 1C are showed status
address & data byte respectively. This output is justified by
Table IV.
V. CONCLUSION
In this paper, an FPGA based implementation of SPI with
BIST capability is presented. Here all the modules are
designed and simulated with Verilog HDL. Then the system is
downloaded in the Xilinx Spartan-2 FPGA (XC2S150). This
SPI is much more flexible, speedy, low cost, and stable with
respect to conventional one. This SPI control bus architecture
can enable the industrial fabrication of chip in a way where
only a pressing of one switch can test itself. So that, it would
save valuable time and cost of testing circuits significantly.
References
Fig. 12. FPGA Implementation of SPI Bus Protocol. [1] F. Leens, "An introduction to I2C and SPI protocols," IEEE
Instrumentation & Measurement Magazine, vol.12, no.1, pp.8-13,
The Device utilization summary and timing summary are February 2009.
given in Table V and Table VI respectively. Both the tables [2] A. K. Oudjida, M. L. Berrandjia, R. Tiar, A. Liacha, K. Tahraoui,
"FPGA implementation of I2C & SPI protocols: A comparative study,"
are divided into two parts, Main SPI module and SPI with in Proc. 16th IEEE International Conference on Electronics, Circuits,
BIST capability. From the Table V, it is seen that total number and Systems, pp.507- 510, Dec. 2009.
[3] N.Q. B. M. Noor and A. Saparon, "FPGA implementation of high speed [10] S. Saha, M. A. Rahman, A. Thakur, “Design and Implementation of a
serial peripheral interface for motion controller," in Proc. 2012 IEEE BIST Embedded High Speed RS-422 Utilized UART over FPGA,” in
Symposium on Industrial Electronics and Applications (ISIEA), pp.78- Proc. 2013 Fourth International Conference on Computing,
83, Sept. 2012. Communication and Networking Technologies (ICCCNT), pp. 1-5, Jul.
[4] A.N. Gaidhane and M.P. Khorgade, "FPGA Implementation of Serial 2013.
Peripheral Interface of FlexRay Controller," in Proc. 13th International [11] S. Saha, M. A. Rahman, A. Thakur, “Design and Implementation of a
Conference on Computer Modelling and Simulation (UKSim), pp.128- BIST Embedded Inter-Integrated Circuit Bus Protocol over FPGA,” in
132, Apr. 2011. Proc. 2013 International Conference on Electrical Information and
[5] M. Bushnell and V.D. Agarwal, Essentials of electronic testing for Communication Technology (EICT), pp. 1-5, Feb. 2014.
digital, memory and mixed-signal VLSI circuits, Kluwer Academic
Publishers, 2000.
[6] S. Jamuna and V.K. Agrawal, “Implementation of BIST structure using
VHDL for VLSI circuits,” International Journal of Engineering Science
and Technology, vol. 3, no. 6, pp. 5041-5048, June 2011.
[7] V.K. Agrawal, C.R. Kime, K.K., Saluja, “A tutorial on BIST, part 1:
Principles,” IEEE Design & Test of Computers, vol. 10, No.1, pp.73-83,
March 1993.
[8] J. Bhasker, Verilog® HDL synthesis: a practical primer, Star Galaxy
Publishing, 1998.
[9] M.Y.I. Idris and M. Yaacob, “A VHDL implementation of BIST
technique in UART design," in Proc. Conference on Convergent
Technologies for the Asia-Pacific Region (TENCON), pp.1450-1454,
Oct. 2003.