D at a
S hee t
Software Functions and Sample Code
Table 7.35
Single Word Program
(LLD Function = lld_ProgramCmd)
Cycle
Unlock Cycle 1
Unlock Cycle 2
Program Setup
Program
Note:
Base = Base Address.
Operation
Write
Write
Write
Write
Byte Address
Base + AAAh
Base + 554h
Base + AAAh
Word Address
Word Address
Base + 555h
Base + 2AAh
Base + 555h
Word Address
Data
00AAh
0055h
00A0h
Data Word
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.spansion.com) for general information on Spansion Flash
memory software development guidelines.
/* Example: Program Command
*/
*( (UINT16 *)base_addr + 0x555 )
*( (UINT16 *)base_addr + 0x2AA )
*( (UINT16 *)base_addr + 0x555 )
*( (UINT16 *)pa )
/* Poll for program completion */
=
=
=
=
0x00AA;
0x0055;
0x00A0;
data;
/*
/*
/*
/*
write
write
write
write
unlock cycle 1
unlock cycle 2
program setup command
data to be programmed
*/
*/
*/
*/
7.7.2
Write Buffer Programming
Write Buffer Programming allows the system to write a maximum of 32 words in one programming operation.
This results in a faster effective word programming time than the standard
word
programming algorithms. The
Write Buffer Programming command sequence 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
programming 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. (NOTE: the size of the write buffer is dependent upon which data are being loaded. Also
note that the number loaded = the number of locations to program minus 1. For example, if the system will
program 6 address locations, then 05h should be written to the device.)
The
write-buffer
addresses must be in the same sector for all address/data pairs loaded into the write buffer.
It is to be noted that Write Buffer Programming cannot be performed across multiple sectors. If the system
attempts to load programming data outside of the selected
write-buffer
addresses, the operation aborts after
the Write to Buffer command is executed. Also, the starting address must be the least significant address. All
subsequent addresses and write buffer data must be in sequential order.
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
be in sequential order.
After writing the Starting Address/Data pair, the system then writes the remaining address/data pairs into the
write buffer. Write buffer locations must be loaded in sequential order starting with the lowest address in the
page. Note that if the number of address/data pairs do no match the word count, the program buffer to flash
command is ignored.
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 location before the
Program Buffer
to Flash
confirm command will be programmed into the device. It is the software’s responsibility to
comprehend ramifications of loading a write-buffer location more than once. The counter decrements for each
data load operation, NOT for each unique write-buffer-address location.
Once the specified number of write buffer locations have been loaded, the system must then write the
Program Buffer to Flash
command at the Sector Address. Any other address/data write combinations will
abort the Write Buffer Programming operation. The device will then
go busy.
The Data Bar polling techniques
36
S29WS-P
S29WS-P_00_A11 September 28, 2007