9–18
Chapter 9: Using User Flash Memory in MAX II Devices
Software Support for UFM Block
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.
Full Erase (Device Slave Address Erase)
The full erase option uses the A2, A1, A0 bits of the slave address to distinguish
between an erase or read/write operation. This slave operation decoding occurs when
the master transfers the slave address to the slave after generating the start condition.
If the A2, A1, and A0 slave address bits transmitted to the UFM slave equals 111 and the
four remaining MSBs match the rest of the slave addresses, then the Full Erase
operation is selected. If the A6, A5, A4, A3 A2, A1, and A0 slave address bits transmitted
to the UFM match its unique slave address setting, the read/write operation is
selected and functions as expected. As a result, this erase option utilizes two slave
addresses on the bus reserving A6, A5, A4, A3, 1, 1, 1 as the erase trigger. Both sectors of
the UFM block will be erased when the Full Erase operation is executed. This
operation requires acknowledge polling. The internal UFM erase function only begins
after the master generates a stop condition. Figure 9–16 shows the full erase sequence
triggered by using the slave address.
If the memory is write-protected (WP = 1), the slave does not acknowledge the erase
trigger slave address (A6, A5, A4, A3, 1, 1, 1) sent by the master. The master should then
send a stop condition to terminate the transfer. The full erase operation will not be
executed.
MAX II Device Handbook
© October 2008 Altera Corporation