AN1528
APPLICATION NOTE
ST92F120/F124/150/F250 TESTFLASH
INTRODUCTION
The testflash is a ST reserved flash area that contains device information, flash parameters
and the boot code. This boot code contains the protocol for In-System Programming and the
routines for E3
TM
initialization and management. The testflash is programmed by ST at the
factory before shipping and cannot be erased or programmed in user mode.
The purpose of this document is to give an sufficiently accurate description of the testflash
content to allow the user to access to the different parameters and routines included in the
testflash.
After an overview of the testflash content, the document describes the different routines that
can be called at any time by the user code. The last part of this document provides guidelines
on the way to handle an E3
TM
failure.
1 GLOSSARY AND ACRONYMS
The terms, abbreviations and acronyms used in this document are listed below and described
in alphabetical order.
– CONFxR: CONFiguration x Register
– NVAPR: Non Volatile Access Protection Register
– NVCSSx: NV Complementary Sector Status x
– NVESPx: NV Emulation Status Pointer x
– NVPWDx: Non Volatile PassWorD x
– NVWPR: Non Volatile Write Protection Register
– REDxR: REDundancy x Register
– VCSSx: Volatile Complementary Sector Status x
– VESPx: Volatile Emulation Status Pointer x
Rev. 3.0
AN1528/0105
1/18
1
Table of Contents
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1 GLOSSARY AND ACRONYMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 OVERVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1 VECTOR TABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.1 Device identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.2 Testflash code revision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 USER OTP AREA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 PROTECTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 ROUTINES DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1 POWER-ON ROUTINE (230020H) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 NON MASKABLE INTERRUPT ROUTINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 CODE UPDATE ROUTINE: IN-SYSTEM PROGRAMMING . . . . . . . . . . . . . . . . 8
3.4 E3
TM
INITIALIZATION ROUTINE (230026H) . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.5 E3
TM
SWAP ERROR ROUTINES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.5.1 Find Wrong Pages (230029h) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.5.2 Find Wrong Bytes (23002Ch) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.5.3 Complete Aborted Swap (23002Fh) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.6 E3
TM
RESET TO DELIVERY STATUS (230032H) . . . . . . . . . . . . . . . . . . . . . . 14
3.7 USER ROUTINE FOR EXTERNAL WATCHDOG REFRESH . . . . . . . . . . . . . . 15
4 E3
TM
FAILURE RECOVERY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.1 ERASE OR WRITE ERROR: FATAL ERROR . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2 SWAP ERROR: NON FATAL ERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2.1 Generate a reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2.2 Call the “complete aborted swap phase” routine in testflash. . . . . . . . . . . 17
18
2/18
1
ST92F120/F124/150/F250 TESTFLASH
2 OVERVIEW
The structure of the TestFlash content is shown by the following figure:
Figure 1. ST9 TestFlash content
230000h
230020h
230023h
Code Update routine
(in-system programming)
SCI Interrupt
routines
230026h
E3
TM
Initialization
E3
TM
Management
routines
TM
E3 Swap Error:
Find Wrong Pages
E3
TM
Swap Error:
Find Wrong Bytes in given Page
E3
TM
Swap Error:
Complete aborted Swap phase
E3
TM
Reset
to delivery status
Vector Table
Power-On
routine
230029h
23002Ch
23002Fh
230032h
230035h
230E80h
Not Used
(4 Kbytes)
231E80h
231F78h
231F80h
Otp area
124 bytes
Protections
Reserved for Testing
(248 bytes)
231FFCh
3/18
2
ST92F120/F124/150/F250 TESTFLASH
2.1 VECTOR TABLE
The first 16 words of the TestFlash contain the Vector Table.
The Power-On Vector is read when exiting from Reset. The Monitor Vector is read in Em-
bedded Emulation Mode after an ETRAP instruction or an external Break. The NMI Vector is
read if a Non Maskable Interrupt occurs. The SCI Interrupt Vectors are used for the In-System
Programming routine.
Figure 2. Vector Table
Vector Table
230000h
230002h
230004h
230006h
230008h
23000Ah
230010h
230012h
230014h
230016h
Power-On Vector
Monitor Vector
NMI Vector
Mask Set Number
Device Identifier
TestFlash Code Revision
SCI Error Vector
SCI Address Match Vector
SCI Receiving End Vector
SCI Transmitting End Vector
2.1.1 Device identifier
This identifier contains the information about the device, its flash size and its reset vector lo-
cation.
2.1.2 Testflash code revision
The CheckSum is the sum of all the bytes from 230000h to 230E77h, it can be used to verify
if the actual TestFlash content is the most recent one, or if the TestFlash content is corrupted.
rev 2.6
TF rev
Device ID
Testflash
(23000
(230008h)
checksum
Ah)
1024h
xx26h
933BFh
1080h
xx26h
9341Bh
1100h
xx26h
9339Ch
rev 2.7
TF rev
Testflash
(23000
checksum
Ah)
xx27h
8FC55h
xx27h 8FCB1h
xx27h
8FC32h
rev 2.7.1
TF rev
Testflash
(23000
checksum
Ah)
0127h 8FBEBh
0127h
8FC47h
0127h
8FBC8h
Device
ST92F124/F150
ST92F124/F150
ST92F250
Flash
size
64K
128K
256K
2.2 USER OTP AREA
The 124 bytes of TestFlash from 231F80h to 231FFBh are available to the User application as
One Time Programmable area (not erasable).
4/18
ST92F120/F124/150/F250 TESTFLASH
2.3 PROTECTIONS
The TestFlash locations shown by the following figure have a special meaning related to the
Access and Write Flash Protection features (refer to the datasheets).
Figure 3. Protection Map
Protection
231FFCh
231FFDh
231FFEh
231FFFh
NVAPR
NVWPR
NVPWD0
NVPWD1
5/18