0% found this document useful (0 votes)
172 views

Machxo3 Programming and Configuration Usage Guide: August 2017 Technical Note Tn1279

Uploaded by

Horacio Dorantes
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
172 views

Machxo3 Programming and Configuration Usage Guide: August 2017 Technical Note Tn1279

Uploaded by

Horacio Dorantes
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

MachXO3 Programming and

Configuration Usage Guide


August 2017 Technical Note TN1279

Introduction
The MachXO3™ is an SRAM-based Programmable Logic Device that includes an internal Non-Volatile Configura-
tion Memory (NVCM) in the MachXO3L version and On-Chip Flash in the MachXO3LF version. This allows the
MachXO3L family to support the best of both worlds – infinitely configurable (SRAM) and non-volatile
(NVCM/Flash) capabilities. The MachXO3L/LF provides a rich set of features for programming and configuration of
the FPGA. You have many options available to you for building the programming solution that fits your needs. Each
of the options available will be described in detail so that you can put together the programming and configuration
solution that meets your needs.

MachXO3L/LF devices contain two types of memory, SRAM and NVCM (MachXO3L) or Flash (MachXO3LF).
SRAM memory contains the active configuration, essentially the “fuses” that define the behavior of the FPGA. The
active configuration is, in most cases, retrieved from a non-volatile memory. The non-volatile memory holds the
configuration data that is loaded into the FPGAs SRAM. The MachXO3L/LF provides an internal NVCM or Flash
memory that stores the configuration data loaded into the MachXO3L/LF SRAM.

MachXO3L/LF Features
Key programming and configuration features of MachXO3L devices are:
• Instant-on configuration from internal NVCM (MachXO3L) or Flash (MachXO3LF) – powers up in milliseconds
• Infinite number of configuration cycle through volatile SRAM technology
• MachXO3L multi-time (up to nine times) programmability through non-volatile technology (NVCM)
• Single-chip, secure solution
• Multiple programming and configuration interfaces:
— 1149.1 JTAG
— Self download
— Slave SPI
— Master SPI
— Dual Boot
— I2C
• Programming and configuration ports:
— Slave SPI
— Master SPI
— I2C
— JTAG
• (MachXO3LF) User Flash Memory (UFM) for non-volatile data storage:
— Configuration Flash memory overflow
— EBR Initialization data
— Application specific data
• (MachXO3LF) Transparent programming of non-volatile memory
• Optional dual boot with external SPI memory
• Optional security bits for design protection
• Optional Bitstream Compression support
• TransFR Capability
— Leave alone I/O using Non-JTAG implementation
• SED support

© 2017 Lattice Semiconductor Corp. All Lattice trademarks, registered trademarks, patents, and disclaimers are as listed at www.latticesemi.com/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.

www.latticesemi.com 1 TN1279_2.2
MachXO3 Programming and Configuration Usage Guide

Definition of Terms
This document uses the following terms to describe common functions:

• BIT – The BIT file is the configuration data for the MachXO3L/LF that is stored in an external SPI Flash. It is a
binary file and is programmed unmodified into the SPI Flash.
• Configuration: Configuration refers to a change in the state of the MachXO3L/LF SRAM memory cells.
• Configuration Data – This is the data read from the non-volatile memory and loaded into the FPGA’s SRAM
configuration memory. This is also referred to as a bitstream, or device bitstream.
• Configuration Mode: The configuration mode defines the method the MachXO3L/LF uses to acquire the config-
uration data from the non-volatile memory.
• Internal Flash Memory (MachXO3LF) – JED file or bit file can be programmed directly into the internal flash
sector. User does not need to know where an actual page of the configuration data starts. The MachXO3LF con-
figuration engine handles the parsing in the flash to SRAM transfer.
• Internal NVCM (MachXO3L) – JED file or bit file can be programmed directly into the internal non-volatile sector.
User does not need to know where an actual page of the configuration data starts. The MachXO3L configuration
engine handles the parsing in the NVCM to SRAM transfer.
• JEDEC – The JEDEC file contains the configuration data programmed into the MachXO3L/LF Configuration
NVCM or Flash. Format information is provided later in this technical note.
• Number Formats – The following nomenclature is used to denote the radix of numbers
— 0x: Numbers preceded by ‘0x’ are hexadecimal
— b (suffix): Numbers suffixed with ‘b’ are binary
— All other numbers are decimal
• Offline mode – Offline mode is a term that is applied to both non-volatile memory programming and SRAM con-
figuration. When using offline mode programming/configuration the FPGA no longer operates in user mode. The
contents of the non-volatile or SRAM configuration memory are updated, but the MachXO3L/LF does not per-
form your logic operations until offline mode programming/configuration is complete.
• Port – A port refers to the physical connection used to perform programming and some configuration operations.
Ports on the MachXO3L include JTAG, SPI, and I2C physical connections.
• Programming: Programming refers to the process used to alter the contents of the internal or external non-vola-
tile configuration memory.
• Transparent Mode (MachXO3LF) – Transparent mode is used to update the Configuration Flash, and User
Flash Memory while leaving the MachXO3LF in User Mode.
• User Mode – The MachXO3L is in user mode when configuration is complete, and the FPGA is performing the
logic functions you have programmed it to perform.

2
MachXO3 Programming and Configuration Usage Guide

Configuration Process and Flow


Prior to becoming operational, the FPGA goes through a sequence of states, including initialization, configuration
and wake-up.

Figure 1. Configuration Flow

Power Up Power not stable


VCC > 1.06V*
VCCIO > 1.06V*

INITN and DONE


Driven Low

PROGRAMN or
Initialization INITN=Low

PROGRAMN de-asserted and tINITL expired

INITN Released
Device refresh:
• PROGRAMN falling edge
• IEEE 1532 REFRESH command

Device refresh Configuration ERROR


Write SRAM Memory INITN=Low

All configuration data received

Device refresh
Wake Up

DONE Released

Device refresh
User Mode

* The voltage level is for the MachXO3 E device. Voltage level may vary for other devices.

The MachXO3L/LF sysCONFIG ports provide industry standard communication protocols for programming and
configuring the FPGA. Each of the protocols shown in Table 1 provides a way to access the MachXO3L/LF device’s
internal NVCM/Flash, or to load its configuration SRAM. The Memory Space Accessibility section provides infor-
mation about the capabilities of each sysCONFIG port.

The sysCONFIG ports capable of accessing the SRAM have a priority order. The operation of the Configuration
Logic is not defined when a low priority sysCONFIG port is interrupted by a higher priority sysCONFIG port. Do not
permit simultaneous access to the Configuration Logic using a sysCONFIG port.

3
MachXO3 Programming and Configuration Usage Guide

Power-up Sequence
In order for the MachXO3L/LF to operate, power must be applied to the device. During a short period of time, as the
voltages applied to the system rise, the FPGA will have an indeterminate state.

As power continues to ramp, a Power On Reset (POR) circuit inside the FPGA becomes active. The POR circuit,
once active, makes sure the external I/O pins are in a high-impedance state. It also monitors the VCC and VCCIO0
input rails. The POR circuit waits for the following conditions:

• VCC > 1.06 V*


• VCCIO0 > 1.06 V*

* The voltage level is for the MachXO3L/LF E device. Voltage level may vary for other devices.

When these conditions are met the POR circuit releases an internal reset strobe, allowing the device to begin its
initialization process. The MachXO3L/LF asserts INITN active low, and drives DONE low. When INITN and DONE
are asserted low the device moves to the initialization state, as shown in Figure 2.

Figure 2. Configuration from Power-On-Reset Timing


tINITL
VCC/VCCIO

INITN

DONE

Initialization
The MachXO3L/LF enters the memory initialization phase immediately after the Power On Reset circuit drives the
INITN and DONE status pins low. The purpose of the initialization state is to clear all of the SRAM memory inside
the FPGA.

The FPGA remains in the initialization state until all of the following conditions are met:

• The tINITL time period has elapsed


• The PROGRAMN pin is deasserted
• The INITN pin is no longer asserted low by an external master

The INITN pin provides two functions during the initialization phase. The first is to indicate the FPGA is currently
clearing its configuration SRAM. The second is to act as an input preventing the transition from the initialization
state to the configuration state.

During the tINITL time period the FPGA is clearing the configuration SRAM. When the MachXO3L/LF is part of a
chain of devices each device will have different tINITL initialization times. The FPGA with the slowest tINITL parame-
ter can prevent other devices in the chain from starting to configure. Premature release of the INITN in a multi-
device chain may cause configuration of one or more chained devices to fail to configure intermittently.

Configuration
The rising edge of the INITN pin causes the FPGA to enter the configuration state. The FPGA is able to accept the
configuration bitstream created by the Diamond development tools.

The MachXO3L/LF begins fetching configuration data from non-volatile memory. The memory used to configure
the MachXO3L/LF is either the internal memory, or an external SPI Flash. The MachXO3L/LF does not leave the
Configuration state if there are no memories with valid configuration data. It is necessary to program the non-vola-
tile memory internal or attached to the FPGA, or to program it using the JTAG port.

4
MachXO3 Programming and Configuration Usage Guide

During the time the FPGA receives its configuration data the INITN control pin takes on its final function. INITN is
used to indicate an error exists in the configuration data. When INITN is high, configuration proceeds without issue.
If INITN is asserted low, an error has occurred and the FPGA will not operate.

Wake-up
Wake-up is the transition from configuration mode to user mode. The MachXO3L/LF’s fixed four-phase wake-up
sequence starts when the device has correctly received all of its configuration data. When all configuration data is
received, the FPGA asserts an internal DONE status bit. The assertion of the internal DONE causes a Wake Up
state machine to run that sequences four controls. The four control strobes are:

• External DONE
• Global Write Disable (GWDISn)
• Global Output Enable (GOE)
• Global Set/Reset (GSR)

The first phase of the Wake-Up process is for the MachXO3L/LF to release the Global Output Enable. When it is
asserted, permits the FPGA’s I/O to exit a high-impedance state and take on their programmed output function.
The FPGA inputs are always active. The input signals are prevented from performing any action on the FPGA flip-
flops by the assertion of the Global Set/Reset (GSR).

The second phase of the Wake-Up process releases the Global Set/Reset and the Global Write Disable controls.

The Global Set/Reset is an internal strobe that, when asserted, causes all I/O flip-flops, Look Up Table (LUT) flip-
flops, distributed RAM output flip-flops, and Embedded Block RAM output flip-flops that have the GSR enabled
attribute to be set/cleared per their hardware description language definition.

The Global Write Disable is a control that overrides the write enable strobe for all RAM logic inside the FPGA. The
inputs on the FPGA are always active, as mentioned in the Global Output Enable section. Keeping GWDIS
asserted prevents accidental corruption of the instantiated RAM resources inside the FPGA.

The last phase of the Wake-Up process is to assert the external DONE pin. The external DONE is a bi-directional,
open-drain I/O only when it is enabled. An external agent that holds the external DONE pin low prevents the wake-
up process of the MachXO3L/LF from proceeding. Only after the external DONE, if enabled, is active high does the
final wake-up phase complete. Wake-Up completes uninterrupted when the external DONE pin is not enabled.

Once the final wake-up phase is complete, the FPGA enters user mode.

User Mode
The MachXO3L/LF enters User Mode immediately following the Wake-Up sequence has completed. User Mode is
the point in time when the MachXO3L/LF begins performing the logic operations you designed. The MachXO3L/LF
remains in this state until one of three events occurs:

• The PROGRAMN input pin is asserted


• A REFRESH command is received via one of the configuration ports
• Power is cycled

5
MachXO3 Programming and Configuration Usage Guide

Clearing the Configuration Memory and Re-initialization


The current user mode configuration of the MachXO3L remains in operation until it is actively cleared, or power is
lost. Several methods are available to clear the internal configuration memory of the MachXO3L/LF. The first is to
remove power and reapply power. Another method is to toggle the PROGRAMN pin. Lastly you can reinitialize the
memory through a Refresh command. Any active configuration port can be used to send a Refresh command.

• Assertion of the PROGRAMn input


• Cycling power to the MachXO3L/LF
• Sending the Refresh command using a configuration port

Invoking one of these methods causes the MachXO3L/LF to drive INITN and DONE low. The MachXO3L/LF enters
the initialization state as described earlier.

Memory Space Accessibility


The two internal memories, NVCM (MachXO3L)/Flash(MachXO3LF) and SRAM, of the MachXO3L/LF have the
ability to be read and written. Each port on the MachXO3L/LF has a different level of access to each memory
space. Table 1 provides a cross-reference of the MachXO3L/LF ports and the memory space they can access.

As can be seen from Table 1, the JTAG port has the ability to read and write both of the internal memory spaces.
No other port has ability to read the SRAM configuration memory. The JTAG port has the ability to access the two
memory spaces in Offline or Transparent mode. Every other port has some limitation on the functions that can be
performed.

Table 1. Memory Space Accessibility of Different Ports


On-Chip NVCM/Flash SRAM
Port Read Write Read Write
JTAG Yes Yes Yes Yes
SPI Port Yes Yes No Yes
I2C Port Yes Yes No Yes
1 1
Internal WISHBONE (MachXO3LF) Yes Yes No
1. In Transparent mode only.

On-chip Flash Programming (MachXO3LF Only)


As shown in Figure 1, on-chip Flash is programmed with different programming modes. These programming
modes are discussed in the next sections. Within the different programming modes, there are two methods of pro-
gramming the on-chip Flash: Offline and Background programming.

Offline Programming – This method requires the device to enter into programming mode. When in programming
mode, the device stops working, until the programming is completed. When using Diamond Programmer, the
Offline Mode is selected using operations starting with FLASH. Unless noted by the operation, the Flash sectors
accessed are Feature, Configuration and UFM.

Background Programming – This method allows the device to continue operating in User Mode, while the config-
ration logic programs the on-chip Flash memory. When the on-chip Flash memory programming is completed, the
device can download into the SRAM with REFRESH instruction. When using Diamond Programmer, the Back-
ground Mode is selected using operations starting with XFLASH. Unless noted by the operation, the Flash sectors
accessed are Configuration and UFM.

Note that if background programming is used on the MachXO3LF devices with two PLLs, the system must put the
right side PLL in reset state during background programming. The required duration, erase portion, of the back-
ground Flash programming time is specified in Table 98 of TN1294, Using Hardened Control Functions in
MachXO3 Devices Reference Guide. The left side PLL can stay active during background programming.

6
MachXO3 Programming and Configuration Usage Guide

Bitstream/PROM Sizes
The MachXO3L/LF is a SRAM based FPGA. The SRAM configuration memory must be loaded from a non-volatile
memory that can store all of the configuration data. The size of the configuration data is variable. It is based on the
amount of logic available in the FPGA, and the number of pre-initialized Embedded Block RAM (EBR) components.
A MachXO3L/LF design using the largest device, with every EBR pre-initialized with unique data values, and gen-
erated without compression turned on requires the largest amount of storage.

The Configuration Memory is, for most designs, large enough to store the compressed configuration data that is
loaded into the SRAM configuration memory. However, as the amount of logic in the design increases, and the
amount of pre-initialized EBR increases, the size of the configuration data also increases. It is possible, but unlikely,
that the configuration data can get too large for the internal memory.

MachXO3LF Only; Storing configuration data in the MachXO3LF's internal Flash memory has special consider-
ations. The Flash memory in the MachXO3LF provides three independent sectors. The first sector is dedicated for
use in holding compressed configuration data, and is called Configuration Flash. The second sector, called the
User Flash Memory, provides three different functions. It provides additional Configuration Flash storage for large
configuration data images, it can store EBR contents, or it is available for use as general purpose Flash memory.
The third sector is the Feature Row.

Figure 3. Flash Memory Space of a MachXO3LF Device

128 Bits

Row Size = M Configuration Flash

Usercode

Row Size = N UFM

Feature Row

The Configuration Flash is, for most designs, large enough to store the compressed configuration data that is
loaded into the SRAM configuration memory. However, as the amount of logic in the design increases, and the
amount of pre-initialized EBR increases, the size of the configuration data also increases. The increase in size can
cause the configuration data to overflow into the UFM sector. It is also possible, but unlikely, that the configuration
data can get too large for the internal Flash memory altogether. In the event configuration data grows too large to fit
in the combined Configuration Flash/UFM memory space the design needs to be modified so that it is smaller, or
an external configuration memory must be used. You can provide input to the software generating the configuration
data to prevent the overflow into the UFM.

In the event the configuration data is too large for the internal memory you can store the device bitstream in an
external SPI Flash. Table 2 shows the maximum uncompressed bitstream sizes allowing you to select an SPI
Flash.

7
MachXO3 Programming and Configuration Usage Guide

Table 2. Maximum Configuration Bits


