When the dat a EEPR OM is not av ailab le in a ST 7 d evice, i t can be emulated by th e XFlas h
memory with some re strictions. This App lication Note descri bes how to emulate thi s feature
with a ST72F264 device and the restrictions this emulation implies.
Data EEPROM can be emulated in all XFlash devices (all Lite, ST72F344, ....).
For more information concerning ST7 programming, including a .zip file with the complete
corresponding code for the ST72F264, visit our web site at www.st.com.
AN1477/12011/5
1
EMULATED DATA EEPROM WITH XFLASH MEMOR Y
1 RESTRICTIONS
1To guarantee that the XFlash program memory is write protected when programming the
Emulated Data EEPROM, the whole program memory MUST be located in sector 0 (refer
to the datasheet). This implies that:
–The maximum program m emory size is 4 Kbytes (sector 0 set by option byte to the
maximum size which allows sector 1 availability).
–IAP is not available for program memory.
2During emulated data EEPROM programming, the XFlash can not be executed. This
implies that:
–The software which programs the emulated data E EPROM must be located i n RAM.
This software needs at least 16 bytes of RAM as shown in following program example.
–The interrupts cannot be served during programming so they have to be masked.
2 PROCEDURE
To prog ram 1 by te in the em ulate d dat a EEP ROM (locat ed in s ector 1) th e foll owing s tep s
have to be done:
1Enter the XFlash RASS key to unlock the access to the FCSR register (only once, after
reset for example).
2Download the programming driver into RAM (from 0083h to 008Fh for example).
3Write the data and address to be programmed in a RAM buffer (at RAM address 0080h
to 0082h for example).
4Call the downloaded RAM driver to program the emulated data EEPROM.
3 ASSEMBLER PRO GRAM EXAMPLE
The following program example describes a driver routine to be called to emulate data
EEPROM wi th an X Fla sh ST 7 devi ce. Th is ex am ple ass ume s th at a ll res tric tions ar e t ak en
into account.
In this example, the program memory size is 4 Kbytes and the data EEPROM is also 4 Kbytes,
but these sizes can be adjusted through option bytes depending on the needs.
st7/
;***************************************************************************
; TITLE:XdataE2Emul.asm
; AUTHOR:CMG_MCD Application Team
; DESCRIPTION: Data EEPROM emulation with XFlash memory (ST72F264 example)
;***************************************************************************
E2DATA EQU $80; 1 byte: Emul. EEPROM Data to be programmed
E2ADDR EQU $81; 2 bytes: Emul. EEPROM Address to be programmed
WORDS
SEGMENT byte at E000-EFFF 'XFlash Sect1 -Emul Data EEPROM'
SEGMENT byte at F000-FFFF 'XFlash Sect0 -Program'
; < RESET >
LD A,#$56; Enter RASS keys to unlock FCSR register
LD FCSR,A
LD A,#$AE
LD FCSR,A
; < USER APPLICATION PROGRAM >
CALL XemulE2_ByteProg
; < USER APPLICATION PROGRAM >
; --------------------------------------------------------------------------; ROUTINE: XemulE2_ByteProg
; DESCRIPTION: Emulated data EEPROM byte programming driver routine
; BEFORE: A = data to be programmmed
;X:Y = address where it has to be programmed [E000h..EFFFh]
; AFTER: Interrupts are disabled
;The requested data byte is programmed
; RESSOURCES:
;Program size: 40 bytes in sector 0
;Used RAM area: 16 bytes from 0080h to 008Fh.
; ---------------------------------------------------------------------------
.XemulE2_ByteProg
LDE2DATA,A; Data to be programmed (0080h) is in A
LD{E2ADDR},X; High address to be programmed (0081h) in X
LD{E2ADDR+1},Y; Low address to be programmed (0082h) in Y
LDX,#$0C; Copy programming software driver
3/5
EMULATED DATA EEPROM WITH XFLASH MEMOR Y
.RAM_Copy; into RAM from address 0083h
LDA,(RAM_Driver,X)
LD($83,X),A
DEC X
JRPL RAM_Copy
SIM; Disable interrupts
JP $83; Call the programming driver located in RAM
.RAM_Driver
BSET FCSR,#LAT; Enable Emul. EEPROM latches
LDA, E2DATA
LD[E2ADDR.w],A; Set address/data to be programmed
BSET FC SR,#PGM; Launch the Emul. EEPROM programming
.EEPROM_Prog
BTJT FCSR,#PGM,EEPROM_Prog; Wait for end of programming (~5ms)
RET
"THE PRESENT NOTE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH INFORMATION
REGARDING THE IR PRO DUCT S IN OR DER FO R THEM TO SAV E TIME . AS A RES ULT, STMIC ROEL ECTR ONI CS
SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO
ANY CL AIM S AR IS IN G FR OM T HE CO N TENT OF S UC H A NO TE A ND /O R T HE U SE M AD E BY C US TO ME RS O F
THE INFORMATION CONTAINED HEREIN IN CONNEXION WITH THEIR PRODUCTS."
Information furnished is believed to be accurate and reliable. However, STMicroelectronics assumes no responsibility for the consequences
of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is granted
by implic ation or otherwise un der any pat ent or pat ent rights of STMicroe l ectronics. S pecificat i ons mentioned in thi s publicati on are subject
to change without notice. This publication supersedes and replaces all information previously supplied. STMicroelectronics products are not
authorized for use as cri t i cal compone nts in life support device s or systems without the express writt en approval of STMicroel ectronics.
The ST logo is a registered trademark of STMicroelectronics
2001 STMicroelectronics - All Rights Reserved.
STMicroelectronics Group of Companies
http://www.s t. com
Purchase of I
2
C Components by STMicroelectronics conveys a license under the Philips I2C Patent. Rights to use the se component s i n an
2
I
C system i s granted pro vided that the system con forms to the I2C Standard Specification as defined by Philips.
Australi a - B razil - Canada - China - Finland - Franc e - Germany - Hong Kong - Ind i a - Is rael - Ital y - J apan
Malaysi a - M al ta - Morocco - Singapore - Spain - Sweden - Switz erland - Unit ed Kingdom - U.S.A.
5/5
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.