Reference Design RD1065

Similar documents
BSCAN2 Multiple Scan Port Linker

8b/10b Encoder/Decoder

LatticeECP2/M Soft Error Detection (SED) Usage Guide

LED1 LED2. Capacitive Touch Sense Controller LED3 LED4

LatticeXP2 Soft Error Detection (SED) Usage Guide

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

LatticeXP2 Dual Boot Usage Guide

It is well understood that the minimum number of check bits required for single bit error correction is specified by the relationship: D + P P

UART Register Set. UART Master Controller. Tx FSM. Rx FSM XMIT FIFO RCVR. i_rx_clk o_intr. o_out1 o_txrdy_n. o_out2 o_rxdy_n i_cs0 i_cs1 i_ads_n

MDIO Master and Slave Controllers

I 2 C Master Control FSM. I 2 C Bus Control FSM. I 2 C Master Controller

Minimizing System Interruption During Configuration Using TransFR Technology

IDE/ATA Interface Controller with WISHBONE

I 2 C Slave Controller. I 2 C Master o_timeout_intr

Gamma Corrector IP Core User Guide

Color Space Converter

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

Median Filter IP Core User s Guide

Enhanced Closed-loop Trim with I 2 C Control for Platform Manager Devices

Dual Boot and Background Programming with Platform Manager 2

LatticeECP2/M Density Migration

LatticeXP2 Hardware Checklist

PCI Express Basic Demo Verilog Source Code User s Guide

MachXO2 SED Usage Guide

Data_o(7:0) Controller. Add_i(7:0) spiclkout. Data_i(7:0) ACK STB_I. RST_I spics_n CLK_I WE_I

ice40lm Barcode Emulation Solution Control Registers and Data Buffer

Importing HDL Files with Platform Manager 2

Using the LatticeMico8 Microcontroller with the LatticeXP Evaluation Board

PCI Express Throughput Demo Verilog Source Code User s Guide

isplever Turbo Encoder User s Guide November 2008 ipug08_04.4

isplever Multi-Channel DMA Controller User s Guide February 2006 ipug11_04.0

< W3150A+ / W5100 Application Note for SPI >

2D Edge Detector IP Core User s Guide

MachXO3 Soft Error Detection (SED)/ Correction (SEC) Usage Guide

MachXO2 Low Power Control Demo User s Guide

Power Estimation and Management for LatticeECP/EC and LatticeXP Devices

Fail-Safe Startup Sequencing During Field Upgrades with Platform Manager

LatticeXP2 Configuration Encryption and Security Usage Guide

DDR2 Demo for the LatticeECP3 Serial Protocol Board User s Guide

SPI Serial Flash Programming Using ispjtag on LatticeECP/EC FPGAs

USB 3.1 Type-C Hardware Checklist

Excalibur Solutions Using the Expansion Bus Interface. Introduction. EBI Characteristics

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

Low-Cost Serial RapidIO to TI 6482 Digital Signal Processor Interoperability with LatticeECP3

Designing a High Performance SDRAM Controller Using ispmach Devices

Parallel to MIPI CSI-2 TX Bridge

Power Estimation and Management for LatticeXP2 Devices

SPI 3-Wire Master (VHDL)

Lattice Semiconductor Design Floorplanning

MachXO Starter Evaluation Board User s Guide

Powering Up and Programming the ProcessorPM isppac-powr605

LatticeECP3 Digital Front End Demonstration Design User s Guide

Scalable Low-Voltage Signaling with LatticeSC/M Devices

Programming the isppac-powr1220at8 in a JTAG Chain Using the ATDI Pin

ISP Engineering Kit Model 300

ArduCAM-M-2MP Camera Shield

isplever Correlator IP Core User s Guide June 2008 ipug38_02.3

Digital Blocks Semiconductor IP

ice40 Ultra Self-Learning IR Remote User s Guide