Uncompressed Uncompressed
Maximum
Device Bitstream Size Bitstream Size Units
Internal NVCM/Flash
Without EBR With EBR
MachXO3L/LF-640E 121 Ball Package 0.35 0.41 0.33 Mb
MachXO3L/LF-1300C 256 Ball Package 0.51 0.58 0.47 Mb
MachXO3L/LF-1300E 0.35 0.41 0.33 Mb
MachXO3L/LF-1300E 256 Ball Package 0.51 0.58 0.47 Mb
MachXO3L/LF-2100C 0.51 0.58 0.47 Mb
MachXO3L/LF-2100C 324 Ball Package 0.93 1.02 0.80 Mb
MachXO3L/LF-2100E 0.51 0.58 0.47 Mb
MachXO3L/LF-2100E 324 Ball Package 0.93 1.02 0.80 Mb
MachXO3L/LF-4300C 0.93 1.02 0.80 Mb
MachXO3L/LF-4300C 400 Ball Package 1.47 1.70 1.38 Mb
MachXO3L/LF-4300E 0.93 1.02 0.80 Mb
MachXO3L/LF-6900C 1.47 1.70 1.38 Mb
MachXO3L/LF-6900E 1.47 1.70 1.38 Mb
MachXO3L/LF-9400C 2.11 2.56 2.0 Mb
MachXO3L/LF-9400E 2.11 2.56 2.0 Mb

Feature Row
The MachXO3L/LF includes a Feature Row that is used to control FPGA resources. The Feature Row permits
more flexibility in selecting the functions available for configuration, increases the number of available I/O on the
device, and eliminates the need to make changes to your hardware. Feature Row can be erased or programmed
independently.

MachXO3L/LF Feature Row is used to determine how the MachXO3L/LF SRAM configuration memory is loaded.
In the MachXO3L, it can be programmed nine times. When Feature Row is erased, Feature Row sets its value back
to HW default Mode state. Feature Row can be modified using Programming File Utility under Tools > Feature
Row Editor.

Figure 4. Feature Row Example

8
MachXO3 Programming and Configuration Usage Guide

A relationship of Feature Row option and Diamond Spreadsheet View is shown in Table 3 and Table 4.

Table 3. Feature Row Option and Diamond Spreadsheet View

BOOT_SEL[2:1],
MASTER_SPI_PORT CONFIGURATION MSPI_Persistent_Enable
ENABLE CFG1 101
ENABLE EXTERNAL 011
1
EFB_USER CFG 000
DISABLE CFG1 000
1. “CFG” includes CFG or CFG_EBR.

A full list of the functions controlled by the Feature Row and their default values for MachXO3L are shown in
Table 4.

Table 4. MachXO3L Feature Row Elements


SW Default Mode State
Feature (Programmed) HW Default Mode State (Erased)
PROGRAMN Persistence Disabled Enabled
INITn Persistence Disabled Disabled
DONE Persistence Disabled Disabled
Custom IDCODE 0x00000000 0x00000000
TraceID™ 00000000 00000000
1
Security OFF OFF
JTAG Port Persistence Enabled Enabled
SSPI Port Persistence Enabled Enabled
I2C Port Persistence Disabled Enabled
MSPI Port Persistence Disabled Disabled
I2C Programmable Primary Configuration Address2, 3 yyyxxxxx00 1111000000
SRAM OTP OFF OFF
Config NVCM/Flash OTP OFF OFF
my_ASSP Enable OFF OFF
Password Enable Flash OFF OFF
Password Enable All OFF OFF
1. Enabled/disabled using the CONFIG_SECURE preference.
2. "y" and "x" are user programmable from IPexpressTM.
3. 1111000001 is a reserved address when the device is erased.

It is strongly recommended that the Feature Row only be modified during development, and rarely, if ever,
upgraded in the field. The reason for this recommendation is the Feature Row is responsible for controlling the
availability of the Configuration Ports. It is possible to cause active Configuration Ports to become unavailable, pre-
venting future updates.

Changing the Feature Row can also prevent the MachXO3L/LF from configuring. The PROGRAMN, INITN, and
DONE control and status pins are enabled and disabled using the Feature Row. The PROGRAMN input pin may be
recovered for use as a general purpose I/O. Erasing Feature Row state causes the PROGRAMN input to act as
PROGRAMN, not as a general purpose I/O. If the general purpose I/O is driven active low the MachXO3L will never
be allowed to complete its configuration process.

Feature Row can be erased or altered by Diamond Programmer under Advanced Security Keys Programming.
Feature Row settings can be altered using the Diamond Spreadsheet View. Spreadsheet View allows you to edit

9
MachXO3 Programming and Configuration Usage Guide

the configuration settings for the MachXO3L/LF, and then saves your settings in the Lattice Preference File (LPF).
These settings are applied to the MachXO3L/LF configuration data during the Map, Place, and Route build phases.

Key Features
• Not intended to be modified in the field; only for development.
• Change in Feature Row settings may cause active configuration ports to become unavailable.
• Can be altered using Diamond Programmer or Diamond Spreadsheet View.
• Can be altered independently under Advanced Security Keys Programming in Programmer.
• Will be erased and re-programmed during On-Chip Memory updates. So keep Feature Row contents consistent.
• MachXO3 only can be altered a total of eight times.

sysCONFIG™ Ports
Table 5. MachXO3L/LF Programming and Configuration Ports
Interface Port Description
JTAG JTAG (IEEE 1149.1 and IEEE 1532 compliant) 4-wire or 5-wire JTAG Interface
SSPI Slave Serial Peripheral Interface (SPI)
sysCONFIG MSPI Master Serial Peripheral Interface (SPI)
I2C Inter-integrated Circuit (I2C) Interface
Internal WISHBONE Internal WISHBONE bus interface

sysCONFIG Pins
The MachXO3L/LF provides a set of sysCONFIG I/O pins that you use to program and configure the FPGA. The
sysCONFIG pins are grouped together to create ports (i.e. JTAG, SSPI, I2C, MSPI) that are used to interact with
the FPGA for programming, configuration, and access of resources inside the FPGA. The sysCONFIG pins in a
configuration port group may be active, and used for programming the FPGA, or they can be reconfigured to act as
general purpose I/O.

Recovering the configuration port pins for use as general purpose I/O requires you to adhere to the following guide-
lines:

• You must DISABLE the unused port. You can accomplish this by using the Diamond Spreadsheet View’s Global
Preferences tab. Each configuration port is listed in the sysCONFIG options tree.
• You must prevent external logic from interfering with device programming. Make sure that recovered sysCONFIG
pins are not asserted when the MachXO3L/LF is in Feature Row HW Default Mode state. One example is driving
PROGRAMN with an active low signal after the MachXO3L/LF is in Feature Row HW Default Mode state. Failure
to reprogram the Feature Row with PROGRAMN disabled prevents the FPGA from configuring and entering user
mode.
• Use care when using JTAGENB to selectively enable and disable the JTAG port. Any external logic connected to
the JTAG I/O must not contend with the JTAG programming port.

Table 6 lists the default state of the shared sysCONFIG pins. As you can see, an HW Default Mode Feature Row
device has the JTAG, SPI Slave and I2C ports enabled. Upon entry to User Mode the MachXO3L, the default state
of the SSPI, and I2C sysCONFIG pins become general purpose I/O. This means you lose the ability to program the
MachXO3L using I2C when using the default sysCONFIG port settings. To retain the I2C sysCONFIG pins in user
mode, be sure to ENABLE them using the Diamond Spreadsheet View editor.

Unless specified otherwise, the sysCONFIG pins are powered by the VCCIO0 voltage. It is crucial you take this into
consideration when provisioning other logic attached to Bank 0.

The function of each sysCONFIG pin is described in detail.

10
MachXO3 Programming and Configuration Usage Guide

Table 6. Default State of the sysCONFIG Pins


Pin Function in Default Function
Associated Feature Row Erased Mode Pin Direction in User Mode
Pin Name sysCONFIG Port (Configuration/HW Mode) (Configuration Mode) (SW default Mode)
PROGRAMN SDM PROGRAMN Input with weak pull up User-defined I/O
INITN SDM I/O I/O with weak pull up User-defined I/O
DONE SDM I/O I/O with weak pull up User-defined I/O
MCLK/CCLK SSPI/MSPI SSPI Input with weak pull up SSPI
SN SSPI/MSPI SSPI Input with weak pull up SSPI
SI/SISPI SSPI/MSPI SSPI Input SSPI
SO/SPISO SSPI/MSPI SSPI Output SSPI
CSSPIN MSPI I/O I/O with weak pull up User-defined I/O
SCL I2C I2C Bi-Directional User-defined I/O
2 2
SDA IC IC Bi-Directional User-defined I/O

Table 7. Default State in Diamond for Each Port


sysConfig Port Diamond Default 1
SDM_PORT Disable
SLAVE_SPI_PORT Enable
I2C_PORT Disable
MASTER_SPI_PORT Disable
JTAG_PORT Enable
1. This Default setting can be modified in the Diamond Spreadsheet View, Global Preferences tab.

Self Download Port Pins


PROGRAMN: The PROGRAMN is an input used to configure the FPGA. The PROGRAMN pin, when enabled, is
sensitive to a high-to-low transition, and has an internal weak pull-up. When PROGRAMN is asserted low, the
FPGA exits user mode and starts a device configuration sequence at the Initialization phase, as described earlier.
Holding the PROGRAMN pin low prevents the MachXO3L from leaving the Initialization phase. The PROGRAMN
has a minimum pulse width assertion period in order for it to be recognized by the FPGA. You can find this mini-
mum time in DS1047, MachXO3 Family Data Sheet in the AC timing section.

Be aware of the following special cases when the PROGRAMN pin is active:

• If the device is currently being programmed via JTAG then PROGRAMN will be ignored until the JTAG mode pro-
gramming sequence is complete.
• Toggling the PROGRAMN pin during device configuration will interrupt the process and restart the configuration
cycle.
• Asserting PROGRAMN on a device in Feature Row HW Default Mode state disables the SSPI and I2C ports.
Start SSPI or I2C programming operations after PROGRAMN is deasserted.

• PROGRAMN is active during power-up, even when PROGRAMN has been reserved as a general purpose I/O.
Do not allow any input signal attached to PROGRAMN to transition from high to low at a frequency greater than
the VCC (min) to INITN rising edge time period. High to low PROGRAMN assertions more frequently prevent the
MachXO3L from configuring, causing the FPGA to remain in a continuous RESET condition. See Figure 5.

11
MachXO3 Programming and Configuration Usage Guide

Figure 5. Period PROGRAMN is Always Observed


PROGRAMN transitions observed

VCC VCC min.

INITN

PROGRAMN

Figure 6. Configuration from PROGRAMN Timing


tPRGMJ

PROGRAMN

t INITL
INITN tDPPINIT

DONE t DPPDONE

INITN: The INITn pin is a bidirectional open-drain control pin. It has the following functions:

• After power is applied, after a PROGRAMN assertion, or a REFRESH command it goes low to indicate the
SRAM configuration memory is being erased. The low time assertion is specified with the tINITL parameter.
• After the tINITL time period has elapsed the INITn pin is deasserted (i.e. is active high) to indicate the MachXO3L
is ready for its configuration bits. The MachXO3L/LF begins loading configuration data from either the internal
NVCM/Flash or an external SPI Flash.
• INITn can be asserted low by an external agent before the tINITL time period has elapsed in order to prevent the
FPGA from reading configuration bits. This is useful when there are multiple programmable devices chained
together. The programmable device with the longest tINITL time can hold all other devices in the chain from start-
ing to get data until it is ready itself.
• The last function provided by INITn is to signal an error during the time configuration data is being read. Once
tINITL has elapsed and the INITn pin has gone high, any subsequent INITn assertion signals the MachXO3L/LF
has detected an error during configuration.

The following conditions will cause INITN to become active, indicating the Initialization state is active:

• Power has just been applied


• PROGRAMN falling edge occurred
• The IEEE 1532 REFRESH command has been sent using a slave configuration port (JTAG, SSPI or I2C).

If the INITN pin is asserted due to an error condition, the error can be cleared by correcting the configuration bit-
stream and forcing the FPGA into the Initialization state.

12
MachXO3 Programming and Configuration Usage Guide

Figure 7. Configuration Error Notification


Configuration
Started

PROGRAMN
t INITL Configuration
Error
INITN

DONE

The INITN pin of a MachXO3L device is not visible external to the device when in the Feature Row HW Default
Mode state. The INITN pin, when in this mode, is pulled high by default. The INITN behavior described in Figure 7
is only visible outside the MachXO3L when the INITN pin is enabled.

The INITN can be recovered as a general purpose I/O. By default, the INITN pin is disabled. You can use the Dia-
mond Spreadsheet View to enable it.

If an error is detected when reading the bitstream, INITN will go low, the internal DONE bit will not be set, the
DONE pin will stay low, and the device will not wake up. The device will fail configuration when the following hap-
pens:

• The bitstream CRC error is detected


• The invalid command error detected
• A time out error is encountered when loading from the on-chip NVCM/Flash
• The program done command is not received when the end of on-chip SRAM configuration or on-chip
NVCM/Flash memory is reached

DONE: The DONE pin is a bi-directional open drain with a weak pull-up that signals the FPGA is in User mode.
DONE is first able to indicate entry into User mode only after an internal DONE bit is asserted. The internal DONE
bit defines the beginning of the FPGA Wake-Up state.

The DONE output pin is controlled by the SDM_PORT configuration parameter that is modified in the Diamond
Spreadsheet View. By default the DONE pin is a general purpose I/O when the MachXO3L is in the Feature Row
HW Default Mode state. The default mode causes the MachXO3L to automatically sequence through the Wake-Up
sequence after the internal DONE bit is asserted. The FPGA does not stall waking up waiting for the DONE pin to
be asserted high.

The FPGA can be held from entering User mode indefinitely by having an external agent keep the DONE pin
asserted low. In order to use DONE to stall entering User mode the SDM_PORT must enable the DONE I/O, and
the FPGA Feature Row must be programmed. (This feature is supported in Diamond 3.5 and later. Earlier versions
of Diamond do not enable the stall feature when SDM_PORT enables DONE I/O). A common reason for keeping
DONE driven low is to allow multiple FPGAs to be completely configured. As each FPGA reaches the DONE state,
it is ready to begin operation. The last FPGA to configure can cause all FPGAs to start in unison.

The DONE pin drives low in tandem with the INITN pin when the FPGA enters Initialization mode. As described
earlier, this condition happens when power is applied, PROGRAMN is asserted, or an IEEE 1532 Refresh com-
mand is received via an active configuration port.

Sampling the DONE pin is a way for an external device to tell if the FPGA has finished configuration. However,
when using IEEE 1532 JTAG to configure SRAM the DONE pin is driven by a boundary scan cell, so the state of
the DONE pin has no meaning during IEEE 1532 JTAG configuration (once configuration is complete, DONE takes
on the behavior defined by the SDM_PORT setting in the Feature Row). The DONE pin is also pulled high when
the FPGA is in the Feature Row HW Default Mode state. This behavior can make a part appear to be successfully
configured to other logic monitoring the DONE pin.

13
MachXO3 Programming and Configuration Usage Guide

Master and Slave SPI Configuration Port Pins

Table 8. Master SPI Configuration Port Pins


Pin Name Function Direction Description
Master clock used to time data transmission/reception from the
MachXO3L Configuration Logic to a slave SPI PROM. A 1K pull-
MCLK/CCLK MCLK Output with weak pullup
up resistor is recommended on MCLK for External and Dual Boot
configuration modes.
Chip select used to enable an external SPI PROM containing con-
CSSPIN CSSPIN Output
figuration data
SISPI carries output data from the MachXO3L Configuration
SI/SISPI SISPI Output
Logic to the slave SPI PROM
SPISO carries output data from the slave SPI PROM to the
SO/SPISO SPISO Input
MachXO3L Configuration Logic
MachXO3L Configuration Logic slave SPI chip select input. Pull
SN SN/IO Input
high externally whenever the MSPI port is active.

Table 9. Slave SPI Configuration Port Pins


Pin name Function Direction Description
Clock used to time data transmission/reception from an external
MCLK/CCLK CCLK Input with weak pullup
SPI master device to the MachXO3L Configuration Logic.
SI carries output data from the external SPI master to the
SI/SISPI SI Input
MachXO3L Configuration Logic
SO carries output data from the MachXO3L Configuration Logic
SO/SPISO SO Output
to the external SPI master
MachXO3L Configuration Logic slave SPI chip select input. SN is
SN SN Input with weak pullup
an active low input.

MCLK/CCLK: The MCLK/CCLK, when active, are clocks used to sequentially load the configuration data for the
FPGA. The pin functions as:

