QorIQ espi Controller Register Setting Considerations and Programming Examples



Similar documents
USB to SPI Device Driver Installation Instructions

MPR121 Serial Communication

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, ColdFire+, C- Ware, the Energy Efficient Solutions logo, Kinetis,

Connecting Kinetis MCU with CMOS Sensor Interface through GPIO QQVGA image transfer to Kinetis internal SRAM

Safety Lifecycle illustrated with exemplified EPS

Qorivva MPC5643L Dual Processor Mode Mark Ruthenbeck Applications Engineering Microcontroller Solutions Group

Freescale MAC Security Setup

FRDM-KL25Z User's Manual Rev. 1.0

Production Flash Programming Best Practices for Kinetis K- and L-series MCUs

Installing Service Pack Updater Archive for CodeWarrior Tools (Windows and Linux) Quick Start

Hardware Configurations for the i.mx Family USB Modules

76-77 GHz RF Transmitter Front-end for W-band Radar Applications

Flexible Active Shutter Control Interface using the MC1323x

Programming Audio Applications in the i.mx21 MC9328MX21

PowerQUICC II Pro (MPC83xx) PCI Agent Initialization

UART Boot Loader Design on the Kinetis E Series

AND8336. Design Examples of On Board Dual Supply Voltage Logic Translators. Prepared by: Jim Lepkowski ON Semiconductor.

Configuring CoreNet Platform Cache (CPC) as SRAM For Use by Linux Applications

Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, ColdFire+, C- Ware, the Energy Efficient Solutions logo, Kinetis,

Solar Panel 3-Phase Inverter Controlled by the PXS20 Libor Prokop Rožnov pod Radhoštem, Czech Republic

How To Use A Watt Saver On A Microcontroller (Watt Saver) On A Cell Phone Or Mp3 Player

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

