High Speed SPI Slave Implementation in FPGA using Verilog HDL

Similar documents
Design Development and Implementation of SPI

SPI 3-Wire Master (VHDL)

Design and Verification of Serial Peripheral Interface 1 Ananthula Srinivas, 2 M.Kiran Kumar, 3 Jugal Kishore Bhandari

Understanding SPI with Precision Data Converters

International Journal of Advance Engineering and Research Development DESIGN AND IMPLEMENTATION OF SPI PROTOCOL

PSIM Tutorial. How to Use SPI in F2833x Target. February Powersim Inc.

i_csn i_wr i_rd i_cpol i_cpha i_lsb_first i_data [15:0] o_data [15:0] o_tx_ready o_rx_ready o_rx_error o_tx_error o_tx_ack o_tx_no_ack

Block Diagram. mast_sel. mast_inst. mast_data. mast_val mast_rdy. clk. slv_sel. slv_inst. slv_data. slv_val slv_rdy. rfifo_depth_log2.

EE 456 Fall, Table 1 SPI bus signals. Figure 1 SPI Bus exchange of information between a master and a slave.

SPI (Serial & Peripheral Interface)

FPGA Implementation Of SPI To I2C Bridge

RECONFIGURABLE SPI DRIVER FOR MIPS SOFT-CORE PROCESSOR USING FPGA

Serial Peripheral Interface Design for Advanced Microcontroller Bus Architecture Based System-on- Chip

DQSPI IP Core. Serial Peripheral Interface Master/Slave with single, dual and quad SPI Bus support v. 2.01

< W3150A+ / W5100 Application Note for SPI >

LSN 1 Digital Design Flow for PLDs

Functional Verification of xhci (extensible host controller Interface) for USB 3.1 Using HDL

App Note Application Note: Addressing Multiple FPAAs Using a SPI Interface

ASNTu2s PCB with Tiger Board USB to 7-Channel 3-Wire Interface Bridge Application Notes

Raspberry Pi - I/O Interfaces

International Journal of Applied Sciences, Engineering and Management ISSN , Vol. 05, No. 02, March 2016, pp

The Design of MCU's Communication Interface

RTL Coding General Concepts

LAB4. Program the on chip SPI module

HCTL Open Int. J. of Technology Innovations and Research HCTL Open IJTIR, Volume 4, July 2013 e-issn: ISBN (Print):

Microcontrollers and Interfacing

An SPI interface for the 65(C)02 family of microprocessors

Design and Implementation of Hamming Code on FPGA using Verilog

Chapter 2 Getting Hands on Altera Quartus II Software

Register Transfer Level in Verilog: Part I

Maximizing Logic Utilization in ex, SX, and SX-A FPGA Devices Using CC Macros

DIGITAL DESIGN TECHNOLOGY & TECHNIQUES

Embedded Power Supply Controller

ChipScope Demo Instructions

Introduction to Field Programmable Gate Arrays

UART TO SPI SPECIFICATION

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

An Efficient Designing of I2C Bus Controller Using Verilog

Libero SoC v11.8 Service Pack 2 Release Notes 11/2017

ISE Design Suite Software Manuals and Help

AL8253 Core Application Note

THANG LUONG CAO. Serial bus adapter design for FPGA. Master of Science Thesis

Using the Z8051 MCU s USI Peripheral as an SPI Interface

McMaster University Embedded Systems. Computer Engineering 4DS4 Lecture 6 Serial Peripherals Amin Vali Feb. 2016

Each I2C master has 8-deep transmit and receive FIFOs for efficient data handling. SPI to Dual I2C Masters. Registers

The 9S12 Serial Peripheral Inteface (SPI) Huang Section 10.2 through 10.6 SPI Block User Guide

Verilog HDL Ebooks Free

THE INTERNATIONAL JOURNAL OF SCIENCE & TECHNOLEDGE

Optimal Implementation Of UART_SPI Controller and Slave Interface With Master.

From Datasheets to Digital Logic. synthesizing an FPGA SPI slave from the gates