The MCLK/CCLK pin’s default state for a MachXO3L in the Feature Row HW Default Mode state is to act as the
configuration clock (i.e., CCLK). This allows an external SPI master controller to program the MachXO3L/LF. The
maximum CCLK frequency and the data setup/hold parameters can be found in the AC timing section of DS1047,
MachXO3 Family Data Sheet. The Feature Row must be configured to ENABLE the Slave SPI Port if you want to
use the port to reprogram the MachXO3L/LF after it enters user mode.

The MCLK/CCLK pin functions as a Master Clock (MCLK) when the MachXO3L/LF is configured in Dual Boot or
External Boot modes. A 1K pull-up resistor is recommended when using these modes. The MCLK becomes an
output and provides a reference clock for an SPI Flash attached to the MachXO3L/LF’s Master SPI Configuration
port. MCLK actively drives until all of the configuration data has been received. When the MachXO3L enters user
mode the MCLK output tri-states. This allows the MCLK to become a general purpose I/O. The MCLK is reserved
for use, in most post-configuration applications, as the reference clock for performing memory transactions with the
external SPI PROM.

The MachXO3L/LF generates MCLK from an internal oscillator. The initial frequency of the MCLK is nominally 2.08
MHz. The MCLK frequency can be altered using the MCCLK_FREQ parameter. You can select the MCCLK_FREQ
using the Diamond Spreadsheet View. For a complete list of the supported MCLK frequencies, see Table 10.

14
MachXO3 Programming and Configuration Usage Guide

Table 10. MachXO3L/LF MCLK Valid Frequencies (MHz)


2.08 9.17 33.25
2.46 10.23 38.00
3.17 13.30 44.33
4.29 14.78 53.20
5.54 20.46 66.50
7.00 26.60 88.67
8.31 29.56 133.00

During the initial stages of device configuration the frequency value specified using MCCLK_FREQ is loaded into
the FPGA. Once the MachXO3L/LF accepts the new MCLK_FREQ value the MCLK output begins driving the
selected frequency. Make certain when selecting the MCLK_FREQ that you do not exceed the frequency specifica-
tion of your configuration memory, or of your PCB. Review the MachXO3L AC specifications in DS1047, MachXO3
Family Data Sheet when making MCLK_FREQ decisions.

SN: The SN pin is the Slave SPI ports chip select. An external SPI bus master asserts the SN pin active low in
order to perform actions using the MachXO3L’s programming and configuration logic. The SN pin is available when
the MachXO3L is in the Feature Row HW Default Mode state, and in user mode when the Slave SPI port is set to
the ENABLE setting. The SN pin is a general purpose I/O in user mode when the Slave SPI port is set to the DIS-
ABLE setting.

Proper operation of the MachXO3L/LF depends upon maintaining the SN pin in the correct state:

• SN must be deasserted (i.e. held high) when configuring using Master SPI mode
• SN must be deasserted when the MachXO3L/LF is in user mode
• SN must be deasserted when accessing the Configuration Logic in the MachXO3L/LF using I2C
• When SN is asserted, CSSPIN must be deasserted. Deasserting CSSPIN places the shared SPI pins into a high
impedance state.
— The Master SPI port and the Slave SPI port share three common pins, SI/SISPI, SO/SPISO, and
MCLK/CCLK. The MachXO3L/LF permits both ports to be available at the same time. They are not permit-
ted to be accessed at the same time. The Slave SPI and the Master SPI port must be time multiplexed when
both ports are enabled.
Lattice recommends the SN pin be pulled high externally to augment the weak internal pull-up.

CSSPIN: The CSSPIN pin is an active low chip select used by the Master SPI configuration mode to enable an
external SPI Flash. When the MachXO3L/LF is programmed to configure in either External or Dual Boot mode the
CSSPIN pin is asserted to the attached SPI Flash. The MachXO3L/LF asserts CSSPIN until all configuration data
bytes have been loaded, at which time the CSSPIN enters a high impedance state.

When the MachXO3L/LF is in the Feature Row HW Default Mode state the CSSPIN is a general purpose I/O with a
weak pulldown. It must have an external pullup resistor when the External and Dual Boot configuration modes are
used. CSSPIN must ramp in tandem with the SPI PROM VCC input. It remains a general purpose I/O when the
FPGA enters user mode. You must ENABLE the Master SPI port to reserve CSSPIN for use by the internal SPI
Master logic.

When configuring from an external SPI Flash, ensure that the SPI Flash VCC and the MachXO3L/LF VCCIO2 are at
the same level. Ensure that the SPI Flash VCC is at the recommended operating level.

Some SPI PROM manufacturers require the chip select input of the PROM ramp in unison to the PROMs VCC rail.
The CSSPIN pin, by default, has a weak pull-down resistor internally. Adding a 4.7 kOhm to 10 kOhm pull-up resis-
tor to the CSSPIN pin on the MachXO3L is recommended.

15
MachXO3 Programming and Configuration Usage Guide

SI/SISPI: The SI/SISPI is a dual function bi-directional pin. The direction depends upon whether a Master or Slave
mode is active. The SI/SISPI is an input data pin when using the Slave SPI mode and is an output data pin when
using the Master SPI mode. In Master SPI mode, the MachXO3L/LF drives SI/SISPI until all configuration data
bytes have been loaded, at which time the SI/SISPI enters a high impedance state.

At least one of the sysCONFIG preferences, SLAVE_SPI_PORT or MASTER_SPI_PORT, must be set to ENABLE
in order to preserve this pin as SI/SISPI and allow access to the SPI interface.

SO/SPISO: The SO/SPISO pin is a dual function bi-directional pin. The direction depends upon whether a Master
or Slave mode is active. The SO/SPISO is an input data pin when using the Master SPI mode and is an output data
pin when using the Slave SPI mode.

At least one of the sysCONFIG preferences, SLAVE_SPI_PORT or MASTER_SPI_PORT, must be set to ENABLE
in order to preserve this pin as SO/SPISO and allow access to the SPI interface.

I2C Configuration Port Pins


SCL: The MachXO3L provides an I2C configuration port. The SCL is the I2C Serial Clock pin, and is used to initiate
and time transactions on the I2C bus. It is a bi-directional, open-drain signal that is an output when the MachXO3L
I2C controller is mastering transactions on the bus, and is an input when an external I2C master is accessing
resources inside the MachXO3L/LF. SCL requires an external pull-up resistor in order to operate.

The SCL pin is available when the MachXO3L/LF is in the Feature Row HW Default Mode state. You must ENABLE
the I2C_PORT and instantiate the EFB for the I2C port to continue to be available in user mode (see the I2C Con-
figuration Mode section for details). The SCL pin becomes a general purpose I/O if you do not ENABLE the
I2C_PORT.

SDA: The SDA pin is the I2C serial data input/output pin. It is bi-directional, open-drain, and requires an external
pull-up resistor in order to operate. The pin changes direction dynamically during data transactions on the I2C bus.
The current state depends on the current bus master and the operation being performed by that master.

The SDA pin is available when the MachXO3L/LF is in the Feature Row HW Default Mode state. You must ENABLE
the I2C_PORT and instantiate the EFB if you want the I2C port to continue to be available in user mode (see the
I2C Configuration Mode section for details). The SDA pin becomes a general purpose I/O if you do not ENABLE
the I2C_PORT.

JTAG Configuration Port Pins


The JTAG pins provide a standard IEEE 1149.1 Test Access Port (TAP). The JTAG port is the only configuration
port on the MachXO3L that is capable of performing configuration, programming, and multi-device configuration
functions. Programming and configuration over the JTAG port uses IEEE 1532 compliant commands. In addition to
the IEEE 1532 capabilities, the MachXO3L/LF provides all of the mandatory IEEE 1149.1 Test Access Port com-
mands allowing printed circuit board assembly verification.

The JTAG port is enabled by default when the MachXO3L/LF is in the Feature Row HW Default Mode state. Like all
of the other configuration port pins the JTAG pins can become general purpose I/O. Unlike the other ports, the
default state for the JTAG port is to remain active in user mode (i.e. ENABLE state). The JTAG pins can be recov-
ered to be general purpose I/O by setting the JTAG_PORT preference to the DISABLE state. It is recommended
the JTAG port remain dedicated programming pins.

The JTAG port, when set in the DISABLE state, enables the JTAGENB input. JTAGENB permits the JTAG pins to
be multiplexed. Asserting JTAGENB high causes the JTAG pins to take on the IEEE 1149.1 personality. De-assert-
ing JTAGENB (i.e. driven low) causes the JTAG port pins to become general purpose I/O. Design the JTAG port cir-
cuitry carefully when taking advantage of JTAG port pin multiplexing. Avoid bus contention between logic attached
to the JTAG port.

16
MachXO3 Programming and Configuration Usage Guide

When the device is programmed through IEEE 1149.1 control, the sysCONFIG programming pins, such as DONE,
cannot be used to determine programming progress. This is because the state of the boundary scan cell will drive
the pin, per the IEEE JTAG standard, rather than normal internal logic.

Table 11. JTAG Port Pins


Pin Function Pin Direction Default Function
Pin Name (Configuration Mode) (Configuration Mode) (User Mode)
TDI TDI Input with weak pull-up TDI
TDO TDO Output with weak pull-up TDO
TCK TCK Input TCK
TMS TMS Input with weak pull-up TMS
JTAGENB I/O Input/output with weak pull-down I/O

TDO: The Test Data Output (TDO) pin is used to shift out serial test instructions and data. When TDO is not being
driven by the internal circuitry, the pin will be in a high impedance state. The only time TDO is not in a high imped-
ance state is when the JTAG state machine is in the Shift IR or Shift DR state. This pin should be wired to TDO of
the JTAG connector, or to TDI of a downstream device in a JTAG chain. An internal pull-up resistor on the TDO pin
is provided. The internal resistor is pulled up to VCCIO Bank 0.

TDI: The Test Data Input (TDI) pin is used to shift in serial test instructions and data. This pin should be wired to
TDI of the JTAG connector, or to TDO of an upstream device in a JTAG chain. An internal pull-up resistor on the
TDI pin is provided. The internal resistor is pulled up to VCCIO of Bank 0.

TMS: The Test Mode Select (TMS) pin is an input pin that controls the progression through the 1149.1 compliant
state machine states. The TMS pin is sampled on the rising edge of TCK. The JTAG state machine remains in or
transitions to a new TAP state depending on the current state of the TAP, and the present state of the TMS input. An
internal pull-up resistor is present on TMS per the JTAG specification. The internal resistor is pulled to the VCCIO
of Bank 0.

TCK: The test clock pin (TCK) provides the clock used to time the other JTAG port pins. Data is shifted into the
instruction or data registers on the rising edge of TCK and shifted out on the falling edge of TCK. The TAP is a
static design permitting TCK to be stopped in either the high or low state. The maximum input frequency for TCK is
specified in the DC and Switching Characteristics section of DS1047, MachXO3 Family Data Sheet. The TCK pin
does not have a pull-up. An external pull-down resistor of 4.7 kOhms is recommended to avoid inadvertently clock-
ing the TAP controller as power is applied to the MachXO3L/LF.

JTAGENB: The JTAG ENABLE pin, also known as the IEEE 1149.1 conformance pin, is an input pin that can be
used to multiplex the JTAG port. The JTAGENB pin is only active in user mode. The JTAGENB pin is a user I/O
while the JTAG port is in the ENABLE state. Figure 8 shows the default behavior of the JTAG port of a MachXO3L
device.

Figure 8. Default JTAG Port with JTAG_PORT = ENABLE

MachXO3L

TCK TCK/IO
TMS TMS/IO
TDI TDI/IO
TDO TDO/IO

17
MachXO3 Programming and Configuration Usage Guide

The JTAG port can become general purpose I/O. By setting the JTAG_PORT preference in the Diamond Spread-
sheet View to the DISABLE state. When the JTAG port is in the DISABLE state the JTAGENB pin becomes a dedi-
cated input. Driving the JTAGENB low disables the JTAG port and the four JTAG pins become general purpose
I/Os. Driving the JTAGENB input high enables the JTAG port. Figure 9 shows JTAG port behavior under the control
of the JTAGENB.

Figure 9. JTAG Port Behavior with JTAG_PORT = DISABLE

MachXO3L MachXO3L
VCCIO

JTAGENB = ‘1’

JTAGENB = ‘0’ IO/JTAGENB


IO/JTAGENB
I/O TCK/IO TCK TCK/IO

I/O TMS/IO TM TMS/IO


TDI/IO TDIS TDI/IO
I/O
GND TDO/IO TDO/IO
I/O TDO

It is critical when using the JTAGENB feature that logic attached to the JTAG I/O pins not contend with a JTAG pro-
gramming system. The external logic must ignore any JTAG transactions performed by an external programming
system.

Lattice parallel port or USB download cables provide an output called ispEN. The ispEN signal can be attached to the
JTAGENB input to control the availability of the JTAG port. An alternate mechanism to control the JTAGENB input is to
use a shunt that can be installed or removed as required.

Configuration Modes
The MachXO3L provides multiple options for loading the configuration SRAM from a non-volatile memory. The pre-
vious section described the physical interface necessary to interact with the MachXO3L configuration logic. This
section focuses on describing the functionality of each of the different configuration modes. Descriptions of impor-
tant settings required in the Diamond Spreadsheet View are also discussed.

SDM Mode
The advantages of Self Download Configuration Mode include:
• Speed: The MachXO3L is ready to run in a few milliseconds depending on the density of the device.
• Security: The configuration data is never seen outside the device during the load to SRAM. You can prevent the
internal memory from being read.
• Reduced cost: There is no need to purchase a PROM specifically reserved for programming the MachXO3L.
• Reduced board space: Elimination of an external PROM allows your board to be smaller.
The MachXO3L/LF retrieves the configuration data from the internal NVCM/Flash when it is using Self Download
Mode. SDM is triggered when power is applied, a REFRESH command is received, or by asserting the PRO-
GRAMN pin. Self Download Mode cannot be used when the Configuration Memory overflow occurs. Master SPI
Configuration Mode must be used in the event of the Memory overflow.

Master SPI Configuration Mode (MSPI)


Master SPI Configuration Mode is the only other self-controlled configuration mode available to the MachXO3L/LF.
When the MachXO3L/LF has the Master SPI Configuration mode (MSPI) enabled it is able to automatically retrieve
the configuration data from an externally attached SPI Flash. The MSPI configuration port is not available when the
MachXO3L/LF is in the Feature Row HW Default Mode state. Lattice recommends having a secondary configura-
tion port available, one that is active when the MachXO3L/LF is in Feature Row HW Default Mode state, that allows
you to recover the MachXO3L/LF in the event of a programming error.

18
MachXO3 Programming and Configuration Usage Guide

To ensure that the MachXO3L/LF operates correctly using the MSPI configuration mode, make sure that:
• The POR of the SPI Flash device is lower than the POR of the MachXO3L/LF or the SPI Flash must be powered
first.
• SPI Flash Fmax is greater than the MachXO3L/LF MCLK Fmax
• Board routing requirements to ensure the MachXO3L/LF setup and hold time parameters are met. 
Refer to DS1047, MachXO3 Family Data Sheet for detailed setup and hold time information.

If the SPI Flash POR is higher than the MachXO3L/LF POR and has a slow ramp, here is what happens:

1. MachXO3L/LF powers up.


2. MachXO3L/LF begins toggling MCLK.
3. The preamble from the SPI Flash does not return because its POR level is not met.
4. MachXO3L/LF times out because it fails to get the preamble in time and the boot up likewise fails.

It is highly recommended that an SPI Flash be chosen which POR level is lower than the MachXO3L/LF POR. If
one is not available here are some workaround solutions:

• Processor to hold INITN


• Processor to hold PROGRAMN
• RC delay to INITN

Figure 10. RC Delay


VCCIO

INITN

Table 12. Master SPI Port Pins

Pin Name Function


Clock output from the MachXO3L Configuration Logic and Master SPI controller. Con-
MCLK
nect MCLK to the SCLK input of the Slave SPI device.
SISPI Serial Data output from the MachXO3L to the slave SPI SI input.
SPISO Serial Data input to the MachXO3L configuration logic from the slave SPI SO output.
Chip select output from the MachXO3L configuration logic to the slave SPI Flash holding
CSSPIN
configuration data for the MachXO3L.

Table 2 provides information about the amount of memory needed for MachXO3L/LF configuration data by device
density. Select an SPI Flash that accepts 03 hex Read Opcodes. The MachXO3L/LF is only able to use the 03 hex
Read Opcode.

19
MachXO3 Programming and Configuration Usage Guide

Figure 11. Master SPI Configuration Mode


MachXO3

4
JTAG SRAM

