Design And Implementation Of Serial Peripheral Interface .

2y ago
11 Views
2 Downloads
505.89 KB
5 Pages
Last View : 12d ago
Last Download : 3m ago
Upload by : Albert Barnett
Transcription

2015 IJEDR Volume 3, Issue 3 ISSN: 2321-9939Design and Implementation of Serial PeripheralInterface Protocol Using Verilog HDLFareha Naqvi 11StudentDepartment of Electronics and Communication Engineering,Alfalah School of Engineering & Technology,Maharishi Dayanand University, Rohtak, Haryana, IndiaAbstract - The objective of this paper is the design and implementation of SPI (serial peripheral interface) master andslave using verilog HDL. The SPI (serial peripheral interface) is a type of serial communication protocol that transferssynchronous serial data in full duplex mode. There are two modes of communications in SPI viz., master and slave. Whilethe master device generates serial clock, the slave devices are allowed with individual slave select lines and the wholedesign is simulated and synthesized with Xilinx ISE design suite 13.3.1Keywords - SPI (serial peripheral interface), Verilog HDL.I. INTRODUCTIONSerial to Peripheral Interface (SPI) is a hardware/firmware communications protocol developed by Motorola and later adopted byothers in the industry. Sometimes SPI is also called a "four wire" serial bus.The Serial Peripheral Interface or SPI-bus is a simple4-wire serial communications interface used by many microprocessor/microcontroller peripheral chips that enables the controllersand peripheral devices to communicate with each other. Even though it is developed primarily for the communication betweenhost processor and peripherals, a connection of two processors via SPI is just as well possible. The SPI bus, which operates at full,is a synchronous type data link setup with a Master / Slave interface . Both single-master and multi-master protocols are possiblein SPI. The SPI Bus is usually used only on the PCB. The SPI Bus was designed to transfer data between various IC chips, at veryhigh speedsII. SERIAL PERIPHERAL INTERFACE DESIGNThe internal architecture of SPI mainly consists of two modules, master module and slave module as shown in figure 1. The SPImodule allows a full duplex, synchronous, serial communication between the MCU and peripheral devices [1]. The main parts ofthe SPI are status, control and data registers, shifter logic, baud rate generator, master/slave control logic and port control logic.Software can poll the SPI status flags or the SPI operation can be interrupt driven. The SPI module has a total of 4 external pins: Master out Slave in (MOSI) - Output data from the master to the inputs of the slaves. Master in Slave out (MISO) - Output data from a slave to the input of the master. Serial Clock (SCLK) - Clock driven by the master to slaves, used to synchronize the data bits. Slave Select (SS) - Select signal driven by the master to individual slaves, used to select the target slave [2].Figure 1: SPI Block DiagramThe main element of the SPI system is the SPI Control Register and the SPI Data Register. The control word written into theControl Register determines the mode in which the SPI shall be configured. The 8-bit data register in the master and the 8-bit dataregister in the slave are linked by the MOSI and MISO pins to form a distributed 16-bit register. When a data transfer operation isperformed, this 16-bit register is serially shifted eight bit positions by the serial clock from the master. Consequently, data isexchanged between the master and the slave. Data written to the master SPI Data Register becomes the output data for the slave,and data read from the master SPI Data Register after a transfer operation is the input data from the slave. The SPI systemoperates in two modes master and slave.IJEDR1503092International Journal of Engineering Development and Research (www.ijedr.org)1

