Machxo3 Programming and Configuration Usage Guide: August 2017 Technical Note Tn1279
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
PROGRAMN or
Initialization INITN=Low
INITN Released
Device refresh:
• PROGRAMN falling edge
• IEEE 1532 REFRESH command
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:
* 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.
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 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:
5
MachXO3 Programming and Configuration Usage Guide
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.
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.
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.
128 Bits
Usercode
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
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.
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.
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.
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.
10
MachXO3 Programming and Configuration Usage Guide
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
INITN
PROGRAMN
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:
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
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:
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
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
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.
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.
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.
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.
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.
MachXO3L MachXO3L
VCCIO
JTAGENB = ‘1’
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.
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:
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:
INITN
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
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:
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 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 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.
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.
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
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.
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.
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.
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.
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:
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
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
System running
Assume MachXO3L
NVCM has been
programmed and
Program SPI PROM
1 running
with new pattern
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:
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:
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.
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:
28
MachXO3 Programming and Configuration Usage Guide
Figure 17. sysCONFIG Preferences in Global Preferences Tab, Diamond Spreadsheet View
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.
• 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.
• 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
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:
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:
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.
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.
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.
MCLK
DONE BIT
GLOBAL SET/RESET
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.
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
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>);
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.
37
MachXO3 Programming and Configuration Usage Guide
38
MachXO3 Programming and Configuration Usage Guide
39
MachXO3 Programming and Configuration Usage Guide
40
MachXO3 Programming and Configuration Usage Guide
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)
Yes Yes
Erase NVCM/Flash
NVCM0/NVCM1/FR or
CFG/UFM/FR (0x0E)
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
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
Check No Delay
Busy? 200 µs
Yes
Transmit Read Busy
Flag (0xF0) or Read
Status Register
Command (0x3C)
Yes
Busy?
No
Yes Clean
Fail?
Up
No
No Verify
Usercode?
Yes
Usercode No Clean
OK? Up
Yes
Verify No
NVCM0/
CFG?
Yes
43
MachXO3 Programming and Configuration Usage Guide
3
Transmit Read
(Contined from
Command with
Previous Page)
Number of Pages
(0x73)
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
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
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
FEABITS No Clean
OK? Up
Transmit
Program
Program DONE
Done
Command (0x5E)
Check No Delay
Busy? 200 µs
Yes
Yes
Busy?
No
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
Yes
Busy?
No
Program
OTP Fuses?
Transmit Program
OTP Command (0xF9)
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)
Yes
Busy?
No
Transmit Refresh
Command (0x79)
48
MachXO3 Programming and Configuration Usage Guide
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
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
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
Stop SP/SH
(Error)
Yes
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
54
MachXO3 Programming and Configuration Usage Guide
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
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 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.
57
MachXO3 Programming and Configuration Usage Guide
58
MachXO3 Programming and Configuration Usage Guide
59
MachXO3 Programming and Configuration Usage Guide
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.
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
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
62
MachXO3 Programming and Configuration Usage Guide
63
MachXO3 Programming and Configuration Usage Guide
64