MCLK
SPISO
SISPI SPI Configuration
Controller
CSSPIN Logic
SPI PROM
C

D
MachXO3L
Logic
/CS

The MachXO3L/LF begins retrieving configuration data from the SPI Flash when power is applied, a REFRESH
command is received, or the PROGRAMN pin is asserted and released. The MCLK/CCLK I/O takes on the Master
Clock (MCLK) function, and begins driving a nominal 2.08 MHz clock to the SPI Flash’s SCLK input. CSSPIN is
asserted low, commands are transmitted to the PROM over the SI/SISPI output, and data is read from the PROM
on the SO/SPISO input pin. When all of the configuration data is retrieved from the PROM the CSSPIN pin is deas-
serted, and the MSPI output pins are tri-stated.

The MCLK frequency always starts downloading the configuration data at the nominal 2.08 MHz frequency. The
MCCLK_FREQ parameter, accessed using Spreadsheet View, can be used to increase the configuration fre-
quency. The configuration data in the PROM has some padding bits, and then the data altering the MCLK base fre-
quency is read. The MachXO3L reads the remaining configuration data bytes using the new MCLK frequency.

After the MachXO3L/LF enters user mode the Master SPI configuration port pins tri-state. This allows data trans-
fers across the SPI. There are two primary methods available for transferring data across the SPI bus. The first
method available to you is to enable the Embedded Function Block (EFB) in the MachXO3L/LF. Using IPexpress™
you instantiate the EFB, and you choose the features you want active. One of the features available in the EFB is
an SPI Master Controller. The SPI Master Controller in the EFB attaches directly Master SPI configuration port
pins. The controller provides a set of status, control, and data registers for initiating SPI bus transactions.

The second way to perform Master SPI configuration port transactions is to master them from the JTAG port. The
MachXO3L/LF includes a JTAG to MSPI passthru circuit that allows the slave SPI Flash to be erased, pro-
grammed, and read. The primary method for programming the attached SPI Flash is to use Diamond Programmer
to transfer a configuration data file from your personal computer. This is useful during board development and
debug. Note: To support JTAG to MSPI passthru programming mode a 1Kohm pull-up resister is required on
MCLK.

Another way to program an SPI Flash using the JTAG port is to use the Lattice ispVME solution. ispVME is C code
written for an embedded microprocessor. The microprocessor reads a data file crafted by the Diamond Deployment
Tool, and runs the ispVME code. The firmware uses port I/O to drive the JTAG port of the MachXO3L/LF, which in
turn passes the data to the Master SPI port. Refer to the ispVME tool suite for information about updating an
attached SPI Flash using a microprocessor.

20
MachXO3 Programming and Configuration Usage Guide

To set the MachXO3L/LF for operation using the MSPI configuration mode you must:

• Store the entire configuration data in an external SPI Flash


• The data must start at offset 0x000000 within the PROM
• Set the preferences as shown in Table 13

Table 13. Master SPI Configuration Software Settings


Preference Setting
MASTER_SPI_PORT ENABLE
CONFIGURATION EXTERNAL

The BIT file must be programmed into the external SPI Flash. There are several ways to get the data into the SPI
Flash:

• Diamond Programmer can transmit the SPI Flash data using a JTAG download cable
• A microprocessor running ispVME
• Automatic Test Equipment can program the SPI Flash using JTAG
• Pre-programmed SPI Flash memories can be pre-assembled onto your printed-circuit board

Once the SPI Flash contains your configuration data, you can test the configuration. Assert the PROGRAMN,
transmit a REFRESH command, or cycle power to the board, and the MachXO3L/LF will configure from the exter-
nal SPI Flash.

Dual Boot Configuration Mode


Dual Boot Configuration Mode is a combination of Self Download Mode and Master SPI Configuration Mode. The
MachXO3L, when set up in Dual Boot Mode, tries by default to configure first from external flash PROM using
MSPI mode. If the configuration fails, the MachXO3L attempts to configure itself from the internal NVCM using
SDM. The preset load order may be reversed if desired. The MachXO3LF, when set up in Dual Boot Mode, tries by
default to configure first from the internal Flash memory using SDM. If the SDM configuration fails, the MachXO3LF
attempts to configure itself using MSPI mode. The preset load order may be reversed if desired using the
DUALBOOTGOLDEN configuration option in the Diamond software spreadsheet view.

Dual Boot Configuration Mode can be utilized in conjunction with the MachXO3LF Soft Error Detection (SED) fea-
ture without restriction. However, Soft Error Correction (SEC) use is limited to the primary image only. Refer to
TN1292, MachXO3 Soft Error Detection/Correction Usage Guide for more information on the use of the SED and
SEC features.

The first boot attempt is from the primary configuration image. If the primary configuration fails, the second boot
attempt is from the golden/failsafe configuration image. The primary image can fail in one of two ways:

• A bitstream CRC error is detected


• A time-out error is encountered when loading

A CRC error is caused by incorrect or corrupt data. Data is read from the primary image in rows. As each row
enters the Configuration Engine the data is checked for CRC consistency. Before the data enters the Configuration
SRAM the CRC must be correct. Any incorrect CRC causes the device to erase the Configuration SRAM and
retrieve configuration data from the golden/failsafe image location.

It is possible for the data to be correct from a CRC calculation perspective, but not be functionally correct. In this
instance the internal DONE bit will never become active. The MachXO3L/LF counts the number of master clock
pulses it has provided after the Power On Reset signal was released. When the count expires without DONE
becoming active the FPGA attempts to get it's configuration data from the golden/failsafe image location.

21
MachXO3 Programming and Configuration Usage Guide

Dual boot configuration mode typically requires two configuration data files. One of the two configuration data files
is a fail-safe image that is rarely, if ever, updated. The second configuration data file is a working image that is rou-
tinely updated. For MachXO3L, the failsafe image is stored in internal NVCM memory while the primary working
image is stored in the external SPI memory. It is the opposite for MachXO3LF: The failsafe image is stored in the
external SPI memory while the primary working image is stored in internal flash memory. One Diamond project can
be used to create both the working and the fail-safe configuration data files. Configure the Diamond project with an
implementation named working, and an implementation named failsafe. Read the Diamond Online Help for more
information about using Diamond implementations.

Use the following preferences to build a dual-boot design:

Preference Dual-Boot Setting


CONFIGURATION CFG
MASTER_SPI_PORT ENABLE
DUALBOOTGOLDEN INTERNAL/EXTERNAL
COMPRESS_CONFIG ON | OFF

In the Diamond flow, JEDEC file option should be selected when generating configuration data that is stored in the
internal NVCM/Flash. The bitstream file option should be selected when generating configuration data that is
stored in the external SPI flash. For dual boot applications, the configuration data must be located in the external
SPI Flash starting at address 0x010000. This differs from a single image Master SPI Configuration Mode, which
requires the configuration data to be stored at offset 0x000000.

To prevent the MachXO3L/LF from using dual boot mode when using the User Master SPI controller, set the
MASTER_SPI_PORT preference to EFB_USER. This reserves the Master SPI configuration port pins and pre-
vents dual-boot.

Slave SPI Mode (SSPI)


The MachXO3L/LF provides a Slave SPI configuration port that allows you to access features provided by the Con-
figuration Logic. You can reprogram the SRAM, NVCM/Flash and Feature Row, and access status/control registers
within the Configuration Logic block. Reprogramming the NVCM/Flash can be done using offline or transparent
operations.

Table 14. Slave SPI Port Pins

Pin Name Description


CCLK Configuration clock input that is driven by an SPI master controller.
SI Serial Data Input to the MachXO3L/LF Configuration Logic for command and data.
SO Serial Data Output from the MachXO3L/LF configuration logic.
SN Chip select to enable the MachXO3L/LF configuration logic.

In the Slave SPI mode, the MCLK/CCLK pin becomes CCLK (i.e. Configuration clock). Input data is read into the
MachXO3L/LF device on the SI pin at the rising edge of CCLK. Output data is valid on the SO pin at the falling
edge of CCLK. The SN acts as the chip select signal. When SN is high, the SSPI interface is deselected and the
SO/SPISO pin is tri-stated. Commands can be written into and data read from the MachXO3L/LF when SN is
asserted. The MachXO3L/LF SSPI port only accepts Mode 0 bus transactions to the Configuration Logic.

22
MachXO3 Programming and Configuration Usage Guide

Figure 12. Slave SPI Configuration Mode


MachXO3

NVCM/Flash
/SRAM

CCLK
SI
SPI Configuration
SO
SN Controller Logic
μC
CLK
SPI Port

DI

DO MachXO3L
Logic
CSN

The SSPI port is active when the MachXO3L/LF is in Feature Row HW Default Mode state. Diamond’s default pref-
erence for the SLAVE_SPI_PORT is to ENABLE the port. Use the Spreadsheet View to DISABLE the
SLAVE_SPI_PORT preference in your design to keep the SSPI port to be used as general purpose I/O in user
mode. Lattice recommends you keep a secondary programming port active in the event the SSPI port is acciden-
tally disabled.

The SSPI port is used to erase, program, and verify the Configuration Flash, User Flash Memory, and the Feature
Row. It is not capable of directly accessing the configuration SRAM. To prevent unintentional erasure of the Feature
Row, it is recommended the SSPI port be used to perform transparent updates of the Flash memory. The SSPI port
can issue a REFRESH command to make a newly programmed image active. The REFRESH command can be
safely used when the MachXO2 is using External or Dual Boot configuration mode because the REFRESH opera-
tion will not begin until SN is deasserted.

Programming the MachXO3L/LF using the SSPI port is complex. Lattice provides ‘C’ source code called SSPIEM-
bedded to insulate you from the complexity of programming the MachXO3L/LF. It is recommended that SSPIEm-
bedded be used when you want to reprogram the MachXO3L/LF NVCM (MachXO3L)/Flash(MachXO3LF) or
SRAM.

Accessing the status registers is less complex and does not require the use of the SSPIEmbedded code.

I2C Configuration Mode


The MachXO3L/LF has an I2C Configuration port for use in accessing the configuration logic. An I2C master can
communicate to the configuration logic using 10-bit or 7-bit addressing modes. The I2C SCL input can accept a
clock frequency up to 400 kHz. You can reprogram the SRAM, NVCM/Flash and Feature Row, and access sta-
tus/control registers within the configuration logic block. Reprogramming the NVCM/Flash can be done in offline or
in transparent operations.

Table 15. I2C Port Pins

Pin Name Description


SCL I2C bus clock
SDA I2C bus data line

23
MachXO3 Programming and Configuration Usage Guide

The I2C Configuration port is available when the MachXO3L/LF is in Feature Row erased state. The default state
set for the I2C_PORT in the Diamond design software is to place the I2C_PORT in the DISABLE state. You must
make sure the I2C_PORT is set to the ENABLE state to leave the I2C interface active in user mode. Lattice recom-
mends making a second configuration port available (for example, JTAG) in order to recover from erroneously dis-
abling the I2C port.

Figure 13. I2C Configuration Logic


MachXO3

NVCM/Flash
/SRAM

Configuration
Logic

I2 C 2 I2C
Master Interface

MachXO3L
Logic

There are two hardened I2C controllers in a MachXO3L/LF device, a primary and a secondary. The primary control-
ler provides an interface to the MachXO3L/LF Configuration Logic. The primary I2C controller is the only one that
permits access to the Configuration Logic OR can be a User Mode I2C controller. The Secondary I2C controller is
always a User Mode I2C controller.

When the MachXO3L/LF is in Feature Row HW Default Mode state the I2C port is enabled, and you may interact
with the primary I2C controller. Whenever the I2C port is enabled access to the Configuration Logic is possible. It is
necessary to instantiate the Embedded Function Block (EFB) to preserve access to the Configuration Logic in User
Mode. Moreover, when instantiated, the EFB 'wb_clk_i' input must be connected to a valid clock source of at least
7.5x the I2C bus rate (for example, >3.0 MHz when I2C rate = 400 kHz).

An external I2C master accesses the Configuration Logic using address 1000000 (7-bit mode) or 1111000000 (10-
bit mode) unless the EFB I2C base address has been modified. Use IPexpress, not Spreadsheet View, to modify
the address to which the Primary and Secondary I2C controllers respond. It is necessary to instantiate the EFB in
order to change the address. The address is shared by the Primary and Secondary I2C controllers.

Table 16 shows the address decoding used to access the I2C resources in the MachXO3L/LF.

Table 16. Slave Addresses for I2C Ports1


Slave Address I2C Function
yyyxxxxx00 Primary I2C Controller Configuration Logic address. Always responds to 7-bit or 10-bit addresses.
yyyxxxxx01 User Mode Primary I2C Controller address.
yyyxxxxx10 User Mode Secondary I2C Controller address.
yyyxxxxx11 Primary I2C Configuration Logic Reset. Always responds to 7-bit or 10-bit addresses.

The fourth I2C resource in the MachXO3L/LF is located at offset 3. In some instances an I2C memory transaction to
the configuration logic may be interrupted or abandoned. It is possible for a command to be accepted by the config-
uration logic that causes the configuration logic to respond with data. In the event that the I2C memory transaction
is interrupted or abandoned, the configuration logic continues to return the queued data. New incoming I2C com-
mands may be considered padding bytes or may be misinterpreted. Clear this condition by writing any value to off-

24
MachXO3 Programming and Configuration Usage Guide

set 3. The configuration logic command interpreter will reset, any queued data will be flushed, and subsequent I2C
memory transactions to the Configuration Logic will operate correctly.

WISHBONE Configuration Mode (MachXO3LF Only)


The MachXO3LF can access the Configuration Flash, User Flash Memory, and the Feature Row from an internal
WISHBONE bus. To use the WISHBONE bus the Embedded Function Block must be inserted into your design. You
design logic to interface to the EFB and then perform WISHBONE bus transactions to access resources attached
to the configuration logic.

Figure 14. WISHBONE Configuration Mode

Flash
Memory

Configuration
Logic

WISHBONE
Interface

MachXO3LF
Logic

The MachXO3LF must be in user mode in order to access the WISHBONE interface. Accessing and updating the
resources made available by the configuration logic must be done in Transparent mode. Attempting accesses to
the configuration logic in offline mode causes a deadlock because the MachXO3LF leaves user mode.

You can get more detailed information about the MachXO3LF WISHBONE interface by reading TN1293, Using
Hardened Control Functions in MachXO3 Devices.

JTAG Mode
The JTAG port is the most flexible configuration and programming port available on the MachXO3L/LF. The JTAG
provides:

• Offline NVCM/Flash programming


• Transparent Flash memory programming (MachXO3LF)
• Offline SRAM configuration
• Full access to the MachXO3L/LF Configuration Logic
• Device chaining
• IEEE 1149.1 testability
• IEEE 1532 Compliant programming

The JTAG port is available when the MachXO3L/LF is in Feature Row HW Default Mode state. The MachXO3L/LF
JTAG port pins are not dedicated to performing the IEEE 1149.1 TAP function. The JTAG port may be recovered for
use as general purpose I/O or vice versa. See the sysCONFIG Pins section for details.

The MachXO3L/LF JTAG port is a valuable asset due to its flexibility. It provides the best capabilities for system and
device debug. Lattice recommends the JTAG port remain accessible in every MachXO3L/LF design. Advantages
for keeping the JTAG port active include:

25
MachXO3 Programming and Configuration Usage Guide

• Multi-chain Architectures: The JTAG port is the only configuration and programming port that permits the
MachXO3L/LF to be combined in a chain of other programmable logic.
• Reveal Debug: The Lattice Reveal debug tool is an embed-able logic analyzer tool. It allows you to analyze the
logic inside the MachXO3L/LF in the same fashion as an external logic analyzer permits analysis of board level
logic. Reveal access is only available via the MachXO3L/LF JTAG port.
• SRAM Readback: The JTAG port is the only sysCONFIG port able to directly access the MachXO3L/LF’s config-
uration SRAM.
• Boundary Scan Testability: Board level connectivity testing performed using IEEE 1149.1 JTAG is a key capa-
bility for assuring the quality of assembled printed-circuit-boards. Preserving the MachXO3L/LF JTAG port is vital
for boundary scan testability. Lattice provides Boundary Scan Description Language files for the MachXO3L/LF
on the Lattice website.

TransFR Operation
The MachXO3L/LF, like other Lattice FPGAs, provides for the TransFR™ capability. TransFR is described in
TN1087 Minimizing System Interruption During Configuration Using TransFR Technology. The following is an
example of how you can update bitstream in MachXO3L by using the TransFR feature.
Figure 15. Bitstream Update Using TransFR

MachXO3L

sys clock SPI PROM


Configuration
with New
SRAM
Image

Global Reset NVCM with


Golden Image

System Board

