
30
S29WSxxxN_00_F0 October 29, 2004
Pr e l i m i n a r y
Note: Base = Base Address.
The following is a C source code example of using the single word program function. Refer to
the Spansion Low Level Driver User’s Guide (available on www.amd.com and
www.fujitsu.com) for general information on Spansion Flash memory software development
guidelines.
/* Example: Program Command
*/
*( (UINT16 *)base_addr + 0x555 ) = 0x00AA;
/* write unlock cycle 1
*/
*( (UINT16 *)base_addr + 0x2AA ) = 0x0055;
/* write unlock cycle 2
*/
*( (UINT16 *)base_addr + 0x555 ) = 0x00A0;
/* write program setup command
*/
*( (UINT16 *)pa )
= data;
/* write data to be programmed
*/
/* Poll for program completion */
7.5.2 Write Buffer Programming
Write Buffer Programming allows the system to write a maximum of 32 words in one pro-
gramming operation. This results in a faster effective word programming time than the
standard “word” programming algorithms. The Write Buffer Programming command se-
quence is initiated by first writing two unlock cycles. This is followed by a third write cycle
containing the Write Buffer Load command written at the Sector Address in which program-
ming will occur. At this point, the system writes the number of “word locations minus 1” that
will be loaded into the page buffer at the Sector Address in which programming will occur.
This tells the device how many write buffer addresses will be loaded with data and therefore
when to expect the “Program Buffer to Flash” confirm command. The number of locations to
program cannot exceed the size of the write buffer or the operation will abort. (Number
loaded = the number of locations to program minus 1. For example, if the system will pro-
gram 6 address locations, then 05h should be written to the device.)
The system then writes the starting address/data combination. This starting address is the
first address/data pair to be programmed, and selects the “write-buffer-page” address. All
subsequent address/data pairs must fall within the elected-write-buffer-page.
The “write-buffer-page” is selected by using the addresses AMAX - A5.
The “write-buffer-page” addresses must be the same for all address/data pairs loaded into
the write buffer. (This means Write Buffer Programming cannot be performed across multiple
“write-buffer-pages.” This also means that Write Buffer Programming cannot be performed
across multiple sectors. If the system attempts to load programming data outside of the se-
lected “write-buffer-page”, the operation will ABORT.)
After writing the Starting Address/Data pair, the system then writes the remaining address/
data pairs into the write buffer.
Note that if a Write Buffer address location is loaded multiple times, the “address/data pair”
counter will be decremented for every data load operation. Also, the last data loaded at a lo-
cation before the “Program Buffer to Flash” confirm command will be programmed into the
Software Functions and Sample Code
Table 7.20. Single Word Program
(LLD Function = lld_ProgramCmd)
Cycle
Operation
Byte Address
Word Address
Data
Unlock Cycle 1
Write
Base + AAAh
Base + 555h
00AAh
Unlock Cycle 2
Write
Base + 554h
Base + 2AAh
0055h
Program Setup
Write
Base + AAAh
Base + 555h
00A0h
Program
Write
Word Address
Data Word