AN469 I 2 C I/O ports INTEGRATED CIRCUITS. Author: Bob Marshall 2001 Aug 15 ABSTRACT

Interfacing to the Motorola MCF5307 Microprocessor

Power Estimation and Management for MachXO Devices

Lattice USB Type-C Solution Design Document

I 2 C Bus Interface - Slave ver 3.08

Discontinued IP. OPB General Purpose Input/Output (GPIO) (v3.01b) Introduction. Features. LogiCORE Facts

USING LOW COST, NON-VOLATILE PLDs IN SYSTEM APPLICATIONS

Fibre Channel Arbitrated Loop v2.3

GPIO IP Core Specification

AN10428 UART-SPI Gateway for Philips SPI slave bridges

9. PIO Core. Core Overview. Functional Description

Am186ER/Am188ER AMD continues 16-bit innovation

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.

isplever Reed-Solomon Encoder User s Guide October 2005 ipug05_03.0

LatticeSCM SPI4.2 Interoperability with PMC-Sierra PM3388

Mixed-Language Simulation with Lattice IP Designs Using Active-HDL

ispxpld TM 5000MX Family White Paper

Application Note AN8064

PC87435 Enhanced IPMI Baseboard Management Controller

LogiCORE IP AXI Master Lite (axi_master_lite) (v1.00a)

isppac-powr1208p1 Evaluation Board PAC-POWR1208P1-EV

LatticeSC/Marvell. XAUI Interoperability. Introduction. XAUI Interoperability

OPB General Purpose Input/Output (GPIO) (v3.01b)

Interfacing an Intel386 TM EX Microprocessor to an CAN Controller

LatticeXP2 sysconfig Usage Guide

UM0401 User manual. User manual for eight bit port expander STMPE801 demonstration board. Introduction

Understanding SPI with Precision Data Converters

High Speed SPI Slave Implementation in FPGA using Verilog HDL

Level Shifter. for. Hardware User s Manual.

ENGG3380: Computer Organization and Design Lab4: Buses and Peripheral Devices

MISO MOSI Clock. The master and the slave use a protocol based on the following frame structure. Preamble Body Postamble

LatticeSC MACO Core LSCDR1X18 Low-Speed Clock and Data Recovery User s Guide

Platform Manager 2 I 2 C Demo Design and GUI

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

Stratix FPGA Family. Table 1 shows these issues and which Stratix devices each issue affects. Table 1. Stratix Family Issues (Part 1 of 2)

MachXO2 sysclock PLL Design and Usage Guide

MICROPROCESSOR BASED SYSTEM DESIGN

DCR Interrupt Controller (v2.00a)

April 2002, Version 1.1. Component. PTF File. Component. Component GUI Wizards. Generation. System PTF file Files and Libraries.

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

AvnetCore: Datasheet

Transcription:

April 011 Reference Design RD1065 Introduction Most microprocessors have a General Purpose Input/Output (GPIO) interface to communicate with external devices and peripherals through various protocols These GPIO connections are usually very flexible They can be individually configured as an input to read signals from other parts of a circuit, or as an output to control or send signals to other devices GPIOs are typically arranged into 8-port groups that are often sufficient for data and control support for external devices Despite the convenience and flexibility of this interface, microprocessors sometimes offer a limited number of GPIO ports for the purpose of reducing pin counts and package sizes For many applications, designers need more GPIO ports than those available on the microprocessor This design provides a solution that uses a Lattice CPLD as a It provides additional control (control signal and data output signal) and monitoring (input data signal) capabilities when the microprocessor has insufficient I/O ports Theory of Operation Overview The design is used to interface a microprocessor with a back-end device through a common timing specification This design is configured as eight banks that are independent of each other Each bank consists of a few GPIO ports The number of GPIO ports in each bank can be configured by the designer, with a default value of four Each GPIO port in a bank can be individually configured as an input, output or bi-directional port by the microprocessor The module provides an active low interrupt pin When related internal registers are configured correctly, the interrupt may be activated when any of the GPIO inputs reach the programmed interrupt level Figure 1 is the top-level block diagram of this design It provides a generic interface for the microprocessor and eight GPIO banks The microprocessor s data width and the number of GPIO ports are set by the default value Table 1 lists the I/O pins used in this design Figure 1 I/O Interface Block Diagram (4 bits) Bank 0 General I/O (4 Bits in Bank 0) bank_address (4 bits) Bank 1 General I/O (4 Bits in Bank 1) (3 bits) Bank General I/O (4 Bits in Bank ) Microprocessor Interface Bank 3 Bank 4 General I/O (4 Bits in Bank 3) General I/O (4 Bits in Bank 4) Back-End Interface Bank 5 General I/O (4 Bits in Bank 5) interrupt Bank 6 General I/O (4 Bits in Bank 6) Bank 7 General I/O (4 Bits in Bank 7) Note: The width and general I/O width can be configured by the designer The default value is 4 011 Lattice Semiconductor Corp All Lattice trademarks, registered trademarks, patents, and disclaimers are as listed at wwwlatticesemicom/legal All other brand or product names are trademarks or registered trademarks of their respective holders The specifications and information herein are subject to change without notice wwwlatticesemicom 1 rd1065_013

Table 1 Expander I/O Interface Descriptions Signal Name Signal Direction Active State Definition Microprocessor Interface (4 bits) Bi-directional N/A Data bus with CPU bank_address (4 bits) Input 0x0,0x1 0xf Address used to select one of the 16 banks (3 bits) Input 0x0,0x1,0x,0x3,0x4 Common Microprocessor Interface Various microprocessors require different timing specifications to read from or write to the external device The microprocessor timing defined in this design is based on the ARM7 timing specification (refer to ARM7TDMI-S Revision r4p3) Figures and 3 show the functional representation of the write and read operations respectively Figure Microprocessor Write Data to GPIO Address used to select one of the four registers in each bank or input data from back-end device Input Low = write High = read Write or read control signal from the CPU Input Low Chip select control signal from the CPU interrupt Output Low Interrupt signal generated by the back-end device Input N/A Clock signal from CPU to synchronize operation Back-end Interface General I/O (4 bits) Input,Output or Bi-directional N/A Eight independent GPIO banks cycle 0 1 bank_address Bank Address (0x0, 0x1, y, 0x7) Data out register (0x3) write Data from CPU General I/O Port () Data from CPU Initially, the microprocessor pulls down the signals and to implement a write cycle Meanwhile, the signal s bank_address and must be set to the appropriate values in order to write a specific bank and a register If the microprocessor writes data to the back-end device, the value of must be set to 0x3 The data from the microprocessor must be available at the same time It takes two cycles for the microprocessor to complete the write operation During this time, the control signals such as, bank_address,,, and must not be updated

Figure 3 Microprocessor Read Data from GPIO cycle 0 1 bank_address Bank address (0x0, 0x1, y, 0x7) (0x4) read General I/O Port () Data from back-end device Data from back-end device To initiate a read cycle, the microprocessor pulls down the signal and pulls up the signal Meanwhile, the signals bank_address and must be set to the appropriate values to determine which bank and which register to read from If the microprocessor reads data from the back-end device, the value of must be set to 0x4 Like the write operation, the microprocessor also takes two cycles to complete the read operations Therefore the control signals from the microprocessor interface should not be updated during this period The data from the back-end device is available at the second cycle Operation The eight GPIO banks have the same structure and are independent of each other For every microprocessor operation, the signal bank_address will determine the bank with which the microprocessor will communicate The designer can easily add more banks if additional GPIO ports are needed Figure 4 shows the function of each bank 3