The example assumes that you have the golden image stored in NVCM in order to initiate the system, and will then
use SPI PROM as a resource for image updates without disturbing the system. Figure 16 shows the process flow
for performing this task.

26
MachXO3 Programming and Configuration Usage Guide

Figure 16. Example Process Flow

System running
Assume MachXO3L
NVCM has been
programmed and
Program SPI PROM
1 running
with new pattern

Program MachXO3L Feature


Can use
Row to Dual-Boot through
2, 5 Diamond Programmer
JTAG

Halt sys clk 6

Issue TransFR Refresh


instruction through JTAG 3
Global Reset
occurs

Release sys clock 7

System running again


with new image 4
Notes:
1. User can use operations such as “SPI Flash Background Erase, Program, Verify” for this.
2. User can use operations such as “XNVCM Program Feature Rows” for this.
3. User can use operations like “XNVCM TransFR” for this.
4. If new image failed to config MachXO3L, the golden image in NVCM will still config MachXO3L,
so system will still be running with original image.
5. Feature Row only needs to be programmed if changes need to be made, for instance,
disable or enable JTAG, Slave Port. If no changes need to be made, please skip this step.
6. This step is optional.

Caution when using the above process flow:

Since a Global Reset is triggered during device wake-up after Refresh instruction is issued, attention needs to be
given in designing I/O with following conditions:

• Register output pins


• Impact on the system board level when value changes (may shut off the board, for instance)
• Register is set/reset by global reset

For the I/O in the example above, the state of the I/O is not changed during the TransFR refresh, but may change
once the device gets into user mode right after the TransFR refresh. Following are design tips to avoid this:

• For critical I/Os, try not to use global reset


• For critical I/Os, if you have to use global reset, try to use the set/reset option so that when GSR occurs, the state
of the I/O pin will not trigger a system crash.

27
MachXO3 Programming and Configuration Usage Guide

Password
The MachXO3 supports a password-based security access feature also known as Flash Protect Key. The Flash
Protect Key feature provides a method of controlling access to the Configuration and Programming modes of the
device. When enabled, the Configuration and Programming edit mode operations (including Write, Verify and
Erase operations) are allowed only when coupled with a Flash Protect Key which matches that expected by the
device.

The Flash Protect Key feature requires that a device accessing a MachXO3 device through a sysConfig port
(JTAG, SSPI, I2C or WISHBONE) provide a valid digital Password, also known as the Flash Protect Key, to unlock
the device and allow configuration or programming operations to proceed. Without a valid Flash Protect Key, the
user can perform only rudimentary non-configuration operations such as Read Device ID.

The 64-bit Flash Protect Key is stored in the Feature Row. Two additional feature row fuses are specified for
enabling the feature: PWD_Enable and PWD_Enable_all.

You can read more about the Password feature in TN1313, Using Password Security with MachXO3 Devices.

Software Selectable Options


The operation of the MachXO3L/LF configuration logic is managed by options selected in the Diamond design soft-
ware. Other FPGAs provide dedicated I/O pins to select the configuration mode. The MachXO3L/LF uses the non-
volatile Feature Row to select how it will configure. The Feature Row’s default state needs to be modified in almost
every design. You use the Diamond Spreadsheet View to make the changes to the operation of the MachXO3L/LF
Feature Row which alters the operation of the configuration logic.

The configuration logic preferences are accessed using Spreadsheet View. Click on the Global Preferences tab,
and look for the sysCONFIG tree. The sysCONFIG section is shown in Figure 17. The sysCONFIG preferences are
divided into three categories:

• Configuration mode and port related


• Bitstream generation related
• Security related

28
MachXO3 Programming and Configuration Usage Guide

Figure 17. sysCONFIG Preferences in Global Preferences Tab, Diamond Spreadsheet View

Configuration Mode and Port Options


The configuration and port options allow you to decide which configuration ports continue to operate after the
MachXO3L/LF device is in user mode. You can also control the availability of status pins, as well as the speed at
which configuration data is read from an external PROM. The selections made here are saved in the Feature Row
and remain in effect until the Feature Row is erased. The only exception is the MCCLK_FREQ parameter, which is
stored in the configuration data.

The configuration and port options can be used in any combination.

Table 17. Configuration Mode/Port Options


Option Name Default Setting All Settings
JTAG_PORT ENABLE DISABLE, ENABLE
SLAVE_SPI_PORT DISABLE DISABLE, ENABLE
MASTER_SPI_PORT DISABLE DISABLE, ENABLE, EFB_USR
I2C_PORT DISABLE DISABLE, ENABLE
1
SDM_PORT DISABLE DISABLE, PROGRAMN, PROGRAMN_DONE, PROGRAMN_DONE_INITN
MCCLK_FREQ 2.08 See description below
ENABLE_TRANSFR DISABLE DISABLE, ENABLE
1. The default for SDM_PORT was PROGRAMN in ispLEVER 8.1 SP1 and Diamond 1.1.

29
MachXO3 Programming and Configuration Usage Guide

JTAG Port
The JTAG_PORT preference allows you to decide how the JTAG configuration port pins operate when the
MachXO3L device is in user mode. There are two states the JTAG_PORT can be set to:

• ENABLE – In this mode the JTAG I/O are dedicated and provide an IEEE 1149.1 JTAG interface
• DISABLE – In this mode the JTAG I/O pins are controlled dynamically using the JTAGENB pin

The JTAGENB pin is only available when the JTAG_PORT is in the DISABLE state. JTAGENB, when asserted high,
makes the four JTAG I/O act as an IEEE 1149.1 JTAG port. JTAGENB driven low causes the four I/O to be available
for use as general purpose I/O.

Lattice recommends designing so that the JTAG port can be accessed in the event reprogramming the MachXO3L
disables your primary configuration port.

Slave SPI Port


The SLAVE_SPI_PORT allows you to preserve the Slave SPI configuration port after the MachXO3L/LF device
enters user mode. There are two states to which the SLAVE_SPI_PORT preference can be set:

• ENABLE – This setting preserves the SPI port I/O when the MachXO3L/LF device is in user mode. When the
pins are preserved, an external SPI master controller can interact with the configuration logic. The preference
also prevents you from over-assigning I/O to the port pins.
• DISABLE – This setting disconnects the SPI port pins from the configuration logic. By itself it does not make the
port pins general purpose I/O. Both the SLAVE_SPI_PORT and MASTER_SPI_PORT must be in the DISABLE
state for the SPI port pins to be general purpose I/O.

The SLAVE_SPI_PORT can be enabled at the same time as the MASTER_SPI_PORT. It is necessary to guaran-
tee that the internal SPI master controller not perform SPI transactions at the same time as an external SPI master.
It is your responsibility to prevent two SPI masters from operating simultaneously.

Master SPI Port


The MASTER_SPI_PORT allows you to preserve the SPI configuration port after the MachXO3L/LF device enters
user mode. There are three states to which the MASTER_SPI_PORT preference can be set:

• ENABLE – This setting preserves the SPI port I/O when the MachXO3L/LF is in user mode. This preference
makes External or Dual Boot configuration modes active. Using this preference in combination with CONFIGU-
RATION = EXTERNAL enables external boot mode. This preference in combination with CFG enables Dual Boot
mode. After entering user mode, the SPI controller in the EFB has access to the SPI port for performing SPI bus
transactions. The preference also prevents you from over-assigning I/O to the port pins.
• EFB_USER – This setting preserves the SPI port I/O when the MachXO3L/LF is in user mode. After entering
user mode, the SPI controller in the EFB has access to the SPI port for performing SPI bus transactions. The
preference also prevents you from over-assigning I/O to the port pins.
• DISABLE – This setting disconnects the SPI port pins from the configuration logic. By itself it does not make the
port pins general purpose I/O. Both the SLAVE_SPI_PORT and MASTER_SPI_PORT must be in the DISABLE
state for the SPI port pins to be general purpose I/O.

The MASTER_SPI_PORT can be enabled at the same time as the SLAVE_SPI_PORT. It is necessary to guaran-
tee that the internal SPI Master controller not perform SPI transactions at the same time as an external SPI Master.
It is your responsibility to prevent two SPI masters from operating simultaneously.

30
MachXO3 Programming and Configuration Usage Guide

I2C Port
The I2C_PORT allows you to preserve the I2C configuration port after the MachXO3L/LF device enters user mode.
There are two states to which the I2C_PORT preference can be set:

• ENABLE – This setting preserves the I2C port I/O when the MachXO3L/LF is in user mode. When the pins are
preserved, and the EFB is instantiated with 'wb_clk_i' input connected to a valid clock source of at least 7.5x the
I2C bus rate, an external I2C Master controller can interact with the configuration logic. The preference also pre-
vents you from over-assigning I/O to the port pins.
• DISABLE – This setting disconnects the I2C port pins from the configuration logic. The port pins become general
purpose I/O.

In order to use the primary and secondary I2C controllers in the EFB, the I2C_PORT must be in the ENABLE state.

SDM Port
The SDM_PORT allows you to select the programming status pins after the MachXO3L device enters user mode.
There are four states to which the SDM_PORT preference can be set:

• DISABLE – This setting causes the PROGRAMN, DONE, and INITN status pins to become general purpose I/O.
• PROGRAM – This setting preserves the PROGRAMN pin when the MachXO3L/LF device is in user mode.
Asserting this pin active low causes the MachXO3L device to reconfigure. The DONE and INITN pins are general
purpose I/O.
• PROGRAM_DONE – This setting preserves the PROGRAMN and DONE pins when the MachXO3L/LF device
enters user mode. INITN is a general purpose I/O.
• PROGRAM_DONE_INITN – This setting preservers PROGRAM, DONE, and INITN in user mode.

Lattice recommends setting the SDM_PORT to PROGRAMN when using Master SPI or Dual Boot configuration
modes. The PROGRAMN pin is the only way to perform a “warm” reconfiguration of the MachXO3L/LF device,
unless another configuration port is available to transmit a REFRESH command.

MCCLK Frequency
The MCLK_FREQ preference allows you to alter the MCLK frequency used to retrieve data from an external SPI
Flash when using EXTERNAL or Dual Boot configuration modes. The MachXO3L/LF uses a nominal 2.08MHz (+/-
5.5%) clock frequency to begin retrieving data from the external SPI Flash. The MCLK_FREQ value is stored in the
incoming configuration data. It is not stored in the Feature Row. The MachXO3L device reads a series of padding
bits, a “start of data” word (0xBDB3) and a control register value. The control register contains the new
MCLK_FREQ value. The MachXO3L/LF switches to the new clock frequency shortly after receiving the
MCLK_FREQ value. The MCLK_FREQ has a range of possible frequencies available from 2.08 MHz up to 133
MHz (see Table 10). Take care not to exceed the maximum clock rate of your SPI Flash, or of your printed circuit
board.

Lattice recommends having a back-up configuration port available in the event you specify a clock frequency that is
out of specification.

ENABLE_TRANSFR
The TransFR function used by the MachXO3L/LF requires the configuration data loaded into the configuration
SRAM, and any future configuration data file loaded into the internal NVCM/Flash memory have the
ENABLE_TRANSFR set to the ENABLE state. See the TransFR Operation section, and TN1087 Minimizing Sys-
tem Interruption During Configuration Using TransFR Technology for more information about using TransFR with
the MachXO3L/LF.

31
MachXO3 Programming and Configuration Usage Guide

Bitstream Generation Options


The Bitstream Generation options allow you to decide how the Diamond development tools create the configuration
data for the MachXO3L/LF device. The CONFIGURATION, USERCODE, CUSTOM_IDCODE, and SHAREDE-
BRINIT settings are saved in the Feature Row and remain in effect until the Feature Row is erased. The other
options allow you to control the JEDEC and BIT files that are generated by Diamond.

COMPRESS_CONFIG
The COMPRESS_CONFIG preference alters the way JEDEC and BIT files are generated. The
COMPRESS_CONFIG default setting is to be ON.

JEDEC files, when they are built, are always compressed. The configuration time will be slightly reduced when
reading configuration data from the external PROM and the Diamond tool will create a JEDEC file you can program
into the internal memory.

CONFIGURATION
The CONFIGURATION preference allows you to control the Configuration memory sectors. The CONFIGURATION
preference has two possible settings:

• CFG – The CFG preference is the default mode for building configuration data. The configuration bitstream is
stored in the NVCM/Flash. The configuration data includes EBR initialization data.
• CFG_EBRUFM (MachXO3LF) – This preference creates configuration data that is stored in the Configuration
Flash. EBR initialization data is stored in the lowest page addresses of the UFM sector. The UFM sector is avail-
able in user mode. You must restore the EBR initialization data when making changes to the UFM to guarantee
correct operation.
• CFGUFM (MachXO3LF) – This preference creates configuration data that is stored in the Configuration Flash.
This mode differs from CFG by allowing the configuration data to overflow into the UFM. The configuration data
increases in size as EBR initialization data is added to the design.
• EXTERNAL – This preference generates configuration data that is stored in an external memory.

The CONFIGURATION preference defaults to the CFG state in the current release of the Diamond software. The
Diamond design software only generates JEDEC files when your entire design fits within the NVCM/Flash memory.

Use the EXTERNAL preference to build configuration data for use with Master SPI Configuration Mode. When the
configuration data exceeds the space available in the internal memory, it is necessary to switch to EXTERNAL
mode. EXTERNAL mode does not use any internal resources.

USERCODE
The MachXO3L/LF Configuration NVCM (MachXO3L)/Flash(MachXO3LF) sector contains a 32-bit register for
storing a user-defined value. The default value stored in the register is 0x00000000. Using the USERCODE prefer-
ence you can assign any value to the register you desire. Suggested uses include the configuration data version
number, a manufacturing ID code, date of assembly, or the JEDEC file checksum.

The format of the USERCODE field is controlled using the USERCODE_FORMAT preference. Data entry can be
performed in either Binary, Hex, or ASCII formats.

USERCODE_FORMAT
The USERCODE_FORMAT preference selects the format for the data field used to assign a value in the USER-
CODE preference. The USERCODE_FORMAT has three options:

• Binary – USERCODE is set using 32 ‘1’ or ‘0’ characters.


• Hex – USERCODE is set using eight hexadecimal digits (i.e., 0-9A-F)
• ASCII – USERCODE is set using up to four ASCII characters

32
MachXO3 Programming and Configuration Usage Guide

CUSTOM_IDCODE
The CUSTOM_IDCODE preference is used to assign a 32-bit register that resides in the Feature Row. The
CUSTOM_IDCODE field is only active when the MY_ASSP preference is in the ON state. The value assigned can
be entered in binary or hexadecimal, according to the CUSTOM_IDCODE_FORMAT preference. See the
MY_ASSP section for more information about how to assign a value to the CUSTOM_IDCODE preference.

CUSTOM_IDCODE_FORMAT
The CUSTOM_IDCODE_FORMAT preference selects the format for the data field used to assign a value in the
CUSTOM_IDCODE preference. The CUSTOM_IDCODE_FORMAT has two options:

• Binary – CUSTOM_IDCODE is set using 32 ‘1’ or ‘0’ characters.


• Hex – CUSTOM_IDCODE is set using eight hexadecimal digits (i.e., 0-9A-F)

SHAREDEBRINIT
When set to ENABLE, this preference allows one copy of a unique memory initialization file to be stored in the
internal memory. This copy of the initialization values can be shared among multiple EBRs. Doing so reduces the
bit-stream size of the design and saves internal memory space for other applications.

MUX_CONFIGURATION_PORTS
The MUX_CONFIGURATION_PORTS is used in the event that all configuration ports are disabled. Disabling all of
the available configuration ports turns the MachXO3L/LF into a “write one time” device.
MUX_CONFIGURATION_PORTS confirms the removal of all configuration ports. The control is only active when
all of the other configuration ports are set to the DISABLE state. MUX_CONFIGURATION_PORTS set to the
ENABLE state enables the JTAGENB input pin, permitting the JTAG port pins to be multiplexed. Setting
MUX_CONFIGURATION_PORTS to the DISABLE state causes the Diamond build tools to honor the removal of all
other configuration ports, allowing the MachXO3L/LF to become a “write one time” device.

DUALBOOTGOLDEN
The DUALBOOTGOLDEN preference is used to specify the location of the fail-safe boot image in Dual Boot appli-
cations. When set to INTERNAL, the MachXO3 device attempts to configure first from external flash PROM using
MSPI mode. If the configuration fails, the MachXO3 then attempts to configure itself from the 'Golden' fail-safe
image in internal NVCM/Flash using SDM. When set to EXTERNAL, the MachXO3 device attempts to configure
first from the internal NVCM/Flash memory using SDM. If the SDM configuration fails, the MachXO3 then attempts
to configure itself from the 'Golden' fail-safe image using MSPI mode.

