Documente Academic
Documente Profesional
Documente Cultură
APPLICATION NOTE
Flash Programming / Reprogramming ST10F269 / ST10F280
By Andr ROGER
INTRODUCTION
This application note provides with software guidelines and examples for programming ST10F269 and
ST10F280. More generally, this application note is applicable for any ST10 variant with 0.35m
technology embedded Flash memory.
The first chapter gives an overview the ST10F269/F280 embedded Flash key features. It also shows the
differences between ST10F269/ST10F280 and ST10F168.
The second chapter describes how to develop software for ST10s embedded Flash through guidelines,
examples and tips.
The last chapter is dedicated to embedded application aspects. More specifically, it gives advises for
Flash field reprogramming.
This application note does not replace ST10 product datasheets. It refers to them and it is necessary to
have a copy the specific ST10 variant targetted by the user to follow some of the explanations.
September 2013
1/17
PAGE
1
1.1
1.1.1
1.1.2
1.1.3
1.2
1.2.1
1.2.2
1.2.3
1.2.4
1.2.5
3
3
3
3
3
3
3
3
5
6
6
2
2.1
2.2
2.2.1
2.2.2
2.3
2.4
2.5
2.6
2.6.1
2.6.2
2.6.2.1
2.6.2.2
2.6.2.3
2.7
2.8
2.8.1
2.8.2
WRITING CODE FOR THE FLASH OF ST10 WITH 0.35MM EMBEDDED FLASH..
ST10 PROGRAMMING CONSTRAINTS ....................................................................
POLLING THE FLASH ERASE PROGRAM CONTROLLER .....................................
Ready/Busy Signal ......................................................................................................
Flash Status Register ..................................................................................................
FLASH MEMORY MAPPING IN ST10 SPACE ...........................................................
PROGRAMMING COMMAND.....................................................................................
ERASING COMMAND ................................................................................................
FLASH PROTECTION COMMANDS ..........................................................................
Block Protection...........................................................................................................
Code Protection ...........................................................................................................
Using Code Protection with ST10................................................................................
Code Protection and Bootstrap Loader .......................................................................
Code Protection and Block0 Protection .......................................................................
OTHER FLASH COMMANDS .....................................................................................
TIPS TO REDUCE FLASH PROGRAM AND ERASE TIMES ....................................
Reducing the Programming Time ................................................................................
Reducing Erase Times ................................................................................................
7
7
7
7
7
7
8
9
10
10
10
10
10
11
12
12
12
12
3
3.1
3.1.1
3.1.2
3.1.3
3.2
3.2.1
3.2.2
3.2.2.1
3.2.2.2
3.2.3
3.2.3.1
3.2.3.2
13
13
13
13
13
14
14
14
14
14
14
15
15
17
CONCLUSION ............................................................................................................
16
6
6.1
16
16
2/17
Mne
Cycle
Read/Reset
RD
1+
Read/Reset
RD
3+
Program Word
PW
Block Erase
BE
Chip Erase
CE
Erase Suspend
ES
Erase Resume
ER
Set Block/Code
Protection
Read
Protection
Status
Block
Temporary
Unprotection
Code
Temporary
Unprotection
Code
Temporary
Protection
SP
RP
BTU
CTU
CTP
1st
Cycle
2nd
Cycle
3rd Cycle
Addr.1
X2
Data
xxF0h
Addr.1
x1554h
x2AA8h
xxxxxh
Data
xxA8h
xx54h
xxF0h
Addr. 1
x1554h
x2AA8h
x1554h
6th
Cycle
7th
Cycle
xxA8h
xx54h
xxA0h
Addr.1
x1554h
x2AA8h
x1554h
x1554h
x2AA8h
BA
BA 5
Data
xxA8h
xx54h
xx80h
xxA8h
xx54h
xx30h
xx30h
x1554h
x2AA8h
x1554h
x1554h
x2AA8h
x1554h
Data
xxA8h
xx54h
xx80h
xxA8h
xx54h
xx10h
Addr.1
X2
Data
xxB0h
Addr.1
X2
Data
xx30h
Addr.1
x2A54h
x15A8h
x2A54h
Any odd
word
address 9
Data
xxA8h
xx54h
xxC0h
WPR 7
Addr.1
x2A54h
x15A8h
x2A54h
Any odd
word
address 9
Addr.
WD
Data
Note 6
Read until Toggle stops, then read or program all data needed
from block(s) not being erased then Resume Erase.
Read Data Polling or Toggle bit until Erase completes or Erase
is supended another time.
5th
Cycle
4th Cycle
Data
xxA8h
xx54h
xx90h
Read
PR
Addr. 1
x2A54h
x15A8h
x2A54h
X2
Data
xxA8h
xx54h
xxC1h
xxF0h
Addr.1
MEM 8
Data
FFFFh
Addr.1
MEM 8
Data
FFFBh
Notes 1. Address bit A14, A15 and above are dont care for coded address inputs.
2. X = Dont Care.
3. WA = Write Address: address of memory location to be programmed.
4. WD = Write Data: 16-bit data to be programmed
5. Optional, additional blocks addresses must be entered within a time-out delay (96 s) after last write entry, timeout status can be
verified through FSB.3 value. When full command is entered, read Data Polling or Toggle bit until Erase is completed or suspended.
6. Read Data Polling or Toggle bit until Erase completes.
7. WPR = Write protection register. To protect code, bit 15 of WPR must be 0. To protect block N (N=0,1,...), bit N of WPR must be
0. Bit that are already at 0 in protection register must also be 0 in WPR, else a writing error will occurs (it is not possible to write a
1 in a bit already programmed at 0).
8. MEM = any address inside the Flash memory space. Absolute addressing mode must be used (MOV MEM, Rn), and instruction
must be executed from Flash memory space.
9. Odd word address = 4n-2 where n = 0, 1, 2, 3..., ex. 0002h, 0006h...
4/17
14
13
12
11
10
FSB.3 FSB.2
R
Bit
Function
FSB.7
FSB.6
FSB.5
FSB.3
FSB.2
Note : The address of the Flash Status Register is the address of the word being programmed when
Programming operation is in progress, or an address within the block being erased when Erasing
operation is in progress.
5/17
14
13
12
CP
11
10
BP10
BP9
BP8
BP7
BP6
BP5
BP4
Bit
BPx
BP3.3 BP2.2
BP1
BP0
Function
Block x Protection Bit (x = 0...10)
0: the Block Protection is enabled for block x. Programming or erasing the block is not possible, unless a
Block Temporary Unprotection command is issued.
1: the Block Protection is disabled for block x.
Bit is 1 by default, and can be programmed permanently to 0 using the Set Protection command but then
can not be set to 1 again. It is therefore possible to temporally disable the Block Protection using the Block
Temporary Unprotection instruction.
CP
Note : The organisation of the Flash control register depends on the organisation of each device. Please,
refer to the targetted product datasheet (ex : ST10F269 : BP10, BP9, BP8, BP7 are not implemented).
6/17
Addresses (Segment 0)
Addresses (Segment 1)
Size (bytes)
000000h to 003FFFh
010000h to 013FFFh
16 K
004000h to 005FFFh
014000h to 015FFFh
8K
006000h to 007FFFh
016000h to 017FFFh
8K
Note : the memory mapping of the other block is independant of bit ROMS1.
7/17
JNB
EXTS
MOV
XOR
JNB
8/17
word programming :
;use EXTended addressing for next MOV instruction
;read Flash Status register (FSB) in R7
;save it in R6 register
;Check if FSB.7 = Data.7 (i.e. R7.7 = R13.7)
R7, R13
R7.7, Prog_OK
;Check if FSB.5 = 1 (Programming Error)
R6.5, Data_Polling
;Programming Error: verify is Flash programmed data is OK
R11, #1
;use EXTended addressing for next MOV instruction
R7, [R12]
;read Flash Status register (FSB) in R7
;Check if FSB.7 = Data.7
R7, R13
R7.7, Prog_OK
;Programming failed: Flash remains in Write Operation.
;To go back to normal Read operations, a Read/Reset
;command must be performed
9/17
R5, #01554h
MOV
R6, #02AA8h
SCXT
DPPO, #08h
MOV
MOV
MOV
MOV
MOV
MOV
POP
R7, #0A8h
[R5], R7
R7, #054h
[R6], R7
R7, #0F0h
[R5], R7
DPP0
15/17
16/17
AN1496
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (ST) reserve the
right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any
time, without notice.
All ST products are sold pursuant to STs terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no
liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this
document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products
or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such
third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN STS TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN: (A) SAFETY CRITICAL APPLICATIONS SUCH AS LIFE
SUPPORTING, ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS; (B)
AERONAUTIC APPLICATIONS; (C) AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS, AND/OR (D) AEROSPACE APPLICATIONS
OR ENVIRONMENTS. WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE, THE PURCHASER SHALL USE PRODUCTS AT
PURCHASERS SOLE RISK, EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE, UNLESS A PRODUCT IS
EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR AUTOMOTIVE, AUTOMOTIVE SAFETY OR MEDICAL INDUSTRY
DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS. PRODUCTS FORMALLY ESCC, QML OR JAN QUALIFIED ARE
DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void
any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any
liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
DocID8629 Rev 2
17/17
17