How To Build A Project On An Eclipse Powerbook For Anarc (Powerbook) On An Ipa (Powerpoint) On A Microcontroller (Powerboard) On Microcontrollers (Powerstation) On Your Microcontroller 2 (Powerclock

How to Run the MQX RTOS on Various RAM Memories for i.mx 6SoloX

Data Movement Between Big-Endian and Little-Endian Devices

CodeWarrior Development Studio for Freescale S12(X) Microcontrollers Quick Start

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

TWR-KV31F120M Sample Code Guide for IAR Board configuration, software, and development tools Rev.0

CodeWarrior Development Studio Floating Licensing Quick Start

etpu Host Interface by:

MPC8245/MPC8241 Memory Clock Design Guidelines: Part 1

AVR317: Using the Master SPI Mode of the USART module. 8-bit Microcontrollers. Application Note. Features. Introduction

MCF54418 NAND Flash Controller

Building and Debugging a project using Keil MDK-ARM Eclipse plug-in

Windows 7: Using USB TAP on a Classic CodeWarrior Installation (MGT V9.2 DSC V8.3)

Detecting a CPM Overload on the PowerQUICC II

HT1632C 32 8 &24 16 LED Driver

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

Freescale Semiconductor, Inc. Product Brief Integrated Portable System Processor DragonBall ΤΜ

Adding SDIO Wi-Fi Solution to i.mx Windows CE 5.0/Windows CE 6.0

Installing Service Pack Updater Archive for CodeWarrior Tools (Windows and Linux) Quick Start

HEF4021B. 1. General description. 2. Features and benefits. 3. Ordering information. 8-bit static shift register

Understanding LCD Memory and Bus Bandwidth Requirements ColdFire, LCD, and Crossbar Switch

RF Power LDMOS Transistor High Ruggedness N--Channel Enhancement--Mode Lateral MOSFET

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

DS1621 Digital Thermometer and Thermostat

MC13783 Buck and Boost Inductor Sizing

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

How To Improve Performance On A P4080 Processor

Initializing the TSEC Controller

Designing an Induction Cooker Using the S08PT Family

ES_LPC4357/53/37/33. Errata sheet LPC4357/53/37/33. Document information

CAT28C64B F R E E. 64K-Bit CMOS PARALLEL EEPROM L E A D FEATURES DESCRIPTION BLOCK DIAGRAM

DS Wire Digital Thermometer and Thermostat

Single 2.5V - 3.6V or 2.7V - 3.6V supply Atmel RapidS serial interface: 66MHz maximum clock frequency. SPI compatible modes 0 and 3

Single Phase Two-Channel Interleaved PFC Operating in CrM

Wafer Level Chip Scale Package (WLCSP)

DS1621 Digital Thermometer and Thermostat

RF Power LDMOS Transistors Enhancement--Mode Lateral MOSFETs

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

USER GUIDE EDBG. Description

IRTC Compensation and 1 Hz Clock Generation

Tweeting? Please use hashtag #FTF2011. Freescale on Facebook Tag yourself in photos and upload your own!

RETRIEVING DATA FROM THE DDC112

RF Power LDMOS Transistors High Ruggedness N--Channel Enhancement--Mode Lateral MOSFETs

DS2401 Silicon Serial Number

Allows the user to protect against inadvertent write operations. Device select and address bytes are Acknowledged Data Bytes are not Acknowledged

Installation of the MMA955xL CodeWarrior Service Pack Author: Fengyi Li Application Engineer

Simple Method of Changing the Frequency Range of a Power Amplifier Circuit

The Programming Interface

Scanning Comparator (ScanComp) Features. General Description. Input/Output Connections. When to Use a Scanning Comparator. clock - Digital Input* 1.

M25P05-A. 512-Kbit, serial flash memory, 50 MHz SPI bus interface. Features

Cyclic Redundant Checker Calculation on Power Architecture Technology and Comparison of Big-Endian Versus Little-Endian

Quick Start Guide. MRB-KW01 Development Platform Radio Utility Application Demo MODULAR REFERENCE BOARD

EN25P64 EN25P Megabit Uniform Sector, Serial Flash Memory FEATURES GENERAL DESCRIPTION

AN3998 Application note

AN LPC1700 timer triggered memory to GPIO data transfer. Document information. LPC1700, GPIO, DMA, Timer0, Sleep Mode

DS1821 Programmable Digital Thermostat and Thermometer

Developing an Application for the i.mx Devices on the Linux Platform

Command Processor for MPSSE and MCU Host Bus Emulation Modes

Heterojunction Bipolar Transistor Technology (InGaP HBT) Broadband High Linearity Amplifier

AVR319: Using the USI module for SPI communication. 8-bit Microcontrollers. Application Note. Features. Introduction

PACKAGE OUTLINE DALLAS DS2434 DS2434 GND. PR 35 PACKAGE See Mech. Drawings Section

PrimeCell Synchronous Serial Port (PL022) ARM. Technical Reference Manual. Revision: r1p4

FPGA INTEGRATION MANUAL SATURN-SIL 2 MODULES. Dictionary Code. Edition 01. Revision 00. Number of pages 18

NOTE: The Flatpak version has the same pinouts (Connection Diagram) as the Dual In-Line Package.

MicroMag3 3-Axis Magnetic Sensor Module

DS2155 T1/E1/J1 Single-Chip Transceiver

GTS-4E Hardware User Manual. Version: V1.1.0 Date:

Features. Instruction. Decoder Control Logic, And Clock Generators. Address Compare amd Write Enable. Protect Register V PP.

MSC8156 and MSC8157 PCI Express Performance

Introduction to PCI Express Positioning Information

Software and Support Activation. Quick Start Guide

The Freescale Embedded Hypervisor

Using Altera MAX Series as Microcontroller I/O Expanders

Software Real Time Clock Implementation on MC9S08LG32

Transcription:

Freescale Semiconductor Application Note Document Number: AN4375 Rev. 1, 06/2012 QorIQ espi Controller Register Setting Considerations and Programming Examples About this document This document describes how to calculate the maximum frequency, transfer formats or different timings with various configuration settings. It also includes programming examples. Contents About this document.......................... 1 1. espi background information................... 2 2. Calculating the maximum SPI frequency.......... 2 3. espi transfer formats......................... 4 4. espi programming examples................... 6 5. Revision history............................. 9 2012 Freescale Semiconductor, Inc. All rights reserved.

espi background information 1 espi background information The enhanced serial peripheral interface (espi) is a full-duplex, synchronous, character-oriented channel that supports a simple interface. The espi: Can only be used as an SPI master Is different from a regular SPI interface, because both its transmitter and receiver have a FIFO of 32 bytes Is optimized to send data in a frame Can support different operation modes Can achieve better performance when it interfaces with SPI-based flash memories or EEPROMs To obtain a comprehensive understanding of the espi functionality and the basic operation of the SPI-based flash memory or other SPI based devices, see the following documentation, most of which are available on the Freescale website listed on the last page of this document: Applicable chip reference manual Applicable chip hardware specifications Applicable chip errata Manufacturer data sheet on the SPI-based devices selected 2 Calculating the maximum SPI frequency Some chip reference manuals state that the espi can transfer a single character at very high rates a maximum (up to system clock / 2), which is not true. When the SPMODEx[DIV16x] = 0, and SPMODEx[PMx] = 0000, the espi clock is configured to be the system clock divided by 2. In most cases, the system clock is defined to be the platform clock divided by 2. However, the maximum SPI clock frequency is also limited by the espi AC timing specification and its connected SPI slave device. In most cases, the SPI clock is lower than the platform clock divided by 4. The maximum espi clock (Fmax) is calculated from the minimum espi cycle period. For the output side of espi, the formula for the minimum espi cycle period is: Tout = espi output Master output delay + board_skew + external spi device input setup time. Eqn. 1 For the input side of espi, the formula for the minimum espi cycle period is: Tin = espi inputs Master input setup time + board_skew + external spi device output delay. Eqn. 2 The maximum espi clock is calculated from: Fmax = 1/(max(Tin, Tout)) Eqn. 3 2 Freescale Semiconductor

Calculating the maximum SPI frequency Let s choose the P1022 and Atmel AT25DF641 flash memory as an example to show how to calculate the maximum SPI frequency. This table shows the AC timing specifications of the P1022. Table 1. P1022 SPI AC timing specifications Parameter Symbol 1 Min Max Unit Note SPI_MOSI output Master data (internal clock) hold time t NIKHOX 0.5 + (t PLATFORM_CLK *SPMODE[HO_ADJ]) ns 2, 3 SPI_MOSI output Master data (internal clock) delay t NIKHOV 5.5 + (t PLATFORM_CLK *SPMODE[HO_ADJ]) ns 2,3 SPI_CS outputs Master data (internal clock) hold time SPI_CS outputs Master data (internal clock) delay SPI inputs Master data (internal clock) input setup time SPI inputs Master data (internal clock) input hold time t NIKHOX2 0 ns 2 t NIKHOV2 5.5 ns 2 t NIIVKH 5 ns t NIIXKH 0 ns Notes: 1. The symbols used for timing specifications follow the pattern of t (first two letters of functional block)(signal)(state) (reference)(state) for inputs and t (first two letters of functional block)(reference)(state)(signal)(state) for outputs. For example, t NIKHOV symbolizes the NMSI outputs internal timing (NI) for the time t SPI memory clock reference (K) goes from the high state (H) until outputs (O) are valid (V). 2. Output specifications are measured from the 50% level of the rising edge of CLKIN to the 50% level of the signal. Timings are measured at the pin. 3. See QorIQ P1022 Integrated Processor Family Reference Manual for detail about the register SPMODE. This table shows the AC timing specifications of the AT25DF641 from Atmel. Table 2. Atmel AT25DF641 AC Timing Specifications Parameter Symbol 1 Min Max Unit Max frequency 100 MHz Output hold time t OH 2 ns Output valid time t V 5 ns Input setup time t DS 2 ns Input hold time t DH 1 ns Ignore the board skew for now and choose the maximum platform clock of 533.33 MHz, which t PLATFORM_CLK is 1.875 ns. To meet the SPI flash of 1 ns hold time, the SPMODE[HO_ADJ] must be set to 1. From Equation 1, the T out can be calculated by: T out = 5.5+ (tplatform_clk *SPMODE[HO_ADJ]) + 2 = 5.5 + (1.875*1)+2 = 9.375(ns) Eqn. 4 Freescale Semiconductor 3

espi transfer formats Based on Equation 2, the T in can be calculated by: The maximum SPI frequency is calculated from Equation 3: T in = 5 + 5= 10 (ns) Eqn. 5 Fmax = 1/Tin = 1/10 Eqn. 6 Therefore, the maximum SPI frequency value is 100 MHz based on the AC timing specifications. However, the final maximum SPI frequency is also limited by the software settings. It is determined by the selection of SPMODEx[PMx] and SPMODEx[DIV16x]. The formula to calculate the maximum frequency is: Fmax = System_Clk / [(SPMODEx[PMx]+1)*2] when SPMODE[DIV16x] = 0 Eqn. 7 Fmax = System_Clk / [(SPMODEx[PMx]+1)*2*16] when SPMODE[DIV16x] = 1 Eqn. 8 where: System_clk is platform clock divided by 2 For this example, the espi maximum frequency can be calculated by selecting SPMODEx[PMx] = 1 and SPMODEx[DIV16x] = 0. Fmax = 533.33/2 / [(1+1)*2] = 66.66 (MHz) Eqn. 9 If the platform clock is 400 MHz, the espi maximum SPI clock can be 100 MHz by selecting SPMOEx[PMx] = 0 and SPMODEx[DIV16x]=0. Fmax = 400/2 / [(0+1)*2] = 100.00 (MHz) Eqn. 10 As you can see, a higher platform frequency may not be necessary to get a higher SPI clock. 3 espi transfer formats Depending on what the value of SPMODEx[Cpx] is set to, the SPI_CLOCK starts toggling at a different time. The espi transfer format in which SPI_CLK starts toggling is in the middle of the transfer when SPMODEx[CPx] = 0. While the espi transfer format in which SPI_CLK starts toggling is at the beginning of the transfer when SPMODEx[CPx] = 1. This figure shows the espi transfer format with SPMODEx[CPx] = 0. 4 Freescale Semiconductor

espi transfer formats SPI_CLK (CI = 0) SPI_CLK (CI = 1) SPI_MOSI (From master) msb lsb SPI_MISO (From slave) msb lsb Q CSx/SPISEL NOTE: Q = Undefined signal Figure 1. espi transfer format with SPMODEx[CPx] = 0 This figure shows the espi transfer format with SPMODEx[CPx] = 1. SPI_CLK (CI = 0) SPI_CLK (CI = 1) SPI_MOSI (From master) msb lsb SPI_MISO (From slave) Q msb lsb CSx/SPISEL NOTE: Q = Undefined signal Figure 2. espi transfer format with SPMODEx[CPx] = 1 Freescale Semiconductor 5

espi programming examples This figure shows how to program RxDelay and HLD to work with RapidS mode on AT25DF641 SPI serial flash memory. The SPCOM[RxDelay] register should be set to 1. The SPCOM[HLD] register should be set to 1. The SPMODEx[CIx] = 0; SPMODEx[CPx] = 1. Figure 3. espi Transfer Format with SPCOM[RxDelay] = 1 This figure shows the read-data bytes at a higher speed (FAST_READ) command sequence with a Spansion S25FLxxx flash chip. The SPCOM[RxDelay] register should be set to 1. The SPCOM[HLD] register should be set to 0. SPMODEx[CIx] = 0; SPMODEx[CPx] = 0. Note that an extra dummy-byte writes to SPITF before writing to SPCOM. Figure 4. Read data bytes at higher speed (FAST_READ) command sequence 4 espi programming examples NOTE The applicable chip reference manual includes good examples regarding the content of SPITF and SPIRF with various parameters set (specifically, see sections espi transmit FIFO access register (SPITF), and espi receive FIFO access register (SPIRF). Section espi Programming Examples includes 24-bit and 16-bit address examples, but the examples in this document are more detailed. NOTE Note that in these examples, hex is denoted by an h suffix. 6 Freescale Semiconductor

espi programming examples 4.1 16-bit address example The following sequence initializes the espi to read 36 bytes from 16-bit address memory, start address = 0040h. In this example, chip-select 1 is used. 1. Configure a parallel I/O signal to operate as the espi CS1 output signal. 2. Write FFFF FFFFh to SPIE to clear any previous events. Configure SPIM to enable all desired espi interrupts. 3. Configure SPMODE = 8000 100Fh to enable normal operation, espi enabled. 4. Configure SPMODE1 = 2417 1108h REV1 = 1, PM1 = 4 (divide espi input clock by 10), LEN1 = 7, POL1 = 1, CS1BEF = CS1AFT = CS1CG= 1. 5. Configure SPITF = 0300 40xxh (xx is don t care) 03h is read opcode while 0040h is the 16-bit start address. This should be done by two writes to SPITF: 1 half-word write with 0300h, then 1-byte write with 40h 6. Configure SPCOM = 4003 0026h so 3 bytes are skipped (1 for opcode and 2 for 16-bit address), TRANLEN = 36 + 3 1 = 38 = 26h. 4.2 8-bit address example The following sequence initializes the espi to read 6 bytes from 8-bit address memory from start address = 5Eh and then to read 2 bytes from start address = 40h. In this example, chip-select 0 is used. 1. Configure a parallel I/O signal to operate as the espi CS0 output signal. 2. Write FFFF FFFFh to SPIE to clear any previous events. Configure SPIM to enable all desired espi interrupts. 3. Configure SPMODE = 8000 100Fh to enable normal operation, espi enabled. 4. Configure SPMODE0 = 2417 1108h REV0 = 1, PM0 = 4 (divide espi input clock by 10), LEN0 = 7, POL0 = 1, CS0BEF = CS0AFT = CS0CG = 1. 5. Configure SPITF = 035E 0340h 03h is read opcode while 5Eh is the first 8-bit start address.the second 03h is for the second read opcode while 40h is the second 8-bit start address. 6. Write SPCOM = 0002 0007h so that 2 bytes are skipped (1 for opcode and 1 for 8-bit address), TRANLEN = 6 + 2 1. 7. Wait for SPIE[DON] to be set. 8. Write SPCOM = 0002 0003h so that it skips 2 bytes (1 for opcode and 1 for 8-bit address), TRANLEN= 2+2 1. Freescale Semiconductor 7

espi programming examples 4.3 RapidS example The following sequence initializes the espi to read 36 bytes from 16-bit address memory, start address = 0040h using the RapidS mode (mode 0). It corresponds to Figure 3. In this example, chip-select 1 is used. 1. Configure a parallel I/O signal to operate as the espi CS1 output signal. 2. Write FFFF FFFFh to SPIE to clear any previous events. Configure SPIM to enable all desired espi interrupts. 3. Configure SPMODE = 8000 100Fh to enable normal operation, espi enabled. 4. Configure SPMODE1 = 6117 1108h CP1 = 1, REV1 = 1, PM1 = 1 (divide espi input clock by 4), LEN1 = 7, POL1 = 1, CS1BEF = CS1AFT = CS1CG = 1. (Ci = 1, cp = 0 if mode 3 is used) 5. Configure SPITF = 0300 40xxh (xx is don t care) 03h is read opcode while 0040h is the 16-bit start address. This should be done by two writes to SPITF: 1 half-word write with 0300h, then 1-byte write with 40h 6. Configure SPCOM = 6403 0026h RxDelay = 1, HLD=1 (it should set to 0 if mode 3 is used); 3 bytes are skipped (1 for opcode and 2 for 16-bit address), TRANLEN = 36 + 3 1 = 38 = 26h. 4.4 32-bit address example The following sequence initializes the espi to read 36 bytes from 32-bit address memory, start address = 0000 0040h: 1. Configure a parallel I/O signal to operate as the espi CS1 output signal. 2. Write FFFF FFFFh to SPIE to clear any previous events. Configure SPIM to enable all desired espi interrupts. 3. Configure SPMODE = 8000 100Fh to enable normal operation, espi enabled. 4. Configure SPMODE1 = 2417 1108h REV1 = 1, PM1 = 4 (divide espi input clock by 10), LEN1 = 7, POL1 = 1, CS1BEF = CS1AFT = CS1CG = 1. 5. Configure SPITF = 0300 0000h (32-bit write), 40xx xxxxh (only one byte write) 03h is read opcode while 0000 0040h is the 32-bit start address. This should be done by two writes to SPITF: 1 word write with 0300 0000h, then 1-byte write with 40h 6. Configure SPCOM = 4005 0028h so 5 bytes are skipped (1 for opcode and 4 for 32-bit address), TRANLEN = 36 + 5 1. 8 Freescale Semiconductor

Revision history 5 Revision history This table provides a revision history for this document. Table 3. Document revision history Rev. number Date Substantive change(s) 1 06/2012 Updated the steps in Section 4.2, 8-bit address example. Modified Equation 4. 0 02/2012 Initial public release Freescale Semiconductor 9

How to Reach Us: Home Page: freescale.com Web Support: freescale.com/support Information in this document is provided solely to enable system and software implementers to use Freescale products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits based on the information in this document. Freescale reserves the right to make changes without further notice to any products herein. Freescale makes no warranty, representation, or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. Typical parameters that may be provided in Freescale data sheets and/or specifications can and do vary in different applications, and actual performance may vary over time. All operating parameters, including typicals, must be validated for each customer application by customer s technical experts. Freescale does not convey any license under its patent rights nor the rights of others. Freescale sells products pursuant to standard terms and conditions of sale, which can be found at the following address: http://www.reg.net/v2/webservices/freescale/docs/termsandconditions.htm. Freescale, the Freescale logo, AltiVec, C-5, CodeTest, CodeWarrior, ColdFire, C-Ware, Energy Efficient Solutions logo, Kinetis, mobilegt, PowerQUICC, Processor Expert, QorIQ, Qorivva, StarCore, Symphony, and VortiQa are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, MagniV, MXC, Platform in a Package, QorIQ Qonverge, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, Vybrid, and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. The Power Architecture and Power.org word marks and the Power and Power.org logos and related marks are trademarks and service marks licensed by Power.org. 2012 Freescale Semiconductor, Inc. Document Number: AN4375 Rev. 1 06/2012