Security Options
The Security Options allow you to select from a range of options for tracking or securing the MachXO3L/LF device.
Table 18 provides a summary of these options.

Table 18. Security Options


Option Name Default Setting All Settings
TRACEID <all zero> 8-bit arbitrary
MY_ASSP OFF OFF, ON
CONFIG_SECURE OFF OFF, ON
ONE_TIME_PROGRAM OFF OFF, NVMEM, NVMEM_SRAM

TRACEID
The MachXO3L/LF introduces a new feature called TraceID. TraceID stamps each MachXO3L/LF with a unique 64-
bit ID. No two MachXO3L/LF devices will have the same TraceID value even when they are loaded with the same
configuration data. This differs from a USERCODE which is present in the configuration data. Every device that
receives the configuration data using a USERCODE receives the same USERCODE value.

33
MachXO3 Programming and Configuration Usage Guide

The TraceID is 64 bits long with the least significant 56 bits being immutable data. The 56 bits are a combination of
the wafer lot, the wafer number and the X/Y coordinates locating the die on the wafer. The most significant eight
bits are provided by you and are stored in the Feature Row. The TraceID is changed using the Diamond Spread-
sheet View. You enter a unique 8-bit binary value in the TraceID field and generate configuration data.

You can read more about the TraceID feature in TN1207, Using TraceID.

MY_ASSP
Every Lattice device has its own identification code identifying the device family, device density, and other parame-
ters (for example voltage, device stepping, etc.). The code is accessible from any MachXO3L/LF configuration port.
The value stored in the IDCODE register allows you to uniquely identify a Lattice device.

The MY_ASSP preference permits you to change the value returned when the IDCODE is read from the FPGA.
Set the MY_ASSP preference to the ON state. Turning the MY_ASSP ON enables the CUSTOM_IDCODE prefer-
ence.

CUSTOM_IDCODE
The CUSTOM_IDCODE is the value you assign to override the default IDCODE in the MachXO3L/LF device. You
are only allowed to enter a 32-bit hexadecimal or binary value when the MY_ASSP preference is ON.

Overriding the IDCODE prevents the Lattice programming software from being able to identify the MachXO3L/LF
device, and as a result, prevents Programmer from being able to directly program the MachXO3L device. It is nec-
essary to migrate to generating Serial Vector Format (SVF) files in order to program MY_ASSP enabled
MachXO3L/LF devices.

CONFIG_SECURE
When this preference set to ON, the read-back of the SRAM memory and the NVCM/Flash memory are blocked.
The MachXO3L/LF device cannot be read back, nor can it be programmed without erasing. The device must be
erased in order to reset the security setting. The CONFIG_SECURE fuse and the NVCM/Flash are erased in tan-
dem. Once the security fuses are reset, the device can be programmed again.

ONE_TIME_PROGRAM
The MachXO3L/LF has One Time Programmable (OTP) fuses that can be used to prevent the on-chip memory
from being erased or programmed. The MachXO3L/LF device has OTP security fuses for the SRAM and
NVCM/Flash memory sectors. This preference provides options to set the OTP security for each memory sector.

• NVMEM – The NVCM/Flash cannot be erased or programmed


• NVMEM_SRAM – The NVCM/Flash and SRAM cannot be erased or programmed

Once the ONE_TIME_PROGRAM preference is set for the NVMEM memory, the on-chip NVCM/Flash memory
cannot be erased or programmed. The configuration data is prevented from further modification, but the SDM
mode can still be used to configure the device.

When the ONE_TIME_PROGRAM preference is set for the NVMEM_SRAM memory, the device acts like an ASIC.
You are no longer able to reprogram the internal NVCM/Flash, and the SRAM cannot be changed from the JTAG
port. Configuration of SRAM from on-chip NVCM/Flash or external SPI Flash is still enabled.

BACKGROUND_RECONFIG
The BACKGROUND_RECONFIG preference specifies the behavior of the PROGRAMN pin (when enabled) and
the sysConfig REFRESH command.

When set to OFF (default), toggling PROGRAMN or transmitting the REFRESH command initiates a standard
'warm-boot' SRAM reconfiguration sequence from the specified configuration image (internal or external) or
images (dual boot). The 'warm-boot' sequence executes initialization, configuration and wake-up steps before re-
entering user mode (see Power-up Sequence, above).

34
MachXO3 Programming and Configuration Usage Guide

When set to ON, toggling PROGRAMN or transmitting the REFRESH command will initiate a 'background' SRAM
reconfiguration sequence from the specified configuration image (internal or external) or images (dual boot). The
'background' sequence executes the configuration step alone. The the initialization and wake-up steps are
bypassed while the device remains in user mode throughout the sequence. This is typically used in conjunction
with soft-error-detection (SED) to support soft-error-correction (SEC). The device operates without disruption. Only
erroneous SRAM cells are corrected.

Device Wake-up Sequence


When configuration is complete (the SRAM has been loaded), the device will wake up in a predictable fashion. If
the MachXO3L/LF device is the only device in the chain, or the last device in a chain, the wake-up process should
be initiated by the completion of configuration. Once configuration is complete, the internal DONE bit will be set
and then the wake-up process will begin. Figure 18 shows the wake-up sequence using the internal clock.

Figure 18. Wake-up Sequence Using Internal Clock

MCLK

DONE BIT

GLOBAL OUTPUT ENABLE

GLOBAL SET/RESET

GLOBAL WRITE DISABLE

DONE PIN

T0 T1 T2 T3

Wake-up Signals
Three internal signals, GSR, GWDIS, and GOE, determine the wake-up sequence.

• GSR is used to set and reset the core of the device. GSR is asserted (low) during configuration and de-asserted
(high) in the wake-up sequence.
• When the GWDIS signal is low it safeguards the integrity of the RAM Blocks and LUTs in the device. This signal
is low before the device wakes up. This control signal does not control the primary input pin to the device but con-
trols specific control ports of EBR and LUTs.
• When low, GOE prevents the device’s I/O buffers from driving the pins. The GOE only controls output pins. Once
the internal DONE is asserted the MachXO3L/LF will respond to input data.
• When high, the DONE pin indicates that configuration is complete and that no errors were detected.

Wake-up Clock Selection


The clock source used to complete the four state transitions in the wake-up sequence is user-selectable. Once the
MachXO3L/LF is configured, it enters the wake-up state, which is the transition between the configuration mode
and user mode. This sequence is synchronized to a clock source, which defaults to MCLK/CCLK when sysCON-
FIG is used, or TCK when JTAG is used.

You can change the clock used by instantiating the START macro in your Verilog or VHDL. The clock must be sup-
plied on an external input pin, because the MachXO3L/LF does not begin internal operations until the Wake-up

35
MachXO3 Programming and Configuration Usage Guide

sequence is complete. There is no external indication the device is ready to perform the last four state transitions.
You must either provide a free running clock frequency, or you must wait until the device is guaranteed to be ready
to wake up. Using the START macro provides another mechanism for holding off configuring one or more program-
mable devices and then starting them synchronously.

Verilog
module START (STARTCLK);
input STARTCLK;
endmodule

START u1 (.STARTCLK(<clock_name>)) /* synthesis syn_noprune=1 */;

VHDL
COMPONENT START
PORT(
STARTCLK : IN STD_ULOGIC
);
END COMPONENT;
attribute syn_noprune: boolean ;
attribute syn_noprune of START: component is true;

begin
u1: START port map (STARTCLK =><clock name>);

Advanced Configuration Information


NVCM/Flash Programming
The MachXO3’s internal NVCM/Flash is the heart of the FPGA’s configuration system. It is flexible, allowing you to
store the FPGA’s configuration data, as well as storing design specific data in the internal memory. It is also a
resource that uses a precise erase and programming sequence. Lattice provides several methods for programming
the MachXO3 NVCM/Flash:

• JTAG or Slave SPI programming


• VMEmbedded: ‘C’ source for use with an embedded microprocessor controlling the JTAG port
• SSPIEmbedded: ‘C’ source for use with an embedded microprocessor controlling the SSPI port
• Custom: The information in this section, and information from TN1294, Using Hardened Control Functions in
MachXO3 Devices Reference Guide, permits creation of a custom solution.

The NVCM (MachXO3L)/Flash(MachXO3LF) space can be accessed by the JTAG, I2C, and SPI ports. These con-
figuration ports may use offline or transparent modes to erase, program, and verify the MachXO3 NVCM
(MachXO3L)/Flash(MachXO3LF) resources. The WISHBONE interface is only permitted to use transparent pro-
gramming operations (MachXO3LF). The sequence and timing of the commands presented to the Configuration
Logic are identical across all of the configuration ports. There are slight differences due to communication protocol
standards when transmitting commands and data. The command and timing flow common to all configuration ports
is described first. Protocol variances are described afterward.

Each MachXO3 contains a certain quantity of internal memory. The amount of memory depends on the device
density of the MachXO3. Figure 19 shows the number of internal memory pages available for each MachXO3
device density. Each page represents 128 bits of data.

36
MachXO3 Programming and Configuration Usage Guide

Table 19. Number of Pages of NVCM/Flash Memory for the MachXO3 Family
NVCM0 /Configuration Flash Total NVCM/(CFG + UFM)
MachXO3 Device Density (Pages) NVCM1/UFM (Pages) Bridged (Usable Pages)1
9400 12,539 3,582 16,121
6900 9,211 2,046 11,257
4300 5,758 767 6,525
2100 3,198 639 3,837
1300 2,175 511 2,686
640 1,151 191 1,342
1. Usable (NVCM0 + NVCM1)/(CFG+UFM) (CONFIGURATION = CFGUFM) page count may be less than the actual bitstream size due to
device limitations.

MachXO3 JEDEC File Format


All Lattice non-volatile devices support JEDEC files. Utilities are available in the Deployment Tool software for con-
verting the JEDEC file into other programming file formats, such as STAPL, SVF, or bitstream (hex or binary). The
relevant detail about the JEDEC file is provided in Table 20 for completeness.
Table 20. MachXO3 JEDEC File Format
JEDEC Field Syntax Description
Characters appearing before the ^B character are don’t care. All character
Don’t Care My design
sets or internal language can be used here except ^B.
^B (Control-B 0x02) marks the beginning of the JEDEC file. Only ASCII
characters are legal after ^B. The character * is the delimiter to mark the
Start-of-text ^B
ending of a JEDEC field. The CR and LF are treated as regular white
spaces and have no delimiter function in a JEDEC file.
The first field is the header, which does not have an identifier to indicate its
Header My design start. Only ASCII characters are legal after ^B. The header is terminated by
an asterisk character *.
Field Terminator * Each field in the JEDEC file will be terminated with an asterisk.
The key word N marks the beginning of the comment. It can appear any-
Note (Comment) NOTE my design where in the JEDEC file. Lattice’s JEDEC files add “OTE” to the N key word
to make it a more meaningful word NOTE.
Fuse Count QF3627736 The key word QF identifies the total real fuse count of the device.
The key word F identifies the fuse state of those fuses not included in the
link field. F0 = fill them with zeros (0), F1 = fill them with ones (1). It is
Default Fuse State F0 or F1 defined for the purpose of reducing JEDEC file size. It has no meaning in
Lattice’s JEDEC file. Lattice recommends using compression to reduce file
size instead.
Security Setting G0 or G1 JEDEC standard defines G<0,1> to program security <0=no, 1=yes>
Lattice enhances the G field to cover OTP fuse programming as well.
OTP and Security Setting G0, G1, G2, or G3
G<0=both no, 1=only security yes, 2=only OTP yes, 3=both yes>.

37
MachXO3 Programming and Configuration Usage Guide

Table 20. MachXO3 JEDEC File Format (Continued)


JEDEC Field Syntax Description
The keyword L identifies the first fuse address of the fuse pattern that fol-
lows after the white space. The number of digit shown following the L key-
word must be the same as that on the QF field. In this example,
QF3627736 has seven digits, thus L0000000 should have seven zeros.
The fuse address traditionally starts counting from 0.
L0000000
101011…100011 The link field is the most critical portion of the JEDEC file where the pro-
………………….. gramming pattern is stored. The programming data is written into this field
111111…101100 in the manner mirroring exactly the fuse array layout of the silicon physi-
110 cally.
101011…100011 Row address is written from top to bottom in ascending order:
…………………..
111111…101100 Top = Row 0, Bottom = Last Row.
110
The column address is written from left to right in ascending order:
Link Field ……..
…….. Left most = bit 0, Right most = last bit.
101011…100011
………………….. Row 0 is selected first by the INIT_ADDRESS command. The first bit to
111111…101100 shift into the device is bit 0 for programming. The first to shift out from the
110* device is also bit 0 when verify.
NOTE SED_CRC* The end of the Configuration data is marked by “NOTE END CONFIG
L3627704 DATA*”. It is not necessary to program any page data containing all ‘0’ val-
111111….111111* ues.
CC1B9
NVCM1/UFM pages, if present in the JEDEC, are preceded by a “NOTE
TAG DATA*” line.
If the JEDEC file is encrypted, all the data in the link field are encrypted.
The column size will increase accordingly to include filler bits to make the
column size packet (128-bit, or 16 bytes, per packet) bounded.
The checksum of all the fuses = Fuse count. The fuse state of all the fuses
can be found from the Link field. If it is not specified in the link field, then
Fuse Checksum CC1B9 use the Default Fuse State in their places. If the JEDEC file is encrypted,
the fuse checksum is calculated after encryption. The fuse checksum prior
to encryption can be found on one of the comments.
This is the place to store the 32-bit USERCODE. The 32-bit USERCODE
U Field UA Home can be expressed in UA = ASCII, UH = ASCII Hex, U = Binary. Lattice
enhanced this field for storing the CRC value of encrypted JEDEC.
JEDEC standard defines this field to hold the architecture fuses. Lattice
E Field EH 012..ABCDEF uses this field to store the Feature Row and FEABITS. The Feature Row
data is on the first line. The FEABITS values are on line 2.
End-of-text ^C ^C (CTLC) marks the ending of the JEDEC file.
This is the checksum of the whole file starting from ^B to ^C. All characters
Transmission Checksum ABCD and white space, including the ^B and ^C, are included in the checksum
calculation.

An example of a MachXO3 JEDEC file is shown in Figure 19.

38
MachXO3 Programming and Configuration Usage Guide

Figure 19. JEDEC File Example


*
NOTE Diamond_1.2_Production (92) JEDEC Compatible Fuse File.*
NOTE Copyright (C), 1992-2010, Lattice Semiconductor Corporation.*
NOTE All Rights Reserved.*
NOTE DATE CREATED:Fri Dec 02 14:50:08 2011*
NOTE DESIGN NAME:control_SoC_demo_impl1.ncd*
NOTE DEVICE NAME:LCMXO3L-1300E-6CSFBGA256*
NOTE TRACEID 0x84*
NOTE LVDS_72P M9*
NOTE LVDS_72N N10*
NOTE LVDS_68P P8*
NOTE LVDS_68N M8*
NOTE PIN ASSIGNMENTS*
NOTE PINS cap_btn1 : M10 : inout*
NOTE PINS LCD_COM0 : B14 : out*
NOTE PINS xout : N7 : out*
...
NOTE PINS xin : M5 : in*
NOTE PINS Icc_analog_cmp_p : P8 : in*
QP132*
QF343936*
G0*
F0*
L000000
11111111111111111011110110110011111111111111111100111011000000000000000000000000000000100000000000000000000000000011000000000110
01000010010100001001000001001000000010011111111101000110000000000000000000000000101110001110000000000001010011010000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000010001000100010000000000001000100000000000010001000000000000100010000000001000100010001000000100010000001000100000000
01000100010001000000100010000000000000000001000100000000000000000000000000000000000000000000100010001001000000000000010010000000
00000010010000000000000100100000000001000100010010000000100100000001001000000000010001000100100000001001000000000000000000010010
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
...
00000000000000000000000000000000000000001011110101101010111111111111111111111111111111111111111111111111111111111111111101110010
00010000010000000000010111000000000000000001100000000000000000000111001000010000010101000000101000000000100000000000000100001001
11111110000000000000000000000000000000000000000011000010100000000000000000000000110010101111111010111010101111101111000101000100
00100010000000000000000000000000110000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111
*
NOTE EBR_INIT DATA*
L137984
11111111111111111111111111111111111101100000000000000000000000000000000000000000000110000000000010110010000100000000000010000000
00011110100011110100011110100011110100011110100011110100011110100011110100011110100011110100011110100011110100011110100011110100
01111010001111010001111010001111010001111010001111010001111010001111010001111010001111010001111010001111010001111010001111010001
...
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00100010000000000000000000000000000000000000000000000000000000000101111000000000000000000000000011111111111111111111111111111111
*
NOTE END CONFIG DATA*
L184832
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
...
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
*
NOTE TAG DATA*
L343808
01000100010001000000100010000000000000000001000100000000000000000000000000000000000000000000100010001001000000000000010010000000
00000010010000000000000100100000000001000100010010000000100100000001001000000000010001000100100000001001000000000000000000010010
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
*
C5CC8*
NOTE FEATURE_ROW*
E0000000000000000000000000000000000100001000010000000000000000000
0000010000000000*
NOTE User Electronic Signature Data*
UHCAFEBABE*
6243