Figure 4 Functional Block Diagram a GPIO Bank bank_address Decoder Decoder Bank Select Register Select Register Select and Bank Select Interrupt Mask Register Interrupt Polarity Register Tri-state Register Data Out Register General I/O Write/Read Write Read Bank Select and Read Interrupt Mask Register Interrupt Polarity Register Clock Tri-state Register Data Out Register Register Select Interrupt (Bank 0) Or xor Interrupt Polarity Register Interrupt Mask Register Interrupt And Interrupt (Bank 1) Interrupt (Bank 7) There are four registers in each bank These include the interrupt mask register, interrupt polarity register, tri-state register and data out register These registers are all four bits wide by default The microprocessor can read from or write to the registers by providing the proper bank select signal and register address Interrupt Mask Register Definition The interrupt mask register defines which GPIO input can generate an interrupt to the microprocessor When the bit in this register is set to 0, the corresponding GPIO input can generate interrupt Register Name Register Address Width (Default) Reset Value Access Interrupt mask register 0x0 4 0xf Read/Write Interrupt Polarity Register Definition The interrupt polarity register defines the active level of a GPIO input which can generate an interrupt When the bit is set to 1 in this register, the corresponding GPIO input generates an interrupt when its level is high When the bit is set to 0, the corresponding GPIO input generates an interrupt when its level is low Register Name Register Address Width (Default) Reset Value Access Interrupt polarity register 0x1 4 0x0 Read/Write 4

Tri-state Register Definition The tri-state register enables or disables the output and bi-directional modes of operation for each GPIO When the bit is set to 1 in this register, the corresponding GPIO output driver is enabled When the bit is set to 0, the corresponding GPIO is configured as input and the output/bi-directional driver operates in tri-state mode Register Name Register Address Width (Default) Reset Value Access Tri-state register 0x 4 0x0 Read/Write Data Out Register Definition The data out register drives GPIO outputs Register Name Register Address Width (Default) Reset Value Access Tri-state register 0x3 4 0x0 Read/Write The first four register address values (0x0, 0x1, 0x, 0x3) select the specific register to be written to or read from If the value of register address is 0x4, this indicates that the microprocessor reads data from the GPIO port directly The GPIO expander ignores the other values of the signal register address Before every application, the microprocessor selects one or more banks to be used depending on how many GPIO ports the application uses At the same time, the microprocessor sets the appropriate values for these four registers before the read or write operation begins on the back-end device Figure 5 shows a timing diagram of how the microprocessor writes data to the register and Figure 6 shows timing diagram of how the microprocessor reads data from the register Figure 5 Microprocessor Writes Data to Registers cycle 0 1 bank_address Bank address (0x0, 0x1, y, 0x7) (0x0,0x1,0x,0x3) Write Data from CPU register in bank Data from CPU 5

Figure 6 Microprocessor Reads Data from the Register cycle 0 1 bank_address Bank address (0x0, 0x1, y, 0x7) (0x0,0x1,0x,0x3) read register in bank Register data Register data GPIO Configuration Each bank is connected with four GPIO ports by default These GPIO ports can be dynamically and individually configured as input, output or bi-directional ports by setting the tri-state register as 1 or 0 GPIO as an Input Signal When the GPIO is used as an input, the corresponding bit in the tri-state register must be set to 0 and the corresponding bit in the interrupt mask register must be set to 1 by the microprocessor The microprocessor can set the signal to 0x4 to read the input GPIO value GPIO as an Output Signal When the GPIO is used as an output, the corresponding bit in the tri-state register must be set to 1 and the corresponding bit in the data out register must be written to the value that is required to be driven on the GPIO The corresponding bit in the interrupt mask register must be set to 1 to disable generation of spurious interrupt All these operations should be done by the microprocessor GPIO as a Bi-directional Signal To use the GPIO as a bi-directional signal, the corresponding bit in the tri-state register must be toggled up and down to enable or disable tri-state of the bi-directional driver The corresponding bit in the data out register must be written to the value that is required to be driven on the output driver The corresponding bit in the interrupt mask register must be set to 1 to disable generation of spurious interrupt All these operations should be done by the microprocessor GPIO as an Interrupt Input When the GPIO is used as an interrupt input, the corresponding bit in the tri-state register must be set to 0 and the corresponding bit in the interrupt mask register must be set to 0 as well by the microprocessor The corresponding bit in the interrupt polarity register indicates the active level of the GPIO interrupt Reset Value This design has a reset signal not shown in Figure 1 This reset signal is used to set all the registers and the GPIO to the initial values When this signal is active, all GPIOs are configured as inputs and the output drivers are disabled The interrupt mask registers are set to 1 to disable spurious interrupt generation 6