Experiment 3. Digital Circuit Prototyping Using FPGAs

Serial Peripheral Interface. What is it? Basic SPI. Capabilities. Protocol. Pros and Cons. Uses

Libero SoC v11.9 SP2 Release Notes 11/2018

Design and Research of Virtual Instrument Development Board

AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL

System Verification of Hardware Optimization Based on Edge Detection

Typical applications where a CPLD may be the best design approach:

V8-uRISC 8-bit RISC Microprocessor AllianceCORE Facts Core Specifics VAutomation, Inc. Supported Devices/Resources Remaining I/O CLBs

DESIGN AND IMPLEMENTATION OF I2C SINGLE MASTER ON FPGA USING VERILOG

RESET CLK RDn WRn CS0 CS1 CS2n DIN[7:0] CTSn DSRn DCDn RXDATA Rin A[2:0] DO[7:0] TxDATA DDIS RTSn DTRn OUT1n OUT2n BAUDOUTn TXRDYn RXRDYn INTRPT

Evaluation of the RTL Synthesis Tools for FPGA/PLD Design. M.Matveev. Rice University. August 10, 2001

CHAPTER 3 METHODOLOGY. 3.1 Analysis of the Conventional High Speed 8-bits x 8-bits Wallace Tree Multiplier

Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features

EE595. Part VIII Overall Concept on VHDL. EE 595 EDA / ASIC Design Lab

DESIGNING OF INTER INTEGRATED CIRCUIT USING VERILOG

Bus Matrix Synthesis Based On Steiner Graphs for Power Efficient System on Chip Communications

Keywords: Soft Core Processor, Arithmetic and Logical Unit, Back End Implementation and Front End Implementation.

Working with Quad and Other SPI Protocols Testing and Debugging (Quad-) SPI-based ASIC, FPGA, SoC and Embedded Systems

A Low Power DDR SDRAM Controller Design P.Anup, R.Ramana Reddy

Configurable UART with FIFO ver 2.20

DSP Flow for SmartFusion2 and IGLOO2 Devices - Libero SoC v11.6 TU0312 Quickstart and Design Tutorial

DESIGN STRATEGIES & TOOLS UTILIZED

Lecture 14 Serial Peripheral Interface

Early Models in Silicon with SystemC synthesis

Using the MagAlpha Serial Interface Advanced Features. Application Note

PIC Serial Peripheral Interface (SPI) to Digital Pot

Chapter 1 Overview of Digital Systems Design

Hardware Description Languages (HDLs) Verilog

Real Time Embedded Systems. Lecture 1 January 17, 2012

Reference Design RD1065

Introduction the Serial Communications Parallel Communications Parallel Communications with Handshaking Serial Communications

C8051F700 Serial Peripheral Interface (SPI) Overview

Laboratory Exercise 3

Field Programmable Gate Array

Topics. FPGA Design EECE 277. Interconnect and Logic Elements Part 2. Laboratory Assignment #1 Save Everything!!! Guest Lecture

Parallel Data Transfer. Suppose you need to transfer data from one HCS12 to another. How can you do this?

AvnetCore: Datasheet

SPI Overview and Operation

FPGA based Simulation of Clock Gated ALU Architecture with Multiplexed Logic Enable for Low Power Applications

Summer 2003 Lecture 21 07/15/03

ECE 353 Lab 4. MIDI Receiver in Verilog. Professor Daniel Holcomb UMass Amherst Fall 2016

PINE TRAINING ACADEMY

Digital Design Solutions Manual Second Edition

Introduction to VHDL Design on Quartus II and DE2 Board

AvnetCore: Datasheet

Configurable UART ver 2.10

Digital Storage Oscilloscope

PIC Microcontroller Introduction

Embedded Systems and Software. Serial Interconnect Buses I 2 C (SMB) and SPI

ALTERA FPGAs Architecture & Design

Transcription:

High Speed SPI Slave Implementation in FPGA using Verilog HDL Mr. Akshay K. Shah Abstract SPI (Serial Peripheral Interface) is a synchronous serial communication interface for short distance communication. It is also called a four-wire serial bus. SPI Devices communicate in full duplex mode in Master-Slave architecture with a single master. It s operation is relatively very simple and operating speed is very high. The designed SPI Slave in FPGA will communicate with a DSP at relatively high speed. Index Terms Serial Peripheral Interface (SPI), Field Programmable Gate Array (FPGA), Digital Signal Processor (DSP). Printed Circuit Board(PCB), USB (Universal Serial Bus), protocol is called synchronous because operation is controlled by this clock only. SPISTE (CS) Chip Select. This signal is used by a master to select a slave from the number of slaves connected on the bus. Data Wires: MISO/SOMI - Master In Slave Out. Data input from slave to master. MOSI/SIMO Master Out Slave In. Data output from master to slave. I. INTRODUCTION We generally prefer serial communication over parallel communication, as serial communication provides number of advantages like improved noise integrity, less number of pin counts and also high speed. We use different protocols for both long and short distance communication. Long Distance: Ethernet, Serial-ATA (SATA), USB, etc. Short Distance: I2C, SPI, etc. There are number of ICs of memories (i.e. FRAM, EEPROM, etc.) available in the market which, we can operate as a slave. We can readily use these ICs by implementing a SPI master implementation in either microcontroller/fpga/dsp. But there are certain cases where we do not require that much memory in terms of number of registers as well as we want to manipulate that received data for other purposes in different application. In that cases we can build our user defined memory in FPGA and we can build a SPI Slave module inside FPGA that can interface serially with any SPI Master at very high speed in full duplex mode. II. SPI PROTOCOL SPI is a synchronous 4-wire protocol which uses 4-wires for establishing a full duplex communication between master and slave. As stated above, there can be only one master and any number of slaves can be connected. Four Wire- Two control wires and two data wires: Control Wires: SPICLK Clock Signal generated by a master. This Fig.1 Data Transfer in SPI Interface There are four operating modes available in SPI standard protocol which can be determined by the polarity of clock polarity (CPOL) and clock phase (CPHA). Both master and slave have to run in the same mode in order to achieve the proper communication between them. SPI MODE CPOL CPHA 0 0 0 1 0 1 2 1 0 3 1 1 CPOL = 0: CPHA = 0 transmits data on rising edge and receives on falling edge of the SCLK signal (Rising edge without delay). CPHA = 1 transmits data one half-cycle ahead of rising edge and receives on rising edge of the SCLK signal (Rising edge with delay). 4365

Fig.2 Different Modes of SPI Interface CPOL = 1: CPHA = 0 transmits data on falling edge and receives on rising edge of the SCLK signal (Falling edge without delay). CPHA = 1 transmits data one half-cycle ahead of falling edge and receives on falling edge of the SCLK signal (Falling edge with delay). Fig.4 SPI Slave Module Implementation Block Diagram & Application Example Command frame [16 bits] consists of synchronization bits (To check and confirm the clock & data synchronization), Read &/ Write command & 5 address bits while other bits are reserved for future use. III. PROPOSED IMPLEMENTATION SPI SLAVE MODE-0 (Rising edge without delay) configuration is implemented in FPGA. DSP acts as a master and slave module is implemented inside FPGA. FPGA global clock is driven by an external clock source. Fig.3 Block Diagram A memory of 32 registers each of 16- bits wide is created inside FPGA which can be addressed with the help of 5 address lines. These address bits can be decoded from the incoming command bits. As shown in Fig.4, there are different control logics inside slave module of FPGA, that can interpret the incoming frame from master and take decision according to the command present inside the frame. Data written inside memory is utilized for number of applications as shown in Fig.4. The frame structure is as shown in the Table-1. 31---16 15---0 Command Frame Data bits Table-1 32-Bit Frame Structure Fig.5 Decode Logic Flow Chart Command frame coming from master decides the communication flow as under: [Fig.5]. 4366