39
MachXO3 Programming and Configuration Usage Guide

MachXO3 NVCM/Flash Programming Flow


The MachXO3 NVCM/Flash memory erasure, and programming requires a specific set of steps and timing. The
flow chart in this section describes the command sequences and the timing required for successful NVCM/Flash
programming. The commands and timing are common between all of the configuration ports. There are some
minor variations in the protocol, but not the timing, based on the configuration port used. Exceptions are described
in the configuration port specific sections.

40
MachXO3 Programming and Configuration Usage Guide

Figure 20. MachXO3 NVCM/Flash Memory Programming Flow

Start

Note:
To 'Check Device ID' over the I2C configuration port,
the MachXO3 must be in Feature Row HW Default Mode state Check No
(that is, blank/erased), or in User Mode state with the EFB Device ID?
instantiated and with the EFB 'wb_clk_i' input connected
to a valid clock source of at least 7.5x the I2C bus rate.
Yes
If the EFB is not instantiated (not recommended),
the I2C configuration port 'Check Device ID' readback data Transmit Read ID
will be 0xFFFF. To temporarily work around this limitation, Command (0xE0)
the 'Check Device ID' step can be omitted, or moved to
after the 'Transmit Enable Configuration Interface
(Transparent or Offline Mode) Command'.
Read 32 ID Bits

ID No
Match? Stop

Yes

Device
No
Password
Protected?

Yes

Transmit Shift
Password
Command (0xBC)

Transmit Enable Transmit Enable


Delay No Check Configuration Interface Yes Transparent No Configuration Check No Delay
5 µs Busy? (Transparent Mode) Configuration? Interface (Offline Mode) Busy? 5 µs
Command (0x74) (MachXO3LF) (MachXO3L/ Command (0xC6)
MachXO3LF)
Yes Yes

Transmit Read Busy Transmit Read Busy


Flag (0xF0) or Read No No Flag (0xF0) or Read
Busy? Busy?
Status Register Status Register
Command (0x3C) Command (0x3C)

Yes Yes
Erase NVCM/Flash
NVCM0/NVCM1/FR or
CFG/UFM/FR (0x0E)

Transmit Read Busy


Flag (0xF0) or Read
Status Register
Command (0x3C)

Yes Note: Do not use fixed delays for the


Busy?
NVCM/Flash erase sequence.

No

Transmit
Read Status Register
Command (0x3C)

Yes
Fail? Exit

No

1
41
MachXO3 Programming and Configuration Usage Guide

1
Program No
NVCM/
Flash?

Yes
Transmit Reset
NVCM0/CFG Address
(0x46) or Set Address
Command (0xB4)

Transmit PROGRAM
Command and
128 Bits of Data

Check No Delay
Busy? 200 µs

Yes
Transmit
Read Busy Flag or
Read Status Register
Command

Yes
Busy?

No

Compare Row Count

No
Last Row?

Yes

Transmit Reset
NVCM1/UFM Address (0x46) Yes Program
or Set Address NVCM1/
Command (0xB4) UFM?

No

42
MachXO3 Programming and Configuration Usage Guide

2
No Program
Usercode?

Yes

Transmit Program USER-


CODE with Data (0xC2)

Check No Delay
Busy? 200 µs

Yes
Transmit Read Busy
Flag (0xF0) or Read
Status Register
Command (0x3C)

Yes
Busy?

No

Transmit Read Status


Register Command (0x3C)

Yes Clean
Fail?
Up

No

No Verify
Usercode?

Yes

Transmit Read USER-


CODE Command (0xC0)

Usercode No Clean
OK? Up

Yes

Verify No
NVCM0/
CFG?

Yes

Transmit Reset NVCM0/CFG


Address (0x46)
or Set NVCM/Flash Address (Contined on
Command (0xB4) Next Page)

43
MachXO3 Programming and Configuration Usage Guide

3
Transmit Read
(Contined from
Command with
Previous Page)
Number of Pages
(0x73)

Read Page Data

Transmit Reset
Data No Clean
NVCM1/UFM
OK? Up
Address (0x46) or Set
Address Command
(0xB4) Yes

No All Pages
Read?

Yes

Verify
Yes
NVCM1/
UFM?

Write
Program Yes Transparent No No Program
Configuration? Feature Done
Done
Row?

Yes

Transmit Write Feature


Row Command (0xE4)

Check No Delay
Busy? 200 µs

Yes
Transmit Read Busy
Flag (0xF0) or Read
Status Register
Command (0x3C)

Yes
Busy?

No

Transmit Read
Feature Row
Command (0xE7)

Feature No Clean
Row OK? Up

Yes

Transmit Write FEABITS


Command (0xF8)

4
44
MachXO3 Programming and Configuration Usage Guide

4
Check No Delay
Busy? 200 µs

Yes
Transmit Read Busy
Flag (0xF0) or Read
Status Register
Command (0x3C)

Yes
Busy?

No

Transmit Read FEABITS


Command (0xFB)

FEABITS No Clean
OK? Up

Transmit
Program
Program DONE
Done
Command (0x5E)

Check No Delay
Busy? 200 µs

Yes

Transmit Read Busy


Flag (0xF0) or Read
Status Register
Command (0x3C)

Yes
Busy?

No

Transmit Read Status


Register Command (0x3C)

DONE No Clean
Set? Up

Yes

45
MachXO3 Programming and Configuration Usage Guide

5
Write No
Security
Bit?

Yes
Transmit
Program SECURITY
(0xCE) or SECURITY
PLUS Command (0xCF)

Check No Delay
Busy? 200 µs

Yes

Transmit Read Busy


Flag (0xF0) or Read
Status Register
Command (0x3C)

Yes
Busy?

No

Program
OTP Fuses?

Transmit Program
OTP Command (0xF9)

Transmit Read Busy


Flag (0xF0) or Read
Status Register
Command (0x3C)

Yes
Busy?

No

Verify No
OTP Fuses?

Yes

Transmit Read
OTP Command (0xFA)

OTP No
Fuses OK? Clean Up

Yes

46
MachXO3 Programming and Configuration Usage Guide

Exit
6
No Offline
Mode?

Yes
Yes Transmit Refresh
Refresh?
Command (0x79)

Wait tREFRESH

Transmit Disable
Configuration Check Transmit
Yes Read Status
Interface Command for
(0x26) Success? Register Command
(0x3C)

No
Yes Refresh
Successful?1

Notes: No
To 'Read Status Register' over the I2C configuration port,
the MachXO3 must have the EFB instantiated and with the Retry
EFB 'wb_clk_i' input connected to a valid clock source Count No
of at least 7.5x the I2C bus rate. If the EFB is not instantiated Exceeded?
(not recommended), the I2C configuration port 'Read Status Register'
readback data will be 0xFFFF. To temporarily work around this limitation,
the 'Transmit Read Status Register' step can be omitted. Yes
Refresh was successful if Status Register BUSY bit = 0, DONE bit = 1,
and Configuration Check Status bits = 000. See TN1294, www.Using
lat icesemi.com/dynamiHardened
c/view_doc .cfm?document_id=50512
Control Functions in MachXO3 Devices Reference Guide for complete
www.latticesemi.com/dynamic/view_document.cfm?document_id=50512 Done Clean Up
Read Status Register command details.

47
MachXO3 Programming and Configuration Usage Guide

Clean Up

Transmit Erase
NVCM/Flash
NVCM0/NVCM1/FR
or CFG/UFM/FR
Command (0x0E)

Transmit Read Busy


Flag (0xF0) or Read Note: Do Not use fixed delays
Status Register for the NVCM/Flash erase sequence.
Command (0x3C)

Yes
Busy?

No

Transmit Refresh
Command (0x79)

Note: The MachXO3 Configuration


Done NVCM0/NVCM1/Feature Row
CFG/UFM/Feature Row
memories are erased.

48
MachXO3 Programming and Configuration Usage Guide

MachXO3 Slave SPI/I2C SRAM Configuration Flow


MachXO3 Slave SPI/I2C SRAM configuration requires a specific set of steps and timing. The flow chart in this sec-
tion describes the command sequences and the timing required for successful SSPI/I2C SRAM configuration.

Figure 21. MachXO3 Slave SPI/I2C SRAM Configuration Flow


Note: ST -> I2C Start
SP -> I2C Stop
RE -> I2C Restart Start
SL -> SPI SN Low
SH -> SPI SN High

[1] Configuration Interface needs to be


re-enabled for reading Status Register or
Device ID after Disable command(0x26)
is issued for I2C SRAM Configuration.
Check Device ID?
[2] Enable instruction (offline mode)
is of 4 bytes for SPI i.e. C6000000 (optional)

Yes

ST

Transmit ENABLE
Configuration Interface
(Offline Mode) Command
(C60000 HEX)
*Skip this step for SPI [1]

SP

ST/SL

Transmit READ ID
Command
(E0000000 HEX)
No

[RE] Read 32 bit


Device ID

SP/SH

Stop
No ID Match?
(Error)

Yes

ST/SL

49
MachXO3 Programming and Configuration Usage Guide

1
Transmit REFRESH
Command
(790000 HEX)
to reset the device

SP/SH

ST/SL

Transmit
ENABLE
Configuration
Interface
(Offline Mode)
Command
(C60000 HEX)
to enable
SRAM Programming
Mode [2]

SP/SH

ST/SL

Transmit ERASE
Command
(0E010000 HEX)
to Erase SRAM

SP/SH

Wait 200 μs

50
MachXO3 Programming and Configuration Usage Guide

2
Read
SRAM status
register
(optional)

Yes

ST/SL

Transmit
READ_STATUS
Command
(3C000000 HEX)
to read status register

[RE] Read Status


Yes register value
(Expect value :
0x00000000
with the MASK:
No
0x00003100
(bit 8-DONE = 0,
bit 12-BUSY = 0,
bit 13-FailFlag = 0) )

SP/SH

Read Status
register
BUSY Flag HIGH? No FAIL Flag HIGH? No value matches
expected value?

Yes
Stop
Yes
(Error)

ST/SL

Transmit
LSC_BITSTREAM
_BURST
Command
(7A000000 HEX)
to configure SRAM

[RE] Transmit
Bitstream(.bit)
generated by
Diamond
(Compressed bitstream
is recommended
to reduce
configuration time)

51
MachXO3 Programming and Configuration Usage Guide

3
SP/SH

Check
SRAM Status
Register?
(Optional)

Yes

ST/SL

Transmit
READ_STATUS
Command
(3C000000 HEX)
to read SRAM
status register

[RE] Read Status