2015 IJEDR Volume 3, Issue 3 ISSN: 2321-9939III. MASTER MODE OPERATIONThe SPI operates in master mode when the MSTR control bit is set. The transmission begins by writing to the master SPITransmit Data Register. If the shift register is empty, the byte immediately transfers to the shift register. Once the byte istransferred from the SPI transmit register to the shift register, the SPTE control bit is set indicating that another byte can bewritten to the SPI transmit data register. In master mode, before transmission SS pin is connected to VDD if the single slavemodule is used. Then the byte begins shifting out a bit at a time on the MOSI pin synchronized with the master serial clock. Thedata transmission will continue for 8 clock cycles, transferring all 8-bits. The transmission ends when the whole byte is shifted outof the master SPI shift register into the slave SPI shift register. The slave shift register is then automatically transferred to theslave SPI receive data register if it is empty. The SPRF control bit is set indicating that the SPI receive register is full and waitingto be read [3].IV. SLAVE MODE OPERATIONThe SPI operates in slave mode when the MSTR bit in SPI .In slave mode, SCK is the SPI clock input from the master, thefunction of the serial data output pin (MISO) and serial data input pin (MOSI) is determined by the SPC0 bit and BIDIROE bit inSPI Control Register 2. And the SS pin is the slave select input. Before a data transmission the SS pin is connected to ground ifthe single slave module is used. Once the byte is transferred from the SPI transmit register to the shift register, the SPTE controlbit is set indicating that another byte can be written to the SPI transmit data register. The byte of data shifting a bit at time on theMISO pin synchronized with the master serial clock. The master shift register is then automatically transferred to the master SPIreceive data register if it is empty. The SPRF control bit is set indicating that the SPI receive register is full and waiting to be read.V. SPI DATA TRANSMISSIONSPI interface allows to transmit and receive data simultaneously on two lines (MOSI and MISO). Clock polarity (CPOL) andclock phase (CPHA) are the main parameters that define a clock format to be used by the SPI bus. Depending on CPOLparameter, SPI clock may be inverted or non-inverted. When clock polarity is set to 1, the idle state for SCLK is high [4].CPHAparameter is used to shift the sampling phase. If CPHA 0 the data are sampled on the leading (first) clock edge. If CPHA 1 thedata are sampled on the trailing (second) clock edge, regardless of whether that clock edge is rising or falling.Clock polarity 0, Clock phase 0Figure 2: Clock polarity 0, Clock phase 0The data must be available before the first clock signal rising. The clock idle state is zero. The data on MISO and MOSI linesmust be stable while the clock is high and can be changed when the clock is low. The data is captured on the clock's low-to-hightransition and propagated on high-to-low clock transition.Clock polarity 0, Clock phase 1Figure 3: Clock polarity 0, Clock phase 1The first clock signal rising can be used to prepare the data. The clock idle state is zero. The data on MISO and MOSI lines mustbe stable while the clock is low and can be changed when the clock is high. The data is captured on the clock's high-to-lowtransition and propagated on low-to-high clock transition.Clock polarity 1, Clock phase 0IJEDR1503092International Journal of Engineering Development and Research (www.ijedr.org)2

2015 IJEDR Volume 3, Issue 3 ISSN: 2321-9939Figure 4: Clock polarity 1, Clock phase 0The data must be available before the first clock signal falling. The clock idle state is one. The data on MISO and MOSI linesmust be stable while the clock is low and can be changed when the clock is high. The data is captured on the clock's high-to-lowtransition and propagated on low-to-high clock transition.Clock polarity 1, Clock phase 1Figure 5: Clock polarity 1, Clock phase 1The first clock signal falling can be used to prepare the data. The clock idle state is one. The data on MISO and MOSI lines mustbe stable while the clock is high and can be changed when the clock is low. The data is captured on the clock's low-to-hightransition and propagated on high-to-low clock transition.VI. SIMULATION AND RESULTSThe data transmission from master to slave and slave to master has been synthesized using the Xilinx ISE designsuite 13.3.1 and the simulation results are shown in figure respectively.IJEDR1503092International Journal of Engineering Development and Research (www.ijedr.org)3

2015 IJEDR Volume 3, Issue 3 ISSN: 2321-9939Figure 6: SPI RTL Schematic of Top ModuleFigure 7: SPI Master to Slave Data TransmissionIJEDR1503092International Journal of Engineering Development and Research (www.ijedr.org)4

2015 IJEDR Volume 3, Issue 3 ISSN: 2321-9939Figure7: SPI Slave to Master Data TransmissionVII. CONCLUSIONThe SPI Master and Slave has been implemented using verilog HDL and Xilinx ISE 13.3.1 was used for simulation. The basis ofthis paper is the focus on data transmission between master and slave modules. We have verified the data in slave device same asthe data in the master device and various possible cases of clock polarity and clock phase are verified. Further, we have also donefunctional verification.REFERENCES[1] Motorola Inc., “SPI Block Guide V03.06,” February 2003[2] Quartus II Handbook version 9.0 volume 5: Embedded Peripherals. Altera SPI core interval time core chapter involume 5 of the Quartus II.[3] Digital DNA from Motorola, “SPI Tutorial introduction”.[4] F.Leens, “An Introduction to I2C and SPI Protocols,”IEEE Instrumentation & Measurement Magazine, pp. 8-13, February2009.[5] A.K. Oudjida et al, “FPGA Implementation of I2C and SPI Protocols: A Comparative Study”. Proceedings of the 16th editionof the IEEE International Conference on Electronics Circuits and Systems ICECS, pp. 507 -510, ISBN: 978-1-4244-50916,December 13-16 2009, Yasmine Hammamet, Tunisia.[6] Bhaskar. J, A Verilog HDL Primer, Publisher: Syndicate Publications.IJEDR1503092International Journal of Engineering Development and Research (www.ijedr.org)5

