Max2 Mii51010
Max2 Mii51010
Max2 Mii51010
MII51010-1.8
Introduction
MAX® II devices feature a user flash memory (UFM) block that can be used similar to
a serial EEPROM for storing non-volatile information up to 8 Kbits. The UFM
provides an ideal storage solution supporting any possible protocol for interfacing
(SPI, parallel, and other protocols) through bridging logic designed into the MAX II
logic array.
This chapter provides guidelines for UFM applications by describing the features and
functionality of the MAX II UFM block and the Quartus® II altufm megafunction.
This chapter contains the following sections:
■ “UFM Array Description” on page 9–1
■ “UFM Functional Description” on page 9–3
■ “UFM Operating Modes” on page 9–9
■ “Programming and Reading the UFM with JTAG” on page 9–12
■ “Software Support for UFM Block” on page 9–13
■ “Creating Memory Content File” on page 9–40
■ “Simulation Parameters” on page 9–46
For more details about the logic array interface options in the altufm megafunction,
refer to “Software Support for UFM Block” on page 9–13.
1 The UFM block is accessible through the logic array interface as well as the JTAG
interface. However, the UFM logic array interface does not have access to the CFM
block.
UFM Block
OSC _: 4
OSC_ENA OSC
9 UFM Sector 1
ARCLK
UFM Sector 0
Address
Register
16 16
ARSHFT
ARDin
DRCLK
DRSHFT
Table 9–4 summarizes the MAX II UFM block input and output interface signals.
f To see the interaction between the UFM block and the logic array of MAX II devices,
refer to the MAX II Architecture chapter in the MAX II Device Handbook (Figure 2–16 for
EPM240 devices and Figure 2–17 for EPM570, EPM1270, and EPM2210 devices).
Figure 9–2. Selection of the UFM Sector Using the MSB of the Address Register
Sector 0
1
LSB MSB UFM Block
ARClk Sector 1
Three control signals exist for the address register: ARSHFT, ARCLK, and ARDin.
ARSHFT is used as both a shift-enable control signal and an auto-increment signal. If
the ARSHFT signal is high, a rising edge on ARCLK will load address data serially from
the ARDin port and move data serially through the register. A clock edge with the
ARSHFT signal low increments the address register by 1. This implements an auto-
increment of the address to allow data streaming. When a program, read, or an erase
sequence is executing, the address that is in the address register becomes the active
UFM location.
16 16
Data Register
DRDin DRDout
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15
DRCLK
LSB MSB
Oscillator
OSC_ENA, one of the input signals in the UFM block, is used to enable the oscillator
signal to output through the OSC output port. You can use this OSC output port to
connect with the interface logic in the logic array. It can be routed through the logic
array and fed back as an input clock for the address register (ARCLK) and the data
register (DRCLK). The output frequency of the OSC port is one-fourth that of the
oscillator frequency. As a result, the frequency range of the OSC port is 3.3 to 5.5 MHz.
The maximum clock frequency accepted by ARCLK and DRCLK is 10 MHz and the
duty cycle accepted by the DRCLK and ARCLK input ports is approximately 45% to
50%.
When the OSC_ENA input signal is asserted, the oscillator is enabled and the output is
routed to the logic array through the OSC output. When the OSC_ENA is set low, the
OSC output drives constant low. The routing delay from the OSC port of the UFM
block to OSC output pin depends on placement. You can analyze this delay using the
Quartus II timing analyzer.
1 During real-time ISP operation, the internal oscillator automatically enables and
outputs through the OSC output port (if this port is instantiated) even though the
OSC_ENA signal is tied low. You can use the RTP_BUSY signal to detect the beginning
and ending of the real-time ISP operation for gated control of this self-enabled OSC
output condition.
1 The internal oscillator is not enabled all the time. The internal oscillator for the
program/erase operation is only activated when the flash memory block is being
programmed or erased. During the READ operation, the internal oscillator is activated
whenever the flash memory block is reading data.
Figure 9–5. Selecting the altufm_osc Megafunction in the MegaWizard Plug-In Manager
Figure 9–6 shows page 3 of the IO/MAX II oscillator megafunction. You have an
option to choose to simulate the OSC output port at its maximum or minimum
frequency during the design simulation. The frequency chosen is only used as a
timing parameter simulation and does not affect the real MAX II device OSC output
frequency.
1 You can program the UFM and CFM blocks independently without overwriting the
other block which is not programmed. The Quartus II programmer provides the
options to program the UFM and CFM blocks individually or together (the entire
MAX II Device).
f Refer to the In-System Programmability Guidelines for MAX II Devices chapter in the
MAX II Device Handbook for guidelines about using ISP and real-time ISP while
utilizing the UFM block within your design.
f Refer to the MAX II Architecture chapter in the MAX II Device Handbook for a complete
description of the device architecture, and for the specific values of the timing
parameters listed in this chapter.
Read/Stream Read
The three control signals, PROGRAM, ERASE, and BUSY are not required during read or
stream read operation. To perform a read operation, the address register has to be
loaded with the reference address where the data is or is going to be located in the
UFM. The address register can be stopped from incrementing or shifting addresses
from ARDin by stopping the ARCLK clock pulse. DRSHFT must be asserted low at the
next rising edge of DRCLK to load the data from the UFM to the data register. To shift
the bits from the register, 16 clock pulses have to be provided to read 16-bit wide data.
You can use DRCLK to control the read time or disable the data register by
discontinuing the DRCLK clock pulse. Figure 9–7 shows the UFM control waveforms
during read mode.
The UFM block can also perform stream read operation, reading continuously from
the UFM using the address increment feature. Stream read mode is started by loading
the base address into the address register. DRSHFT must then be asserted low at the
first rising edge of DRCLK to load data into the data register from the address pointed
to by the address register. DRSHFT will then assert high to shift out the 16-bit wide
data with the MSB out first. Figure 9–8 shows the UFM control waveforms during
stream read mode.
DRShft tADS
tDCLK 16 Data Bits tDSH
tDSS
DRClk
DRDin tDCO
DRDout
OSC_ENA
Program
Erase
Busy
ARDin
DRDin
DRDout
OSC_ENA
Program
Erase
Busy
Program
To program or write to the UFM, you must first perform a sequence to load the
reference address into the address register. DRSHFT must then be asserted high to load
the data serially into the data register starting with the MSB. Loading an address into
the address register and loading data into the data register can be done concurrently.
After the 16 bits of data have been successfully shifted into the data register, the
PROGRAM signal must be asserted high to start writing to the UFM. On the rising edge,
the data currently in the data register is written to the location currently in the address
register. The BUSY signal is asserted until the program sequence is completed. The
data and address register should not be modified until the BUSY signal is de-asserted,
or the flash content will be corrupted. The PROGRAM signal is ignored if the BUSY
signal is asserted. When the PROGRAM signal is applied at exactly the same time as the
ERASE signal, the behavior is undefined and the contents of flash is corrupted.
Figure 9–9 shows the UFM waveforms during program mode.
DRDin
tDDH
tDDS
DRDout
tOSCS tOSCH
OSC_ENA
Program
Busy
tPPMX
Erase
The ERASE signal initiates an erase sequence to erase one sector of the UFM. The data
register is not needed to perform an erase sequence. To indicate the sector of the UFM
to be erased, the MSB of the address register should be loaded with 0 to erase the
UFM sector 0, or 1 to erase the UFM sector 1 (Figure 9–2 on page 9–5). On a rising
edge of the ERASE signal, the memory sector indicated by the MSB of the address
register will be erased. The BUSY signal is asserted until the erase sequence is
completed. The address register should not be modified until the BUSY signal is de-
asserted to prevent the content of the flash from being corrupted. This ERASE signal
will be ignored when the BUSY signal is asserted. Figure 9–10 illustrates the UFM
waveforms during erase mode.
1 When the UFM sector is erased, it has 16-bit locations all filled with FFFF. Each UFM
storage bit can be programmed no more than once between erase sequences. You can
write to any word up to two times as long as the second programming attempt at that
location only adds 0s. 1s are mask bits for your input word that cannot overwrite 0s in
the flash array. New 1s in the location can only be achieved by an erase. Therefore, it is
possible for you to perform byte writes since the UFM array is 16 bits for each
location.
DRClk
DRDin
DRDout
OSC_ENA
tOSCS
Program tOSCH
Erase
Busy tEB tBE
tEPMX
1 The POF, Jam File, or JBC File can be generated using the Quartus II software.
Jam Files
Both Jam STAPL and JBC files support programming for the UFM block.
Jam Players
Jam Players read the descriptive information in Jam files and translate them into data
that programs the target device. Jam Players do not program a particular device
architecture or vendor; they only read and understand the syntax defined by the Jam
file specification. In-field changes are confined to the Jam file, not the Jam Player. As a
result, you do not need to modify the Jam Player source code for each in-field
upgrade.
There are two types of Jam Players to accommodate the two types of Jam files: an
ASCII Jam STAPL Player and a Jam STAPL Byte-Code Player. Both ASCII Jam STAPL
Player and Jam STAPL Byte-Code Player are coded in the C programming language
for 16-bit and 32-bit processors.
f For guidelines on UFM operation during ISP, refer to the In-System Programmability
Guidelines for MAX II Devices chapter in the MAX II Device Handbook.
The altufm MegaWizard Plug-In Manager has separate pages that apply to the MAX
II UFM block. During compilation, the Quartus II Compiler verifies the altufm
parameters selected against the available logic array interface options, and any
specific assignments.
Inter-Integrated Circuit
Inter-Integrated Circuit (I2C) is a bidirectional two-wire interface protocol, requiring
only two bus lines; a serial data/address line (SDA), and a serial clock line (SCL).
Each device connected to the I2C bus is software addressable by a unique address. The
I2C bus is a multi-master bus where more than one integrated circuit (IC) capable of
initiating a data transfer can be connected to it, which allows masters to function as
transmitters or receivers.
The altufm_i2c megafunction features a serial, 8-bit bidirectional data transfer up to
100 Kbits per second. With the altufm_i2c megafunction, the MAX II UFM and logic
can be configured as a slave device for the I2C bus. The altufm megafunction’s I2C
interface is designed to function similar to I2C serial EEPROMs.
I2C Protocol
The following defines the characteristics of the I2C bus protocol:
■ Only two bus lines are required: SDA and SCL. Both SDA and SCL are
bidirectional lines which remain high when the bus is free.
■ Data transfer can be initiated only when the bus is free.
■ The data on the SDA line must be stable during the high period of the clock. The
high or low state of the data line can only change when the clock signal on the SCL
line is low.
■ Any transition on the SDA line while the SCL is high is one such unique case
which indicates a start or stop condition.
Table 9–5 summarizes the altufm_i2c megafunction input and output interface
signals.
SDA SDA
SCL SCL
S P
Acknowledge
Acknowledged data transfer is a requirement of I2C. The master must generate a clock
pulse to signify the acknowledge bit. The transmitter releases the SDA line (high)
during the acknowledge clock pulse.
The receiver (slave) must pull the SDA line low during the acknowledge clock pulse
so that SDA remains a stable low during the clock high period, indicating positive
acknowledgement from the receiver. If the receiver pulls the SDA line high during the
acknowledge clock pulse, the receiver sends a not-acknowledge condition indicating
that it is unable to process the last byte of data. If the receiver is busy (for example,
executing an internally-timed erase or write operation), it will not acknowledge any
new data transfer. Figure 9–13 shows the acknowledge condition on the I2C bus.
Data Output
By Transmitter
Not Acknowledge
Data Output
By Receiver
Acknowledge
SCL From
Master
S
Clock Pulse For
Start Condition Acknowledgement
Device Addressing
After the start condition, the master sends the address of the particular slave device it
is requesting. The four most significant bits (MSBs) of the 8-bit slave address are
usually fixed while the next three significant bits (A2, A1, A0) are device address bits
and define which device the master is accessing. The last bit of the slave address
specifies whether a read or write operation is to be performed. When this bit is set to
1, a read operation is selected. When this bit is set to 0, a write operation is selected.
The four MSBs of the slave address (A6, A5, A4, A3) are programmable and can be
defined on page 3 of the altufm MegaWizard Plug-In Manager. The default value for
these four MSBs is 1010. The next three significant bits are defined using the three A2,
A1, A0 input ports of the altufm_i2c megafunction. You can connect these ports to
input pins in the design file and connect them to switches on the board. The other
option is to connect them to VCC and GND primitives in the design file, which
conserves pins. Figure 9–14 shows the slave address bits.
MSB LSB
MSB LSB
After the master sends a start condition and the slave address byte, the altufm_i2c
logic monitors the bus and responds with an acknowledge (on the SDA line) when its
address matches the transmitted slave address. The altufm_i2c megafunction then
performs a read or write operation to/from the UFM, depending on the state of the
bit.
Acknowledge Polling
The master can detect whether the internal write cycle is completed by polling for an
acknowledgement from the slave. The master can resend the start condition together
with the slave address as soon as the byte write sequence is finished. The slave does
not acknowledge if the internal write cycle is still in progress. The master can repeat
the acknowledge polling and can proceed with the next instruction after the slave
acknowledges.
Write Protection
The altufm_i2c megafunction includes an optional Write Protection (WP) port
available on page 4 of the altufm MegaWizard Plug-In Manager (see Figure 9–24 on
page 9–24). In the MegaWizard Plug-In Manager, you can choose the WP port to
protect either the full or upper half memory.
When WP is set to 1, the upper half or the entire memory array (depending on the
write protection level selected) is protected, and the write and erase operation is not
allowed. In this case the altufm_i2c megafunction acknowledges the slave address
and memory address. After the master transfers the first data byte, the altufm_i2c
megafunction sends a not-acknowledge condition to the master to indicate that the
instruction will not execute. When WP is set to 0, the write and erase operations are
allowed.
Erase Operation
Commercial serial EEPROMs automatically erase each byte of memory before writing
into that particular memory location during a write operation. However, the MAX II
UFM block is flash based and only supports sector erase operations and not byte erase
operations. When using read/write mode, a sector or full memory erase operation is
required before writing new data into any location that previously contained data.
The block cannot be erased when the altufm_i2c megafunction is in read-only mode.
Data can be initialized into memory for read/write and read-only modes by including
a memory initialization file (.mif) or hexidecimal file (.hex) in the altufm MegaWizard
Plug-In Manager. This data is automatically written into the UFM during device
programming by the Quartus II software or third-party programming tool.
The altufm_i2c megafunction supports four different erase operation methods shown
on page 4 of the altufm MegaWizard Plug-In Manager:
■ Full Erase (Device Slave Address Triggered)
■ Sector Erase (Byte Address Triggered)
■ Sector Erase (A2 Triggered)
■ No Erase
These erase options only work as described if that particular option is selected in the
MegaWizard Plug-In Manager before compiling the design files and programming
the device. Only one option is possible for the altufm_i2c megafunction.
Erase options are discussed in more detail in the following sections.
Figure 9–16. Full Erase Sequence Triggered Using the Slave Address
Slave Address
S R/W A P
A6A5A4A3111
Slave Address
S R/W A Byte Address A P
A2 = '1'
No Erase
The no erase operation never erases the UFM contents. This method is recommended
when UFM does not require constant re-writing after its initial write of data. For
example, if the UFM data is to be initialized with data during manufacturing using
I2C, you may not require writing to the UFM again. In that case, you should use the no
erase option and save logic element (LE) resources from being used to create erase
logic.
Read Operation
The read operation is initiated in the same manner as the write operation except that
the R/W bit must be set to 1. Three different read operations are supported:
■ Current Address Read (Single Byte)
■ Random Address Read (Single byte)
■ Sequential Read (Multi-Byte)
After each UFM data has been read and transferred to the master, the UFM address
register is incremented for all single and multi-byte read operations.
‘1’ (read)
S – Start Condition From Master to Slave
P – Stop Condition
A – Acknowledge From Slave to Master
Sequential Read
Sequential read operation can be initiated by either the current address read operation
or the random address read operation. Instead of sending a stop condition after the
Slave has transmitted one byte of data to the master, the master acknowledges that
byte and sends additional clock pulses (on SCL line) for the slave to transmit data
bytes from consecutive byte addresses. The operation is terminated when the master
generates a stop condition instead of responding with an acknowledge. Figure 9–20
shows the sequential read sequence.
SDA
tSCLSDA
SCL tHIGH
tLOW
Table 9–6 through Table 9–8 list the timing specification needed for the altufm_i2c
megafunction read/write mode.
Table 9–6. I2C Interface Timing Specification
Symbol Parameter Min Max Unit
FSCL SCL clock frequency — 100 kHz
tSCL:SDA SCL going low to SDA data out — 15 ns
tBUF Bus free time between a stop and start condition 4.7 — µs
tHD:STA (Repeated) start condition hold time 4 — µs
tSU:STA (Repeated) start condition setup time 4.7 — µs
tLOW SCL clock low period 4.7 — µs
tHIGH SCL clock high period 4 — µs
tHD:DAT SDA data in hold time 0 — ns
tSU:DAT SDA data in setup time 20 — ns
tSU:STO STOP condition setup time 4 — ns
Figure 9–22. altufm Megafunction Symbol For the I2C Interface Instantiation in the Quartus II
Software
Figure 9–23 shows page 3 of the altufm MegaWizard Plug-In Manager when selecting
I2C as the interface. On this page, you can choose whether to implement the
read/write mode or read-only mode for the UFM. You also have an option to choose
the memory size for the altufm_i2c megafunction as well as defining the four MSBs of
the slave address (default 1010).
1 The UFM block’s internal oscillator is always running when the altufm_i2c
megafunction is instantiated for both read-only and read/write interfaces.
Figure 9–24 shows page 4 of the altufm MegaWizard Plug-In Manager. You can select
the optional write protection and erase operation methods on this page.
Data transmitted to the SI port of the slave device is sampled by the slave device at
the positive SCK clock. Data transmits from the slave device through SO at the
negative SCK clock edge. When nCS is asserted, it means the current device is being
selected by the master device from the other end of the SPI bus for service. When nCS
is not asserted, the SI and SCK ports should be blocked from receiving signals from
the master device, and SO should be in High Impedance state to avoid causing
contention on the shared SPI bus. All instructions, addresses, and data are transferred
with the MSB first and start with high-to-low nCS transition. The circuit diagram is
shown in Figure 9–25.
Figure 9–25. Circuit Diagram for SPI Interface Read or Write Operations
SI SO SCK nCS
Op-Code Decoder
Opcodes
The 8-bit instruction opcode is shown in Table 9–10. After nCS is pulled low, the
indicated opcode must be provided. Otherwise, the interface assumes that the master
device has internal logic errors and ignores the rest of the incoming signals. Once nCS
is pulled back to high, the interface is back to normal. nCS should be pulled low again
for a new service request.
The READ and WRITE opcodes are instructions for transmission, which means the data
will be read from or written to the UFM.
WREN, WRDI, RDSR, and WRSR are instructions for the status register, where they do
not have any direct interaction with UFM, but read or set the status register within the
interface logic. The status register provides status on whether the UFM block is
available for any READ or WRITE operation, whether the interface is WRITE enabled,
and the state of the UFM WRITE protection. The status register format is shown in
Table 9–11. For the read only implementation of ALTUFM SPI (Base or Extended
mode), the status register does not exist, saving LE resources.
READ
READ is the instruction for data transmission, where the data is read from the UFM
block. When data transfer is taking place, the MSB is always the first bit to be
transmitted or received. The data output stream is continuous through all addresses
until it is terminated by a low-to-high transition at the nCS port. The READ operation
is always performed through the following sequence in SPI, as shown in Figure 9–26:
nCS
0 1 2 3 4 5 6 7 8 9 10 11 20 21 22 23 24 25 26 27 36 37 38 39
SCK
8-bit 16-bit
Instruction Address
SI 03H
MSB MSB
High Impendance
SO 16-bit Data Out 1 16-bit Data Out 2
MSB MSB
Figure 9–27 shows the READ operation sequence for Base mode.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 23
SCK
8-bit 8-bit
Instruction Instruction
SI 03H
MSB MSB
High Impendance
MSB MSB
WRITE
WRITE is the instruction for data transmission, where the data is written to the UFM
block. The targeted location in the UFM block that will be written must be in the
erased state (FFFFH) before initiating a WRITE operation. When data transfer is taking
place, the MSB is always the first bit to be transmitted or received. nCS must be driven
high before the instruction is executed internally. You may poll the nRDY bit in the
software status register for the completion of the internal self-timed WRITE cycle. For
SPI Extended mode, the WRITE operation is always done through the following
sequence, as shown in Figure 9–28:
1. nCS is pulled low to indicate the start of transmission.
2. An 8-bit WRITE opcode (00000010) is received from the master device. If internal
programming is in progress, the WRITE operation is ignored and not accepted.
3. A 16-bit address is received from the master device. The LSB of the address will be
received last. As the UFM block can take only nine bits of address maximum, the
first seven address bits received are discarded.
4. A check is carried out on the status register (see Table 9–11) to determine if the
WRITE operation has been enabled, and the address is outside of the protected
region; otherwise, Step 5 is bypassed.
5. One word (16 bits) of data is transmitted to the slave device through SI.
6. nCS is pulled back to high to indicate the end of transmission.
For SPI Base mode, the WRITE operation is always performed through the following
sequence in SPI:
1. nCS is pulled low to indicate the start of transmission.
2. An 8-bit WRITE opcode (00000010) is received. If the internal programming is in
progress, the WRITE operation is ignored and not accepted.
3. An 8-bit address is received. A check is carried out on the status register (see
Table 9–11) to determine if the WRITE operation has been enabled, and the address
is outside of the protected region; otherwise, Step 4 is skipped.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 23
SCK
8-bit 8-bit
Instruction Instruction
SI 03H
MSB MSB
High Impendance
MSB MSB
Figure 9–29 shows the WRITE operation sequence for Base mode.
nCS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
SCK
8-bit 8-bit
Instruction Address
High Impendance
SO
SECTOR-ERASE
SECTOR-ERASE is the instruction of erasing one sector of the UFM block. Each sector
contains 256 words. WEN bit and the sector must not be protected for SE operation to
be successful. nCS must be driven high before the instruction is executed internally.
You may poll the nRDY bit in the software status register for the completion of the
internal self-timed SECTOR-ERASE cycle. For SPI Extended mode, the SE operation is
performed in the following sequence, as shown in Figure 9–30:
1. nCS is pulled low.
2. Opcode 00100000 is transmitted into the interface.
3. The 16-bit address is sent. The eighth bit (the first seven bits will be discarded) of
the address indicates which sector is erased; a 0 means sector 0 (UFM0) is erased,
and a 1 means sector 1 (UFM1) is erased.
nCS
0 1 2 3 4 5 6 7 8 9 10 11 20 21 22 23
SCK
8-bit 16-bit
Instruction Address
SI 20H
MSB MSB
High Impendance
SO
Figure 9–31 shows the SECTOR-ERASE operation sequence for Base mode.
nCS
0 1 2 3 4 5 6 7
SCK
8-bit
Instruction
SI 20H
MSB
High Impendance
SO
UFM-ERASE
The UFM-ERASE (CE) instruction erases both UFM sector 0 and sector 1 for SPI
Extended Mode. While for SPI Base mode, the CE instruction has the same
functionality as the SECTOR-ERASE (SE) instruction, which erases UFM sector 0 only.
WEN bit and the UFM sectors must not be protected for CE operation to be successful.
nCS must be driven high before the instruction is executed internally. You may poll
the nRDY bit in the software status register for the completion of the internal self-
timed CE cycle. For both SPI Extended mode and Base mode, the UFM-ERASE
operation is performed in the following sequence as shown in Figure 9–32:
1. nCS is pulled low.
2. Opcode 01100000 is transmitted into the interface.
3. nCS is pulled back to high.
Figure 9–32 shows the UFM-ERASE operation sequence.
nCS
0 1 2 3 4 5 6 7
SCK
8-bit
Instruction
SI 60H
MSB
High Impendance
SO
nCS
0 1 2 3 4 5 6 7
SCK
8-bit
Instruction
SI 06H
MSB
High Impendance
SO
nCS
0 1 2 3 4 5 6 7
SCK
8-bit
Instruction
SI 04H
MSB
High Impendance
SO
internal program cycle in the UFM, RDSR is the only valid opcode recognized by the
interface (therefore, the status register can be read at any time), and nRDY is the only
valid status bit. Other status bits are frozen and remain unchanged until the internal
program cycle is ended. RDSR is issued through the following sequence, as shown in
Figure 9–35:
1. nCS is pulled low.
2. Opcode 00000101 is transmitted into the interface.
3. SI ignores incoming signals; SO output the content of the status register, Bit 7
first and Bit 0 last.
4. If nCS is kept low, repeat step 3.
5. nCS is pulled back to high to terminate the transmission.
nCS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
SCK
8-bit
Instruction
SI 05H
MSB MSB
High Impendance
SO Status Register Out
MSB MSB
nCS
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
SCK
8-bit
Instruction
High Impendance
SO
tHNCSHIGH
nCS
tSCK2NCS tNCS2SCK
SCK
You can select the desired logic array interface on page 3 of the altufm MegaWizard®
Plug-In Manager. Figure 9–39 shows page 3 of the altufm MegaWizard Plug-In
Manager, selecting SPI as the interface protocol. On this page, you can choose whether
to implement the Read/Write or Read Only mode as the access mode for the UFM.
You can also select the configuration mode (Base or Extended) for SPI on this page.
You can specify the initial content of the UFM block in page 4 of the altufm
MegaWizard Plug-In Manager as discussed in “Creating Memory Content File” on
page 9–40.
1 The UFM block’s internal oscillator is always running when the altufm_spi
megafunction is instantiated for read/write interface. The UFM block’s internal
oscillator is disabled when the altufm_spi megafunction is instantiated for read
only interface.
Parallel Interface
This interface allows for parallel communication between the UFM block and outside
logic. Once the READ request, WRITE request, or ERASE request is asserted (active low
assertion), the outside logic or device (such as a microcontroller) are free to continue
their operation while the data in the UFM is retrieved, written, or erased. During this
time, the nBUSY signal is driven “low” to indicate that it is not available to respond to
any further request. After the operation is complete, the nBUSY signal is brought back
to “high” to indicate that it is now available to service a new request. If it was the
Read request, the DATA_VALID is driven “high” to indicate that the data at the DO port
is the valid data from the last read address.
Asserting READ, WRITE, and ERASE at the same time is not allowed. Multiple requests
are ignored and nothing is read from, written to, or erased in the UFM block. There is
no support for sequential read and page write in the parallel interface. For both the
read only and the read/write modes of the parallel interface, OSC_ENA is always
asserted, enabling the internal oscillator. Table 9–15 summarizes the parallel interface
pins and functions.
Even though the altufm megafunction allows you to select the address widths range
from 3 bits to 9 bits, the UFM block always expects full 9 bits width for the address
register. Therefore, the altufm megafunction will always pad the remaining LSB of the
address register with '0's if the register width selected is less than 9 bits. The address
register will point to sector 0 if the address received at the address register starts with
a '0'. The address register will point to sector 1 if the address received starts with a '1'.
Even though you can select an optional data register width of 3 to 16 bits using the
altufm megafunction, the UFM block always expects full 16 bits width for the data
register. Reading from the data register always proceeds from MSB to LSB. The altufm
megafunction always pads the remaining LSB of the data register with 1s if the user
selects a data width of less than 16-bits.
Command
tHNBUSY
nBusy
tHBUS
Figure 9–42 shows page 3 of the altufm MegaWizard Plug-In Manager, selecting the
Parallel Interface as the interface. On this page, you can choose whether to implement
the Read/Write mode or Read Only mode for the UFM. You also have an option to
choose the width for address bus (up to 9 bits) and for the data bus (up to 16 bits). You
can specify the initial content of the UFM block on page 4 of the altufm MegaWizard
Plug-In Manager as discussed in “Creating Memory Content File” on page 9–40.
1 The UFM block’s internal oscillator is always running when the altufm_parallel
magafunction is instantiated for read/write interface. The UFM block’s internal
oscillator is disabled when the altufm_parallel megafunction is instantiated for read
only interface.
Figure 9–44 shows page 3 of the altufm MegaWizard Plug-In Manager, selecting none
for the interface protocol. By selecting none, all the other options are grayed out or
unavailable to you. However, you still can specify the initial content of the UFM block
on page 4 of the altufm MegaWizard Plug-In Manager as discussed in “Creating
Memory Content File” on page 9–40.
Immediately after clicking OK, a dialog box appears. In this dialog box, the Number
of words represents the numbers of address lines while the Word size represents the
data width. To create a memory content file for the altufm megafunction, enter 512
for the number of words and 16 for the word size, as shown in Figure 9–46.
Figure 9–47 shows the memory content being written into a HEX file.
This memory content file is then included using the altufm megafunction. On the
Tools menu, click MegaWizard Plug-In Manager. The memory content file (data.hex)
is included on page 5 of the altufm megafunction (Figure 9–48). Click Yes, and use this
file for the memory content file. Click Browse to include the memory content file.
1 This specification applies only to HEX files used with the parallel interface. MIFs do
not require you to fully specify 16 bits for each data word. However, both MIF and
HEX files require you to specify all addresses of data according to the
address_width selected in the megafunction.
17Fh
80h This section of the UFM is unused –
the MIF/HEX file contents should be set to
all '1' for addresses 080h to 17Fh
7Fh
080h
Lower Half – Addresses
00h to 7Fh 07Fh
Address 00h in logical memory maps to
address 000h in the MIF/HEX file. Address 7Fh in
logical memory maps to 07Fh in the MIF/HEX file,
00h and all data in between follows the order in the
logical memory
000h
100h 100h
FFh 0FFh
00h 000h
1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1
8-bit valid data to be placed Pad the lower byte with eight '1's
in the upper byte
Simulation Parameters
Figure 9–48 on page 9–43 shows page 4 of the altufm megafunction where you can
have an option to choose to simulate the OSC output port at the maximum or the
minimum frequency during the design simulation. The frequency chosen is only used
as the timing parameter for the Quartus II simulator and does not affect the real MAX
II device OSC output frequency.
Conclusion
The MAX II UFM block is a user-accessible, programmable non-volatile flash memory
block that provides significant flexibility in its interfacing. MAX II devices fill the
need for on-board non-volatile storage in any application, minimizing board space
and reducing total system cost.
Referenced Documents
This chapter references the following documents:
■ In-System Programmability Guidelines for MAX II Devices chapter in the MAX II
Device Handbook
■ MAX II Architecture chapter in the MAX II Device Handbook