Register value
(Expected value :
0x00000100
No
with the MASK:
Yes
0x00003100
(bit 8-DONE = 1,
bit 12-BUSY = 0,
bit 13-FailFlag = 0)

Stop SP/SH
(Error)

Yes

Read Status register


Busy Flag HIGH? No Fail Flag HIGH? No value matches
expected value ?

No
Yes

4 4

52
MachXO3 Programming and Configuration Usage Guide

4 4
Stop Verify USERCODE?
No Done Flag High? Yes
(Error) (optional)

Yes

ST/SL

Transmit
READ USERCODE
Command
(C0000000 HEX)
No

[RE] Read
USERCODE
value

SP/SH

ST/SL

Transmit
DISABLE
Command
(260000 HEX)

SP/SH

ST/SL

Transmit NO-OP
Command
(FFFFFFFF HEX)
to exit
programming mode

SP/SH

Stop
(Success)

53
MachXO3 Programming and Configuration Usage Guide

Figure 22. Status Register Value After Erase

Expected value from SO: 0x00000000 with the MASK: 0x00003100 


(bit 8-DONE = 0, bit 12-BUSY = 0, bit 13-FailFlag = 0) 
Mask = 0 means don’t care
Mask = 1 means care

Figure 23. Status Register Value After Program

Expected value from SO: 0x00000100 with the MASK: 0x00003100 


(bit 8-DONE = 1, bit 12-BUSY = 0, bit 13-FailFlag = 0) 
Mask = 0 means don’t care 
Mask = 1 means care

54
MachXO3 Programming and Configuration Usage Guide

Figure 24. Slave SPI/I2C SRAM Read Status Register Flow

Start

ST

Transmit ENABLE_X
Configuration
Interface
(Transparent Mode)
Command
(74000000 HEX)
to enable SRAM
Programming Mode
*Skip this
step for SPI [1]

SP

ST/SL

Transmit READ_STATUS
Command
(3C000000 HEX)
to read
SRAM Status Register

55
MachXO3 Programming and Configuration Usage Guide

2
[RE] Read Status
Register Value

SP/SH

ST/SL

Transmit
DISABLE Command
(260000 Hex)

SP/SH

ST/SL

Transmit NO-OP
Command
(FFFFFFFF HEX)

SP/SH

Stop

56
MachXO3 Programming and Configuration Usage Guide

MachXO3 Programming Commands


Table 21. MachXO3 sysCONFIG Programming Commands
Command Name
[SVF Synonym] Command Operands Write Data Read Data Notes
Read Device ID YY characters represent the device-specific ID
[IDCODE_PUB] 0xE0 00 00 00 N/A YY YY YY YY code.

Enable Configuration Interface


Enable the Configuration Logic for device pro-
(Transparent Mode) 0x74 08 00 001 N/A N/A
gramming in transparent mode.1
[ISC_ENABLE_X]
Enable Configuration Interface
Enable the Configuration Logic for device pro-
(Offline Mode) 0xC6 08 00 001 N/A N/A gramming in Offline mode.1
[ISC_ENABLE]
Read Busy Flag 0xF0 00 00 00 N/A YY Bit 1 0
[LSC_CHECK_BUSY] 7 Busy Ready

Read Status Register Bit 1 0


0x3C 00 00 00 N/A YY YY YY YY 12 Busy Ready
[LSC_READ_STATUS] 13 Fail OK
Y = Memory space to erase
Y is a bitwise OR
Erase 0x0E 0Y 00 00 N/A N/A Bit 1=Enable
[ISC_ERASE] 16 Erase SRAM
17 Erase Feature Row
18 Erase NVCM0/CFG
19 Erase NVCM1/UFM
Erase NVCM1/UFM 0xCB 00 00 00 N/A N/A Erase the NVCM1/UFM sector only.
[LSC_ERASE_TAG]
Reset Configuration NVCM/CFG 0x46 00 00 00 N/A N/A Set Page Address pointer to the beginning of
Address [LSC_INIT_ADDRESS] the NVCM0/Configuration Flash sector.
Set the Page Address pointer to the
NVCM/Flash page specified by the least signifi-
cant 14 bits of the PP PP field.
Set Address
0xB4 00 00 00 M0 00 PP PP N/A The ‘M’ field defines the NVCM/Flash space to
[LSC_WRITE_ADDRESS] access.
Field 0x0 0x4
M NVCM0/CFG NVCM1/UFM
Program Page Program one NVCM/Flash page. Can be used
[LSC_PROG_INCR_NV] 0x70 00 00 01 YY * 16 N/A to program the NVCM0/CFG or NVCM1/UFM.
Reset NVCM1/UFM Address Set the Page Address Pointer to the beginning
[LSC_INIT_ADDR_NVCM1/UFM] 0x47 00 00 00 N/A N/A of the NVCM1/UFM sector.
Program NVCM1/UFM Page
[LSC_PROG_TAG] 0xC9 00 00 01 YY * 16 N/A Program one NVCM1/UFM page.

Program USERCODE
[ISC_PROGRAM_USERCODE] 0xC2 00 00 00 YY * 4 N/A Program the USERCODE.

Read USERCODE
[USERCODE] 0xC0 00 00 00 N/A YY * 4 Retrieves the 32-bit USERCODE value.

Write Feature Row


[LSC_PROG_FEATURE] 0xE4 00 00 00 YY * 8 N/A Program the Feature Row bits.

Read Feature Row


[LSC_READ_FEATURE] 0xE7 00 00 00 N/A YY * 8 Retrieves the Feature Row bits.

Write FEABITS
[LSC_PROG_FEABITS] 0xF8 00 00 00 YY * 2 N/A Program the FEABITS.

Read FEABITS
[LSC_READ_FEABITS] 0xFB 00 00 00 N/A YY * 2 Retrieves the FEABITS.

Retrieves PPPP count pages. Only the least


See the significant 14 bits of PP PP are used.
Reading
Read NVCM/Flash The ‘M’ field must be set based on the configu-
[LSC_READ_INCR_NV] 0x73 M0 PP PP N/A NVCM/Flash ration port being used to read the NVCM/Flash.
Pages
section. 0x0 I2C
0x1 JTAG/SSPI

57
MachXO3 Programming and Configuration Usage Guide

Table 21. MachXO3 sysCONFIG Programming Commands (Continued)


Command Name
[SVF Synonym] Command Operands Write Data Read Data Notes
Retrieves PPPP count NVCM1/UFM pages.
See the Only the least significant 14 bits of PP PP are
Reading used for the page count.
Read NVCM1/UFM
[LSC_READ_NVCM1/UFM] 0xCA M0 PP PP N/A NVCM/Flash The ‘M’ field must be set based on the configu-
Pages ration port being used to read the NVCM1/UFM.
section. 0x0 I2C
0x1 JTAG/SSPI
Program DONE
[ISC_PROGRAM_DONE] 0x5E 00 00 00 N/A N/A Program the DONE status bit enabling SDM.

Makes the selected memory space One Time


Programmable. Matching bits must be set in
unison to activate the OTP feature.
Bit 1 0
Program OTP Fuses 0, 4 SRAM OTP SRAM Writable
0xF9 00 00 00 UCFSUCFS N/A 1, 5 Feature Row Feature Row
[LSC_PROG_OTP]
OTP Writable
2, 6 NVCM0/CFG NVCM0/CFG Writable
OTP
3, 7 NVCM1/UFM NVCM1/UFM Writable
OTP
Read the state of the One Time Programmable
fuses.
Bit 1 0
0, 4 SRAM OTP SRAM Writable
Read OTP Fuses 0xFA 00 00 00 N/A UCFSUCFS 1, 5 Feature Row Feature Row
[LSC_READ_OTP] OTP Writable
2, 6 NVCM0/CFG NVCM0/CFG Writable
OTP
3, 7 NVCM1/UFM NVCM1/UFM Writable
OTP
Exit Offline or Transparent programming mode.
ISC_DISABLE causes the MachXO3 to auto-
matically reconfigure when leaving Offline pro-
gramming mode. Thus, when leaving Offline
Disable Configuration programming mode the Configuration SRAM
Interface 0x26 00 00 N/A N/A must be explicitly cleared using ISC_ERASE
[ISC_DISABLE] (0x0E) prior to transmitting ISC_DISABLE. The
recommended exit command from Offline pro-
gramming mode is LSC_REFRESH (0x79),
wherein ISC_ERASE and ISC_DISABLE are
not necessary. See Figure 20.
Bypass 0xFF FF FF FF N/A N/A No Operation and Device Wakeup.
[ISC_NOOP]
Force the MachXO3 to reconfigure. Transmitting
Refresh a REFRESH command reconfigures the
[LSC_REFRESH] 0x79 00 00 N/A N/A MachXO3 in the same fashion as asserting
PROGRAMN.
Program SECURITY Program the Security bit (Secures NVCM0/CFG
0xCE 00 00 00 N/A N/A
[ISC_PROGRAM_SECURITY] sector).2
Program SECURITY PLUS Program the Security Plus bit (Secures
0xCF 00 00 00 N/A N/A
[ISC_PROGRAM_SECPLUS] NVCM/Flash Sectors).2
Read TraceID code
0x19 00 00 00 N/A YY*8 Read 64-bit TraceID.
[UIDCODE_PUB]
Shift in bitstream (.bit) generated by 
Configure SRAM Compressed Diamond. Recommend using compressed bit-
0x7A 00 00 00 N/A stream to reduce configuration time. Number of
[LSC_BITSTREAM_BURST] bitstream bits varies depending on 
compression ratio.
Program Flash Protect Key
0xF1 00 00 00 YY*8 N/A Program the 64-bit Password into the device.
[LSC_PROG_PASSWORD]
Read Flash Protect Key
0xF2 00 00 00 N/A YY*8 Read the 64-bit Password from the device.
[LSC_READ_PASSWORD]

58
MachXO3 Programming and Configuration Usage Guide

Table 21. MachXO3 sysCONFIG Programming Commands (Continued)


Command Name
[SVF Synonym] Command Operands Write Data Read Data Notes
Present the 64-bit Password. When enabled
(PWD_enable = 1), the write data is compared
to the Password contained into the Feature
Row. If the values match, the device is unlocked
Shift Flash Protect Key 0xBC 00 00 00 YY*8 N/A for programming and configuration operations.
[LSC_SHIFT_PASSWORD]
The device remains unlocked until a Disable
Configuration command is received, a Refresh
command is issued, or a power cycle event
occurs.
1. Transmit the command opcode and first two operand bytes when using the I2C port. The final operand byte must not be transmitted.
2. SECURITY and SECURITY PLUS commands are mutually exclusive.

59
MachXO3 Programming and Configuration Usage Guide

Reading NVCM/Flash Pages


Reading the NVCM0/CFG and NVCM1/UFM pages requires a specific procedure. The NVCM0/CFG and
NVCM1/UFM pages are accessible from any of the MachXO3’s configuration ports. The JTAG and Slave SPI con-
figuration ports all behave identically when performing read operations. The I2C port requires a modified access
protocol. A high-level representation of the data flow, by port, is shown in Figure 26.

All ports start the read process in the same way, by sending a Read NVCM/Flash/Read NVCM1/UFM command.
The MachXO3 begins the read process once the command byte has been accepted by the configuration logic. The
Page Address Pointer determines the first page returned from the MachXO3. For the first returned page to be valid
(for example, for single-page read operations), a Retrieval delay of 240 ns for MachXO3-2100 and bigger devices
or 360 ns for MachXO3-1300 and smaller devices must be observed. The Retrieval delay time is from the end of
the Command byte transmission to the end of the first Operand byte transmission See Figure 25. Note that for
slower interface clock rates, 240 ns or 360 ns may be consumed entirely by the normal transmission of the first
Operand and no additional delay may be necessary.

Figure 25. Retrieval Delay Timing Requirement for Single-Page Reads


240 ns or 360 ns
min.

CMD OP1 OP2 OP3

Figure 26. NVCM/Flash Page Command and Data Sequence


JTAG/SPI/I2C/ CMD +
Tx Data OPS

JTAG/SPI
RX Data1 P(n) P(n) P(n+1) P(n+2) P(n+3) P(m)

1 page 4 4
I2C RX Data2 P(n) undefined P(n) dummy P(n+1) dummy P(n+2) P(m)
data bytes bytes

Notes:

1. JTAG/SSPI must transmit data in order to read data back. The data sent by the JTAG/SSPI
master is not specified (i.e. don’t care).

2. The I2C must use RESTART between sending the CMD and reading the data. (Issuing a STOP
terminates a CMD and resets the I2C state machine.)

CMD + OPS = Read NVCM/CFG or Read NVCM1/UFM command byte + 3 operand bytes.

Figure 26 shows a multiple page read sequence. The Read NVCM/CFG/Read NVCM1/UFM command is transmit-
ted to the MachXO3. As can be seen in Figure 26, all interfaces return the page at the Page Address Pointer imme-
diately. For single-page read operations, all configuration ports are allowed to terminate the read immediately
following the transfer of the final byte of the first page. The I2C interface differs only in the Read NVCM/CFG/Read
NVCM1/UFM operand bytes.

Reading more than one page requires special handling. The multiple page read duplicates the page selected by
the Page Address Pointer. The result of this behavior is that the page count must be one greater than the desired
number of pages. For example, reading two pages requires the page count supplied in the Read NVCM/CFG/Read
NVCM1/UFM command to be assigned a value of 3. If the Page Address Pointer is 0000, the MachXO3 will return
three pages, Page 0, Page 0, and Page 1. A restriction must be observed when using the WISHBONE interface to
read the NVCM or Flash. When reading 13 or more pages, the page count must be set to the maximum (16383
decimal or 0x3FFF). The user logic is not required to read this number of pages and may safely truncate the read
operation after the desired number of pages have been read.

60
MachXO3 Programming and Configuration Usage Guide

The I2C interface has additional overhead when reading NVCM/Flash pages. Reviewing Figure 26 shows how the
data is presented during a multiple page read request. When the page count is three, and the Page Address
Pointer is 0000, the I2C interface will return Page 0, 16 undefined bytes, Page 0, 4 dummy bytes, and Page 1.
Reading the final four dummy bytes is optional.

References
• DS1047, MachXO3 Family Data Sheet

Technical Support Assistance


Submit a technical support case through www.latticesemi.com/techsupport.

Revision History
Date Version Change Summary
August 2017 2.2 Updated Feature Row section. Removed statement regarding program-
mable non-volatile memory space for Feature Row.
Updated NVCM/Flash Programming section. Revised 9400 and 6900
device densities data and footnote in Table 19, Number of Pages of
NVCM/Flash Memory for the MachXO3 Family.
March 2017 2.1 Updated the MachXO3L/LF Features section. In the MachXO3L multi-
time programmability feature, changed “two times” to “nine times”.
Updated the Bitstream/PROM Sizes section.
Revised Table 2, Maximum Configuration Bits.
— Added 121 Ball Package to MachXO3L/LF-640E device.
— Updated values.
Updated the Feature Row section.
— Changed “it can be reprogrammed up to eight times.” to “it can be
programmed nine times.”
— Changed “MachXO3L reserves eight times” to “MachXO3L reserves
nine times”.
December 2016 2.0. Updated WISHBONE Configuration Mode (MachXO3LF Only) section.
Removed reference to Appendix C.
Updated Reading NVCM/Flash Pages section. Added content on
restriction to be observed when using the WISHBONE interface to read
the configuration flash or UFM.
September 2016 1.9 Updated Dual Boot Configuration Mode section. Added paragraph on
the use of Dual Boot Configuration Mode with MachXO3LF SED and
SEC features.

61
MachXO3 Programming and Configuration Usage Guide

Date Version Change Summary


April 2016 1.8 Updated Bitstream/PROM Sizes section. Added bitstream sizes for
MachXO3L/LF-9400 to Table 2, Maximum Configuration Bits.
Updated Feature Row section. Added password security features to
Table 4, MachXO3L Feature Row Elements.
Updated Master SPI Configuration Mode (MSPI) section. Removed “RC
delay to PROGRAMN” workaround.
Updated Dual Boot Configuration Mode section. Mentioned DUAL-
BOOTGOLDEN configuration in introductory paragraph.
Updated Password section.
Updated Bitstream Generation Options section. Added DUALBOOT-
GOLDEN feature.
Updated Security Options section. Added BACKGROUND_RECONFIG
feature.
Updated NVCM/Flash Programming section. Updated Table 19, Num-
ber of Pages of NVCM/Flash Memory for the MachXO3 Family.
Updated MachXO3 NVCM/Flash Programming Flow section. Added
Password shift decision to Figure 20, MachXO3 NVCM/Flash Memory
Programming Flow.
Updated MachXO3 Programming Commands section. Added Password
commands to Table 21, MachXO3 sysCONFIG Programming Com-
mands.
February 2016 1.7 Updated Initialization section. Changed tINTIL to tINITL.
Updated Memory Space Accessibility section. Changed sentence to
“The JTAG port has the ability to access the two memory spaces in
Offline and Transparent mode.”
Updated Self Download Port Pins section. Changed tINTIL to tINITL.
Updated Feature Row section. Added footnote 3 in Table 4, MachXO3
Feature Row Elements.
Updated Dual Boot Configuration Mode section. General content
update.
Updated Slave SPI Mode (SSPI) section.
— Changed sentence to “Reprogramming the NVCM/Flash can be
done using offline or transparent operations.”
— Added paragraph.
Updated I2C Configuration Mode section.
— Changed sentence to “Reprogramming the NVCM/Flash can be
done in offline or in transparent operations.”
Updated JTAG Mode section. Added Transparent Flash bullet.
Updated NVCM/Flash Programming section. Added transparent mode
information.
Updated MachXO3 NVCM/Flash Programming Flow section.
Revised Figure 20, MachXO3 NVCM/Flash Memory Programming Flow
(Steps Start-1 and 3-4).
Updated MachXO3 Programming Commands section.
Revised Table 21, MachXO3 sysCONFIG Programming Commands.
— Added ISC_ENABLE_X command.
— Added Transparent mode in ISC_DISABLE command notes.

62
MachXO3 Programming and Configuration Usage Guide

Date Version Change Summary


April 2015 1.6 Updated Self Download Port Pins section. Added information on the
DONE pin.
Updated Master SPI Configuration Mode (MSPI) section. Added infor-
mation on delaying MachXO3L/LF POR.
— Updated workaround solutions when SPI Flash POR is higher than
the MachXO3L/LF POR.
— Updated Figure 10, RC Delay.
Updated MachXO3 Slave SPI/I2C SRAM Configuration Flow section.
— Revised Figure 21, MachXO3 Slave SPI/I2C SRAM Configuration
Flow.
— Added Figure 24, Slave SPI/I2C SRAM Read Status Register Flow.
Updated Technical Support Assistance section.
March 2015 1.5 General updates:
— Product name/trademark adjustment.
— Added MachXO3LF support.
— Added UFM support.
Updated MachXO3L/LF Features section. Added MachXO3LF features.
Updated Definition of Terms section. Added Internal Flash Memory and
Transparent Mode (MachXO3LF) definitions.
Updated Memory Space Accessibility section. In Table 1, Memory
Space Accessibility of Different Ports, Internal WISHBONE
(MachXO3LF) port information is added.
Added On-chip Flash Programming (MachXO3LF Only) section
Updated Bitstream/PROM Sizes section.
— Added information on storing configuration data in MachXO3LF
Flash memory.
— Added Figure 3, Flash Memory Space of a MachXO3LF Device.
— Updated Table 2, Maximum Configuration Bits. Revised device
names.
Updated Memory Space Accessibility section. In Table 5,
MachXO3L/LF Programming and Configuration Ports, Internal interface
information is added.
Updated Dual Boot Configuration Mode section. Added MachXO3LF
information.
Added WISHBONE Configuration Mode (MachXO3LF Only) section.
Updated Bitstream Generation Options section. Added CFG_EBRUFM
(MachXO3LF) and CFGUFM (MachXO3LF) descriptions.
Added MachXO3 Slave SPI SRAM Configuration Flow section.
Updated I2C Configuration Mode section. Added new EFB instantiation
requirement for I2C configuration port access per Product Bulletin
PB1412.
Updated MachXO3 NVCM/Flash Programming Flow section. Revised
Figure 21, MachXO3 Slave SPI SRAM Configuration Flow:
— Added notes regarding EFB instantiation requirement for I2C configu-
ration port access.
Updated MachXO3 Programming Commands section. Revised
Table 21, MachXO3 sysCONFIG Programming Commands. Added
Configure SRAM [LSC_BITSTREAM_BURST] command.
October 2014 1.4 Updated Reading NVCM Pages section. Added information on retrieval
delay.

63
MachXO3 Programming and Configuration Usage Guide

Date Version Change Summary


September 2014 1.3 Updated Feature Row section.
— Added Figure 3, Feature Row Example.
— Added Table 3, Feature Row Option and Diamond Spreadsheet
View.
— Updated Table 4, MachXO2 Feature Row Elements. Changed I2C
Slave Address feature to I2C Programmable Primary Configuration
Address and updated default mode state information.
July 2014 1.2 Product name/trademark adjustment.
Updated MachXO3L Features and Definition of Terms sections.
Removed background programming information.
Updated Memory Space Accessibility section. Removed reference to
Transparent mode.
Updated Table 2, Maximum Configuration Bits. Added devices.
Updated Table 3, MachXO3L Feature Row Elements. Revised feature to
Config NVCM OTP.
Updated Table 5, Default State of the sysCONFIG Pins. Revised PRO-
GRAMN pin information.
Updated Table 6, Default State in Diamond for Each Port. Revised
SLAVE_SPI_PORT default state.
Updated Master SPI Configuration Mode (MSPI) section. Added infor-
mation on SPI Flash POR and MachXO3L POR conditions. Added
Figure 8, RC Delay.
Updated Slave SPI Mode (SSPI) section. Removed reference to trans-
parent operations.
Updated I2C Configuration Mode section. Revised NVCM and Feature
Row programming information.
Updated JTAG Mode section. Removed reference to transparent NVCM
programming.
Added Software Selectable Options section.
Added Advanced Configuration Information section.
Updated Figure 16, JEDEC File Example. Revised NOTE DEVICE
NAME to LCMXO3L-1300E-6CSFBGA256.
April 2014 01.1 Corrected typos.
February 2014 01.0 Initial release.

64

You might also like