Test Bench Description The test bench for this design is an application example that shows how to use the design The is used to interface with a SPI slave device as shown in Figure 7 Figure 7 Interfacing the Microprocessor to the SPI Slave sclk Bank 0 ss mosi_slave SPI Slave bank_address miso_slave Microprocessor Interface interrupt Bank 1 General I/O Bank 7 General I/O This example selects bank 0 of the to connect with the SPI slave device Three general I/O ports in bank 0 are configured as outputs by the microprocessor and are used as the serial signal, slave select signal and master-out-slave-in signal respectively, as defined by the SPI protocol The last port in bank 0 is configured as an input by the microprocessor and is used as the master-in-slave-out signal After reset, the microprocessor initializes the registers in bank 0 Figure 8 shows the timing of this operation Figure 8 Microprocessor Initializes the Registers in Bank 0 Figure 9 shows the timing of the read operation of the registers in bank 0 7

Figure 9 Microprocessor Reads the Registers in Bank 0 The GPIO is able to generate the SPI timing based on the SPI protocol Figure 10 shows the read/write timing between the and the read/write device Figure 10 SPI Timing 8

Implementation This design is implemented in Verilog and VHDL When using this design in a different device, density, speed, or grade, performance and utilization may vary Default settings are used during the fitting of the design Table Performance and Resource Utilization Architecture Device Family Language Speed Grade Utilization f MAX (MHz) I/Os Resources LatticeECP3 1 Verilog -6 4 LUTs >100 47 N/A VHDL -6 11 LUTs >100 47 N/A LatticeXP Verilog -5 77 LUTs >100 47 N/A VHDL -5 74 LUTs >100 47 N/A MachXO 3 Verilog -3 38 LUTs >100 47 N/A VHDL -3 06 LUTs >100 47 N/A ispmach 4000ZE 4 Verilog -5 (ns) 187 Macrocells >100 47 N/A VHDL -5 (ns) 194 Macrocells >100 47 N/A Platform Manager 5 Verilog -3 50 LUTs >100 47 N/A VHDL -3 07 LUTs >100 47 N/A 1 Performance and utilization characteristics are generated using LFE3-17EA-6FTN56C, with Lattice Diamond 1 design software Performance and utilization characteristics are generated using LFXP-5E-5TN144C, with Lattice Diamond 1 design software 3 Performance and utilization characteristics are generated using LCMXO640C-3T100C, with Lattice Diamond 1 design software 4 Performance and utilization characteristics are generated using LC456ZE-5TN100C, with Lattice isplever Classic 14 software 5 Performance and utilization characteristics are generated using LPTM10-1107-3FTG08CES,with isplever 81 SP1 software Technical Support Assistance Hotline: 1-800-LATTICE (North America) +1-503-68-8001 (Outside North America) e-mail: techsupport@latticesemicom Internet: wwwlatticesemicom Revision History Date Version Change Summary December 009 010 Initial release March 010 011 Added VHDL support Added support for the LatticeXP device family December 010 01 Added support for Platform Manager device family Added support for Lattice Diamond 11 and isplever 81 SP1 design software April 011 013 Added support for the LatticeECP3 device family Added support for Lattice Diamond 1 design software 9