If WR (write) command is given from the master then Slave waits for the next 16-bits of data and after receiving all 32-bits, slave latched this data and writes data into the register of specified address. If RD (Read) command is given from master then, slave does not wait for the next 16-data bits. After receiving 16-bits of command, it loads the serial register with the data from register of specified address, and from the 17 th clock slave transmits these data to the master on the MISO pin. If RD&WR (Both in a single command) are given then slave combines above two operations and operates in full duplex mode. After receiving first 16-bits it transmits the contents from specified address to master from 17 th clock to 32 nd clock. And after receiving complete frame it will write the new data bits into the same register of specified address. IV. IMPLEMENTATION RESULTS SPI Slave is implemented and verified on ProAsic3 series FPGA (P/N# A3P600-PQ208). Fig.7 Technology Hierarchical View After programming implemented design is verified completely. In Fig.8, overall design summary is given. Fig.6 RTL View of the Implemented SPI Slave Module Master SPI is implemented using DSP (P/N# F28M35H52C Concerto). FPGA code is written in Verilog HDL language and synthesized and compiled using Microsemi s Libero SoC v11.5 IDE. Synthesis is done using Synplify Pro ME (version I-2014.03M-SP1). Functional simulation is performed using ModelSim ME v10.3. Functional simulation results are displayed at 20 MHz SPICLK frequency in Fig.5. FPGA is programmed using FlashPro v11.5.0.26. RTL view of the implemented block is shown in Fig.6. Implemented design has utilized 6 I/Os of FPGA. From Fig.6, we can see that design is partitioned into two separate blocks. 1) TOP (A1) HIGH SPEED SPI SLAVE LOGIC 2) FPGA_RW Memory of 32 Registers of 16-bits wide and addressing Logic. Technology schematic diagram of implemented design is shown in Fig.7. Fig.8 Overall Design Summary From area summary we can see that design has utilized 1480 core cells and six I/O cells. Resource utilization report (Detailed resource utilization report) is shown in Fig.9. Functional simulation for all three commands is shown in Fig.10 and Fig.11. From Fig.10, we can see that write command is given first from master to write 7878H data in REG3 from the 32 registers memory inside FPGA Slave. Then, a read command is given from master to read the contents of REG3. We can see that after getting command, Slave starts sending data of REG3 on MISO from 17 th clock. 4367

Fig.10 Simulation Results (Write Command & Read Command individually) Fig.11 Simulation Results (Read and Write in a Single Command) V. CONCLUSION In this paper I have illustrated how to implement SPI Slave module in FPGA using Verilog HDL. The proposed design can be used with any SPI master device. This design is quite useful in the area where there is a requirement of high speed SPI interface. This design is written in Verilog HDL and fully verified by functional as well as timing simulation and through hardware implementation on the PCB. REFERENCES Fig.9 Resource Utilization Report From Fig.11, we can see that master wants to read previous data of REG3 as well as write new data in a single command. From figure from 17 th clock previous data is transmitted on MISO from slave and after receiving 32 bits new data is written in REG3 inside slave FPGA. [1] Digital Logic Design By Morris Mano 2 nd Edition. [2] Verilog HDL: A Guide to Digital Design and Synthesis, Second Edition By Samir Palnitkar. Publisher: Prentice Hall PTR. Pub Date: 21 st February,2003. ISBN: 0-13-044911-3. Pages: 496. [3] Contemporary Logic Design by Randy H. Katz, University of California, Benjamin Cummings/Addison Wesley Publishing Company, 1993. [4] Proasic3 Flash Family FPGA Datasheet [5] F28M35x Concerto Microcontrollers, Texas Instruments Datasheet 4368

Mr. AKSHAY K. SHAH has received his B.E( Electronics & Communication) degree from Vishawakarma Government Engineering College, Chandkheda in June-2013 and currently working as an Engineer in Research & Development Department of Hitachi Hi-Rel Power Electronics Pvt. Ltd, since last two years. He has an interest in designing and verification of digital circuits using Verilog HDL, VHDL & System Verilog. He has hands on experience on working with CPLDs and FPGAs of Xilinks, Altera, Actel,etc. 4369