The SPI (serial peripheral interface) is a type of serial communication protocol that transfers synchronous serial data in full duplex mode. There are two modes of communications in SPI viz., master and slave. While the master device generates serial clock, the slave devices are allowed with individual slave select lines and the whole

Related Documents:

1 TXD O (1) Serial port (Transmitted Data) 2 DTR_N O (1) Serial port (Data Terminal Ready) 3 RTS_N O (1) Serial port (Request To Send) 4 VDD_325 P RS232 VDD. The power pins for the serial port signals. When the serial port is 3.3V, this should be 3.3V. When the serial port is 2.5V, this should be 2.5V. 5 RXD I (2) Serial port (Received Data)

3 RTS_N O (1) Serial port (Request To Send) 4 VDD_325 P RS232 VDD. The power pins for the serial port signals. When the serial port is 3.3V, this should be 3.3V. When the serial port is 2.5V, this should be 2.5V. 5 RXD I (2) Serial port (Received Data) 6 RI_N I/O (3) Serial port (Ring Indicator) 7 GND P Ground 8 NC No Connect

This manual describes the installation and operation of the SYSMAC CS/CJ-series CS1W-SCB@1-V1 Serial Communications Boards and CS1W-SCU@1-V1, CJ1W-SCU@1-V1, and CJ1W-SCU@2 Serial Communications Units. It includes the sections described on the next page. The Serial Communications Boards are classified as Inner Boards and the Serial Communications

HP 500B MT - Serial number-MXL 1240IKS HP Z200 - Serial number-2UA1091G78 HP Prodesk 400G1 SFF - Serial number-MSL5131SMl Rio Magicard Pro - Serial number-61 F7849 HP Compaq DC5700 Microtower - Serial number-2UA7120SFR HP Workstation XW6200 - Serial number-2UA6020G4B REGULAR MEETING. April 5. 2021 Dated this 5th day of April, 2021 ATTEST:

ECHO: PB-770T (Serial. INTRODUCTION (Serial number : 11000001-11999999) (Serial number : 12000001-12999999) (Serial number : 13000001-13999999) number : 11000001-11999999) (Serial number : 12000001-12999999) (Serial number : 13000001-13999999) CONTENTS. We are constantly working on techni

182238-04 Serial cable, RS232 null modem, DB-9 female to DB-9 female, 4 m 183045-01 Serial cable, RS232 straight through, DB-9 female to DB-9 female, 1 m 183045-02 Serial cable, RS232 straight through, DB-9 female to DB-9 female, 2 m 183045-04 Serial cable, RS232 straight through, DB-9 female to DB-9 female, 4 m 183283-01 Serial cable, RS485 .

FOREWORD 7. Applicable Serial No. Frame Serial No. Engine Serial No. 8. Applicable Colour Code (The (*) mark shows Model colour.) 9. Applicable Starting Serial No. Frame Serial No. Engine Serial No. Abbreviation Colour Name Colour Code CM CHROME PLATED 0093 DPBMC(*) DEEP PURPLISH BLUE METALLIC C 0564 SL SILVER 0035 YB(*) YAMAHA BLACK 0033

Waterhead 1003 1346 St James 1041 1393 Chadderton South 1370 964 Failsworth West 1596 849 Chadderton North 2038 791 Chadderton Central 2096 695 Failsworth East 2234 643 Shaw 2295 893 Royton South 3008 628 Royton North 3297 808 Crompton 3858 510 Saddleworth West and Lees 3899 380 Saddleworth North 5892 309 Saddleworth South 6536 260 3.3 There is a wealth of evidence to suggest links between .