Chapter 9: Using User Flash Memory in MAX II Devices
9–17
Software Support for UFM Block
Figure 9–15. Byte Write Sequence
S
Slave Address
A
Byte Address
A
Data
A
P
R/W
"0" (write)
From Master to Slave
From Slave to Master
S – Start Condition
P – Stop Condition
A – Acknowledge
Page Write Operation
Page write operation has a similar sequence as the byte write operation, except that a
number of bytes of data are transmitted in sequence before the master issues a stop
condition. The internal write from the MAX II logic array to the UFM begins only after
the master generates a stop condition. While the UFM internal write cycle is in
progress, the altufm_i2c logic ignores any attempt made by the master to initiate a
new transfer. The altufm_i2c megafunction allows you to choose the page size of 8
bytes, 16 bytes, or 32 bytes for the page write operation, as shown in Figure 9–24 on
page 9–24.
A write operation is only possible on an erased UFM block or word location. The
UFM block differs from serial EEPROMs, requiring an erase operation prior to writing
new data in the UFM block. A special erase sequence is required, as discussed in
“Erase Operation” on page 9–18.
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 altufmMegaWizard 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.
© October 2008 Altera Corporation
MAX II Device Handbook