Escolar Documentos
Profissional Documentos
Cultura Documentos
(IJECET)
Volume 7, Issue 3, MayJune 2016, pp. 3845, Article ID: IJECET_07_03_005
Available online at
http://www.iaeme.com/IJECET/issues.asp?JType=IJECET&VType=7&IType=3
Journal Impact Factor (2016): 8.2691 (Calculated by GISI) www.jifactor.com
ISSN Print: 0976-6464 and ISSN Online: 0976-6472
IAEME Publication
http://www.iaeme.com/IJECET/index.asp
38
editor@iaeme.com
1. INTRODUCTION
The communication links across components of a chip or a board may be either serial
or parallel. Serial communication is performed over fewer interconnecting cables,
thus enables to save a significant amount of space and reduce the number of
connecting pins. These reasons have led the serial communication interfaces to play a
major role in the field of embedded systems.
Even though serial communications like I2C offers much more features than SPI,
Such as less pin count, automatic multi-master conflicts handling and built in
addressing management etc. SPI is preferable, since it is very simple, high speed
protocol, gives better throughput and offers extensions and variations.
Technology has been increased Integrated chips came into picture, where millions
of devices are integrated in to the single chip reduces area and Cost as well. In this
Paper we moved one more step to reduce area consumed by the SPI module.
SPI protocol introduced by the Motorola has four wires. It doesnt have a Certain
Speed limit, todays it works up to 10Mega bits per second. It is a Mater-Slave
protocol i.e., A Module can be acts as either Master or Slave. Master initiates the
transmission and sends out Clock.
In this paper we used a Structural code Verilog to implement SPI module. A
simple master, slave are deigned and the whole design is simulated and synthesized
using Xilinx9.1.
Master
Slave
Output pin
Input pin
Input pin
Output pin
Output pin
Input Pin
Output pin
Input pin
Master starts sending or receiving by asserting slave select line of particular slave,
generates Clock and sends out the clock to the slave through SCK line, keep whole
transmission under control of the clock.
Every SPI module has mainly Port logic, Baud rate generation logic, Shift logic
[7]. It has 8 bit registers through which user can sets SPI module. Even it is 8 bit, it
can transmit up to 12 bits. Control word written decides whether the SPI Module
works as master or slave, the two shift registers , one in Master and one in Slave are
Connected in loop through MOSI and MISO lines[7]. Since it is full duplex for every
clock pulse one bit is shifted in and shifted out of the module. Once Data has been
received, data will transfer to receive data register parallelly, sets bits in Status
register.
http://www.iaeme.com/IJECET/index.asp
39
editor@iaeme.com
SPPR2
SPPR1
SPPR0
SPR2
SPR1
SPR0
Above shows a baud rate register with 8 bits sets the clock rate, SPPR2, SPPR1,
SPPR0 are Baud rate preselection bits and SPR0, SPR1, SPR2 SPI Baud rate selection
bits combinely to divide clock to desired frequency.
Status Register: As per name it shows the status of SPI module
R/W
SPIF
Reset
SPTEF
0
SPTEF -set's the interrupt when the transmit data register is empty. Clearing this
bit after writing to data register starts next transmission.
SPIF-SPI interrupt flag: Once data has been received, this bit is set. Reading data
register without reading status register is not allowed.
Control register
R/W
Reset
SPIE
0
SPE
0
SPTIE
MSTR
CPOL
CPHA
0
SSOE
LSBFE
SPIE- interrupt enable bit of SPI module. Enable the interrupt for reading
operation if SPIF =1.ISR interrupt service routine, which includes operations to Start
next byte of transmission consider the interrupt raises by SPIF this bit is to be set.
SPE- system enable bit of SPI module. SPI module works only, if this bit is set.
Clearing of this bit disables the SPI module and goes to idle state. SPTIE-Transmit
enable bit of SPI. Enable the interrupt for next transmission if SPITFE=1.This bit
enables the SPTEF interrupt to survive. MSTR-This bit shows weather module acts as
master or slave, if 1 acts as master. CPOL: Clock polarity bit, if 1, Clock inversion
occurs. This bit sets the clock as inverted clock or non-inverted that module has to
work. CPHA: This bit decides at which clock edges latching and shifting has to occur,
if it is 0, latching occurs on even edges and shifting in odd. SSOE: Slave select output
enabled, for master acts as output pin assert to Vcc if single master, for slave acts as
input pin grounded to 0 if single slave. LSBFE-This bit decides which bit to shift
either LSB (least significant bit) or MSB (most significant bit) to shift.
2. FUNCTIONAL DESCRIPTION
Control word written decides Module as a master or Slave. SPE bit enables the SPI
module and MSTR decides Mater or Slave [4].
MASTER
If MSTR=1, Module do master functions.it has to generate Clock. Baud logic
generates the clock from the word written to the baud rate register. Master initiates the
transmission by selecting slave through SS_bar line. The slave by asserting slave
select line of particular slave to 0 in Multi slave mode. If single slave in
http://www.iaeme.com/IJECET/index.asp
40
editor@iaeme.com
Slave
If MSTR=0, module acts as Slave. In slave mode SCK and MOSI acts as input pins
and MISO as output pin by default. Select pin is connected to the ground before
transmission. Data exchanging occurs under the control of master clock. Once data
has been received, bits are transmitted to Data register by setting SPIF flag bit. This
bit is cleared by doing read accesses to the status register followed by data register.
http://www.iaeme.com/IJECET/index.asp
41
editor@iaeme.com
3. NEW DESIGN
We followed the Motorola user guide in order to model this design. Optimization of
the gate level logic design is possible if we have a thorough knowledge of digital
design. We actually went for digital logic design of logics to compress the area of SPI
protocol.
Successfully we optimize the area of baud logic, shift logic and port logic results a
very less consumption of area than previous design. Since it is a Synchronous and
asynchronous mixed design, all synchronous part of a design is edge triggered one.
Synthesis has done on vertex-5 Xc5VLX30T FF324 board using XILINX 9.1.
Below shows RTL view and schematic view of design on vertex-5 Xc5VLX30T
FF324
http://www.iaeme.com/IJECET/index.asp
42
editor@iaeme.com
4. IMPLEMENTATION RESULTS
Whole design implemented in XILINX9.1. Below shows verification results of design
done by using MODELSIM 9.1. Design wrong with control, data, and baud registers
which has to set by the user. A default value has been assigned to the register before
module works for transmission. In our design default values are shown above.
Below shows synthesis results of design, mapped on to vertex-5 Xc5VLX30T
FF324 board, spatran3 board etc... A comparison is made to the previous design
results.
SPI master module sending data out:
Slices count
LUT count
Bound ed IOB s
Used by
Our design
0
40
22
Available
40
19200
220
http://www.iaeme.com/IJECET/index.asp
43
Utilized in
percentage
0%
0%
10%
editor@iaeme.com
Used by
Our design
Used By previous
design
Available
Slices count
13
51
4656
LUT count of
4 input
92
23
9312
Bounded
IOBs
22
Out of 92
21outof232
Spartan 3E
XC3S1200E
-5
Slices count
13
51
8672
LUT count
23
92
17344
Bounded
IOBs
22outof
190
21 out of
250
Virtex 4
XC4VFX100
-12
Slices
count
LUT count
Bounded
IOBs
13
43
42176
81
23
84352
22 out of
576
21out of
680
REFERENCES
[1]
[2]
Anand N, George Joseph, Suwin Sam Oommen, and R Dhanabal, design and
implementation of high speed serial interface, School of Electronics Engineering,
VIT University, Vellore, India.
Amit Kumar Shrivastava and Himanshu Joshi, Design, Implementation and
Functional Verification of Serial Communication Protocols (SPI and I2C) on
FPGAs, HCTL Open IJTIR Volume 4, July 2013.
http://www.iaeme.com/IJECET/index.asp
44
editor@iaeme.com
[9]
[10]
T. Durga Prasad and B. Ramesh Babu, Design and simulation of master/ using
Verilog HDL, IJSR, 3 (8), August 2014.
Prof. Jai Karan Singh and Prof. Mukesh Tiwari, Implementation of SPI slave on
FPGA, IJAET/Vol.III/ Issue IV/Oct.-Dec, 2012/24-26.
A.K. Oudjida et al, FPGA Implementation of I2C and SPI protocols, IEEE
Instrumentation & Measurement Magazine, pp.813, February 2009.
Motorola Inc, SPI Block Guide V03.06, February 2003.
Fareha Naqvi, design and implementation of serial peripheral interface protocol
Using Verilog HDL, 2015 IJEDR, 3(3) ISDSN: 23219939.
Qazi Raza Abdul Quadir, Arif Rasool, Manan Mushtaq and Yasirbhat, Design
and Simulation of A Non-Pipelined, Multi- Cycle 16 Bit Risc Educational
Processor Using Verilog HDL, International Journal of Electronics and
Communication Engineering & Technology, 5(9), 2014, pp. 1423.
Md. Ajmal Sadiq, T.Naga Raju and Kumar. Keshamoni, Modeling and
Simulation Of Test Data Compression Using Verilog, International Journal of
Electronics and Communication Engineering & Technology, 4(5), 2013, pp. 143
141.
R.Kathiresan, M.Thangavel, K.Rathinakumar And S.Maragadharaj, Analysis of
Different Bit Carry Look Ahead Adder Using Verilog Code, International
Journal of Electronics and Communication Engineering & Technology, 4(4),
2013, pp. 214220.
http://www.iaeme.com/IJECET/index.asp
45
editor@iaeme.com