STM32F10xx Flash Programming Manual
STM32F10xx Flash Programming Manual
Programming manual
STM32F10xxx Flash memory microcontrollers
Introduction
This programming manual describes how to program the Flash memory of STM32F101xx,
STM32F102xx, STM32F103xx, STM32F105xx and STM32F107xx microcontrollers. For
convenience, these will be referred to as STM32F10xxx in the rest of this document unless
otherwise specified.
The STM32F10xxx embedded Flash memory can be programmed using in-circuit
programming or in-application programming.
The in-circuit programming (ICP) method is used to update the entire contents of the
Flash memory, using the JTAG, SWD protocol or the boot loader to load the user application
into the microcontroller. ICP offers quick and efficient design iterations and eliminates
unnecessary package handling or socketing of devices.
In contrast to the ICP method, in-application programming (IAP) can use any
communication interface supported by the microcontroller (I/Os, USB, CAN, UART, I2C, SPI,
etc.) to download programming data into memory. IAP allows the user to re-program the
Flash memory while the application is running. Nevertheless, part of the application has to
have been previously programmed in the Flash memory using ICP.
The Flash interface implements instruction access and data access based on the AHB
protocol. It implements a prefetch buffer that speeds up CPU code execution. It also
implements the logic necessary to carry out Flash memory operations (Program/Erase).
Program/Erase operations can be performed over the whole product voltage range.
Read/Write protections and option bytes are also implemented.
Table 1 lists the microcontrollers and evaluation tool concerned by this programming
manual.
Table 1.
Applicable products
Type
August 2012
Applicable products
Microcontrollers
Evaluation tool
1/31
www.st.com
Contents
PM0075
Contents
1
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2
Read operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3
2.4
2.5
2/31
2.2.1
Instruction fetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.2
D-Code interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2.3
Key values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.2
2.3.3
2.3.4
2.3.5
Protections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.4.1
Read protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.4.2
Write protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.3
Register descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
PM0075
List of tables
List of tables
Table 1.
Table 2.
Table 3.
Table 4.
Table 5.
Table 6.
Table 7.
Table 8.
Table 9.
Table 10.
Table 11.
Table 12.
Applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Flash module organization (low-density devices) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Flash module organization (medium-density devices) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Flash module organization (high-density devices) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Flash module organization (connectivity line devices) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Flash memory protection status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Option byte format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Option byte organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Description of the option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Flash interface - register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3/31
List of figures
PM0075
List of figures
Figure 1.
Figure 2.
Figure 3.
4/31
Programming procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Flash memory Page Erase procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Flash memory Mass Erase procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
PM0075
Glossary
This section gives a brief definition of acronyms and abbreviations used in this document:
JTAG debug port (JTAG-DP) provides a 5-pin standard interface based on the
Joint Test Action Group (JTAG) protocol.
SWD debug port (SWD-DP) provides a 2-pin (clock and data) interface based on
the Serial Wire Debug (SWD) protocol.
For both the JTAG and SWD protocols please refer to the Cortex M3 Technical
Reference Manual
FPEC (Flash memory program/erase controller): write operations to the main memory
and the information block are managed by an embedded Flash program/erase
controller (FPEC).
IAP (in-application programming): IAP is the ability to re-program the Flash memory of
a microcontroller while the user program is running.
ICP (in-circuit programming): ICP is the ability to program the Flash memory of a
microcontroller using the JTAG protocol, the SWD protocol or the boot loader while the
device is mounted on the user application board.
I-Code: this bus connects the Instruction bus of the Cortex-M3 core to the Flash
instruction interface. Prefetch is performed on this bus.
D-Code: this bus connects the D-Code bus (literal load and debug access) of the
Cortex-M3 to the Flash Data Interface.
5/31
Overview
PM0075
Overview
1.1
Features
Memory organization:
Information block:
2306 64 bits for connectivity line devices
258 64 bits for other devices
1.2
Low-power mode
6/31
PM0075
Overview
Table 2.
Block
Main memory
Name
Base addresses
Size (bytes)
Page 0
1 Kbyte
Page 1
1 Kbyte
Page 2
1 Kbyte
Page 3
1 Kbyte
Page 4
1 Kbyte
.
.
.
.
.
.
.
.
.
Page 31
1 Kbyte
System memory
2 Kbytes
Option Bytes
16
FLASH_ACR
FLASH_KEYR
FLASH_OPTKEYR
FLASH_SR
FLASH_CR
FLASH_AR
Reserved
FLASH_OBR
FLASH_WRPR
Information block
Flash memory
interface
registers
Table 3.
Block
Main memory
Name
Base addresses
Size (bytes)
Page 0
1 Kbyte
Page 1
1 Kbyte
Page 2
1 Kbyte
Page 3
1 Kbyte
Page 4
1 Kbyte
.
.
.
.
.
.
.
.
.
Page 127
1 Kbyte
System memory
2 Kbytes
Option Bytes
16
Information block
7/31
Overview
PM0075
Table 3.
Block
Flash memory
interface
registers
Table 4.
Name
Base addresses
Size (bytes)
FLASH_ACR
FLASH_KEYR
FLASH_OPTKEYR
FLASH_SR
FLASH_CR
FLASH_AR
Reserved
FLASH_OBR
FLASH_WRPR
Block
Main memory
Name
Base addresses
Size (bytes)
Page 0
2 Kbytes
Page 1
2 Kbytes
Page 2
2 Kbytes
Page 3
2 Kbytes
.
.
.
.
.
.
.
.
.
Page 255
2 Kbytes
System memory
2 Kbytes
Option Bytes
16
FLASH_ACR
FLASH_KEYR
FLASH_OPTKEYR
FLASH_SR
FLASH_CR
FLASH_AR
Reserved
FLASH_OBR
FLASH_WRPR
Information block
Flash memory
interface
registers
8/31
PM0075
Overview
Table 5.
Block
Main memory
Name
Base addresses
Size (bytes)
Page 0
2 Kbytes
Page 1
2 Kbytes
Page 2
2 Kbytes
Page 3
2 Kbytes
.
.
.
.
.
.
.
.
.
Page 127
2 Kbytes
System memory
18 Kbytes
Option Bytes
16
FLASH_ACR
FLASH_KEYR
FLASH_OPTKEYR
FLASH_SR
FLASH_CR
FLASH_AR
Reserved
FLASH_OBR
FLASH_WRPR
Information block
Flash memory
interface
registers
The Flash memory is organized as 32-bit wide memory cells that can be used for storing
both code and data constants. The Flash module is located at a specific base address in the
memory map of each STM32F10xxx microcontroller type. For the base address, please
refer to the related STM32F10xxx reference manual.
The information block is divided into two parts:
System memory is used to boot the device in System memory boot mode. The area is
reserved for use by STMicroelectronics and contains the boot loader which is used to
reprogram the Flash memory using the USART1 serial interface. It is programmed by
ST when the device is manufactured, and protected against spurious write/erase
operations. For further details please refer to AN2606.
In connectivity line devices the boot loader can be activated through one of the
following interfaces: USART1, USART2 (remapped), CAN2 (remapped) or USB OTG
FS in Device mode (DFU: device firmware upgrade). The USART peripheral operates
with the internal 8 MHz oscillator (HSI). The CAN and USB OTG FS, however, can only
function if an external 8 MHz, 14.7456 MHz or 25 MHz clock (HSE) is present. For
further details, please refer to AN2662 (STM32F105xx and STM32F107xx system
memory boot mode) available from www.st.com.
Option bytes
Write operations to the main memory block and the option bytes are managed by an
embedded Flash Program/Erase Controller (FPEC). The high voltage needed for
Program/Erase operations is internally generated.
9/31
Overview
PM0075
The main Flash memory can be protected against different types of unwanted access
(read/write/erase). There are two types of protection:
Read Protection
10/31
In the low-power modes, all Flash memory accesses are aborted. Refer to the
STM32F10xxx reference manual for further information.
PM0075
2.1
Introduction
This section describes how to read from or program to the STM32F10xxx embedded Flash
memory.
2.2
Read operation
The embedded Flash module can be addressed directly, as a common memory space. Any
data read operation accesses the content of the Flash module through dedicated read
senses and provides the requested data.
The read interface consists of a read controller on one side to access the Flash memory and
an AHB interface on the other side to interface with the CPU. The main task of the read
interface is to generate the control signals to read from the Flash memory and to prefetch
the blocks required by the CPU. The prefetch block is only used for instruction fetches over
the I-Code bus. The Literal pool is accessed over the D-Code bus. Since these two buses
have the same Flash memory as target, D-code bus accesses have priority over prefetch
accesses.
2.2.1
Instruction fetch
The Cortex-M3 fetches the instruction over the I-Code bus and the literal pool
(constant/data) over the D-code bus. The prefetch block aims at increasing the efficiency of
I-Code bus accesses.
Prefetch buffer
The prefetch buffer is 2 blocks wide where each block consists of 8 bytes. The prefetch
blocks are direct-mapped. A block can be completely replaced on a single read to the Flash
memory as the size of the block matches the bandwidth of the Flash memory.
The implementation of this prefetch buffer makes a faster CPU execution possible as the
CPU fetches one word at a time with the next word readily available in the prefetch buffer.
This implies that the acceleration ratio will be of the order of 2 assuming that the code is
aligned at a 64-bit boundary for the jumps.
Prefetch controller
The prefetch controller decides to access the Flash memory depending on the available
space in the prefetch buffer. The Controller initiates a read request when there is at least
one block free in the prefetch buffer.
After reset, the state of the prefetch buffer is on.
The prefetch buffer should be switched on/off only when SYSCLK is lower than 24 MHz and
no prescaler is applied on the AHB clock (SYSCLK must be equal to HCLK). The prefetch
buffer is usually switched on/off during the initialization routine, while the microcontroller is
running on the internal 8 MHz RC (HSI) oscillator.
Note:
The prefetch buffer must be kept on (FLASH_ACR[4]=1) when using a prescaler different
from 1 on the AHB clock.
11/31
PM0075
In case of non-availability of a high frequency clock in the system, Flash memory accesses
can be made on a half cycle of HCLK (AHB clock), the frequency of HCLK permitting (halfcycle access can only be used with a low-frequency clock of less than 8 MHz that can be
obtained with the use of HSI or HSE but not of PLL). This mode can be chosen by setting a
control bit in the Flash access control register.
Note:
Half-cycle access cannot be used when there is a prescaler different from 1 on the AHB
clock.
2.2.2
D-Code interface
The D-Code interface consists of a simple AHB interface on the CPU side and a request
generator to the Arbiter of the Flash access controller. D-code accesses have priority over
prefetch accesses. This interface uses the Access Time Tuner block of the prefetch buffer.
2.2.3
2.3
An ongoing Flash memory operation will not block the CPU as long as the CPU does not
access the Flash memory.
2.3.1
Key values
The key values are as follows:
12/31
KEY1 = 0x45670123
KEY2 = 0xCDEF89AB
PM0075
2.3.2
2.3.3
Programming procedure
Read FLASH_CR_LOCK
Yes
FLASH_CR_LOCK
=1
No
Write FLASH_CR_PG to 1
FLASH_SR_BSY
=1
Yes
No
Check the programmed value
by reading the programmed
address
ai14307b
13/31
PM0075
Standard programming
In this mode the CPU programs the main Flash memory by performing standard half-word
write operations. The PG bit in the FLASH_CR register must be set. FPEC preliminarily
reads the value at the addressed main Flash memory location and checks that it has been
erased. If not, the program operation is skipped and a warning is issued by the PGERR bit in
FLASH_SR register (the only exception to this is when 0x0000 is programmed. In this case,
the location is correctly programmed to 0x0000 and the PGERR bit is not set). If the
addressed main Flash memory location is write-protected by the FLASH_WRPR register,
the program operation is skipped and a warning is issued by the WRPRTERR bit in the
FLASH_SR register. The end of the program operation is indicated by the EOP bit in the
FLASH_SR register.
The main Flash memory programming sequence in standard mode is as follows:
Check that no main Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register.
Note:
The registers are not accessible in write mode when the BSY bit of the FLASH_SR register
is set.
2.3.4
Page Erase
A page of the Flash memory can be erased using the Page Erase feature of the FPEC. To
erase a page, the procedure below should be followed:
14/31
Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_CR register
PM0075
Yes
FLASH_CR_LOCK
=1
No
Write FLASH_CR_PER to 1
Write FLASH_CR_STRT to 1
FLASH_SR_BSY
=1
Yes
No
Check the page is erased by
reading all the addresses in
the page
ai14305c
Mass Erase
The Mass Erase command can be used to completely erase the user pages of the Flash
memory. The information block is unaffected by this procedure. The following sequence is
recommended:
Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register
15/31
PM0075
Yes
FLASH_CR_LOCK
=1
No
Write into FLASH_CR_MER
to 1
Write FLASH_CR_STRT to 1
FLASH_SR_BSY
=1
Yes
No
Check the erase operation by
reading all the addresses in
the user memory
2.3.5
ai14306b
16/31
PM0075
Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register.
Unlock the OPTWRE bit in the FLASH_CR register.
Set the OPTPG bit in the FLASH_CR register
Write the data (half-word) to the desired address
Wait for the BSY bit to be reset.
Read the programmed value and verify.
When the Flash memory read protection option is changed from protected to unprotected, a
Mass Erase of the main Flash memory is performed before reprogramming the read
protection option. If the user wants to change an option other than the read protection
option, then the mass erase is not performed. The erased state of the read protection option
byte protects the Flash memory.
Erase procedure
The option byte erase sequence (OPTERASE) is as follows:
2.4
Check that no Flash memory operation is ongoing by reading the BSY bit in the
FLASH_SR register
Unlock the OPTWRE bit in the FLASH_CR register
Set the OPTER bit in the FLASH_CR register
Set the STRT bit in the FLASH_CR register
Wait for BSY to reset
Read the erased option bytes and verify
Protections
The user area of the Flash memory can be protected against read by untrusted code. The
pages of the Flash memory can also be protected against unwanted write due to loss of
program counter contexts. The write-protection granularity is then of:
2.4.1
Read protection
The read protection is activated by setting the RDP option byte and then, by applying a
system reset to reload the new RDP option byte.
Note:
If the read protection is set while the debugger is still connected through JTAG/SWD, apply a
POR (power-on reset) instead of a system reset (without debugger connection).
Once the protection byte has been programmed:
Main Flash memory read access is not allowed except for the user code (when booting
from main Flash memory itself with the debug mode not active).
Pages 0-3 (for low- and medium-density devices), or pages 0-1 (for high-density and
connectivity line devices) are automatically write-protected. The rest of the memory can
be programmed by the code executed from the main Flash memory (for IAP, constant
storage, etc.), but it is protected against write/erase (but not against mass erase) in
debug mode or when booting from the embedded SRAM.
17/31
PM0075
All features linked to loading code into and executing code from the embedded SRAM
are still active (JTAG/SWD and boot from embedded SRAM) and this can be used to
disable the read protection. When the read protection option byte is altered to a
memory-unprotect value, a mass erase is performed.
When booting from the embedded SRAM, Flash memory accesses through the code
and through data read using DMA1 and DMA2 are not allowed.
Flash memory access through data read using JTAG, SWV (serial wire viewer), SWD
(serial wire debug), ETM and boundary scan are not allowed.
The Flash memory is protected when the RDP option byte and its complement contain the
pair of values shown in Table 6.
Table 6.
Note:
0xFF
0xFF
Protected
RDPRT
Not protected
Any value
Protected
Erasing the option byte block will not trigger a mass erase as the erased value (0xFF)
corresponds to a protected value.
Unprotection
To disable the read protection from the embedded SRAM:
Erase the entire option byte area. As a result, the read protection code (RDP) will be
0xFF. At this stage the read protection is still enabled.
Program the correct RDP code 0x00A5 to unprotect the memory. This operation first
forces a Mass Erase of the main Flash memory.
Reset the device (POR Reset) to reload the option bytes (and the new RDP code) and,
to disable the read protection.
Note:
The read protection can be disabled using the boot loader (in this case only a System Reset
is necessary to reload the option bytes). For more details refer to AN2606.
2.4.2
Write protection
In high-density and connectivity line devices, from page 0 to page 61, write protection is
implemented with a granularity of two pages at a time. The remaining memory block (from
page 62 to page 255 in high-density devices, and from page 62 to page 127 in connectivity
line devices) is write-protected at once.
In low- and medium-density devices, write protection is implemented with a granularity of
four pages at a time.
If a program or an erase operation is performed on a protected page, the Flash memory
returns a protection error flag on the Flash memory Status Register (FLASH_SR).
The write protection is activated by configuring the WRP[3:0] option bytes, and then by
applying a system reset to reload the new WRPx option bytes.
18/31
PM0075
Unprotection
To disable the write protection, two application cases are provided:
2.4.3
Erase the entire option byte area by using the OPTER bit in the Flash memory
control register (FLASH_CR)
Program the correct RDP code 0x00A5 to unprotect the memory. This operation
first forces a Mass Erase of the main Flash memory.
Reset the device (system reset) to reload the option bytes (and the new WRP[3:0]
bytes), and to disable the write protection
Case 2: Read protection maintained active after the write unprotection, useful for inapplication programming with a user boot loader:
Erase the entire option byte area by using the OPTER bit in the Flash memory
control register (FLASH_CR)
Reset the device (system reset) to reload the option bytes (and the new WRP[3:0]
bytes), and to disable the write protection.
2.5
23-16
15 -8
7-0
complemented option
byte1
Option byte 1
complemented option
byte0
Option byte 0
The organization of these bytes inside the information block is as shown in Table 8.
The option bytes can be read from the memory locations listed in Table 8 or from the Option
byte register (FLASH_OBR).
Note:
The new programmed option bytes (user, read/write protection) are loaded after a system
reset.
19/31
PM0075
Address
[31:24]
[23:16]
[15:8]
[7:0]
0x1FFF F800
nUSER
USER
nRDP
RDP
0x1FFF F804
nData1
Data1
nData0
Data0
0x1FFF F808
nWRP1
WRP1
nWRP0
WRP0
0x1FFF F80C
nWRP3
WRP3
nWRP2
WRP2
Table 9.
Flash memory
address
Option bytes
Bits [31:24] nUSER
Bits [23:16] USER: User option byte (stored in FLASH_OBR[9:2])
This byte is used to configure the following features:
0x1FFF F800
20/31
0x1FFF F804
0x1FFF F808
PM0075
Flash memory
address
0x1FFF F80C
Option bytes
WRPx: Flash memory write protection option bytes
Bits [31:24]: nWRP3
Bits [23:16]: WRP3 (stored in FLASH_WRPR[31:24])
Bits [15:8]: nWRP2
Bits [7:0]: WRP2 (stored in FLASH_WRPR[23:16])
For low-density devices, one bit of the user option bytes WRPx is used to
protect 4 pages of 1 Kbyte in main memory block.
For medium-density devices, one bit of the user option bytes WRPx is used to
protect 4 pages of 1 Kbyte in main memory block.
For high-density devices, one bit of the user option bytes WRPx is used to
protect 2 pages of 2 Kbytes in main memory block. However, the bit 7 of
WRP3 write protects pages 62 to 255.
For connectivity line devices, one bit of the user option bytes WRPx is used to
protect 2 pages of 2 Kbytes in main memory block. However, the bit 7 of
WRP3 write-protects pages 62 to 127.
21/31
PM0075
On every system reset, the option byte loader (OBL) reads the information block and stores
the data into the Option byte register (FLASH_OBR) and the Write protection register
(FLASH_WRPR). Each option byte also has its complement in the information block. During
option loading, by verifying the option bit and its complement, it is possible to check that the
loading has correctly taken place. If this is not the case, an option byte error (OPTERR) is
generated. When a comparison error occurs the corresponding option byte is forced to
0xFF. The comparator is disabled when the option byte and its complement are both equal
to 0xFF (Electrical Erase state).
All option bytes (but not their complements) are available to configure the product. The
option registers are accessible in read mode by the CPU. See Section 3: Register
descriptions for more details.
22/31
PM0075
Register descriptions
Register descriptions
In this section, the following abbreviations are used:
Table 10.
Abbreviations
Abbreviation
Meaning
read/write (rw)
read-only (r)
write-only (w)
Software can only write to this bit. Reading the bit returns the reset
value.
read/clear (rc_w0)
Software can read as well as clear this bit by writing 0. Writing 1 has
no effect on the bit value.
read/set (rs)
Software can read as well as set this bit. Writing 0 has no effect on
the bit value.
Reserved (Res.)
Note:
The Flash memory registers have to be accessed by 32-bit words (half-word and byte
accesses are not allowed).
3.1
31
30
29
28
27
26
25
24
15
14
13
12
11
10
23
22
21
20
19
18
17
16
Reserved
7
Reserved
PRFT
BS
PRFT
BE
HLF
CYA
rw
rw
LATENCY
rw
rw
rw
23/31
Register descriptions
PM0075
3.2
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
FKEYR[31:16]
w
15
14
13
12
11
10
FKEYR[15:0]
w
Note:
These bits are all write-only and will return a 0 when read.
Bits 31:0 FKEYR: FPEC key
These bits represent the keys to unlock the FPEC.
3.3
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
OPTKEYR[31:16]
w
15
14
13
12
11
10
OPTKEYR[15:0]
w
Note:
These bits are all write-only and will return a 0 when read.
Bits 31:0
24/31
PM0075
Register descriptions
3.4
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
EOP
WRPRT
ERR
Res.
PG
ERR
Res.
Reserved
15
14
13
12
11
10
Reserved
rw
rw
BSY
rw
25/31
Register descriptions
3.5
PM0075
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
OPTER
OPT
PG
MER
PER
PG
Res.
rw
rw
rw
Reserved
15
14
13
12
11
EOPIE
Reserved
Res.
rw
10
OPTWR
ERRIE
E
rw
7
LOCK
STRT
Res.
rw
rw
rw
rw
rw
26/31
PM0075
Register descriptions
3.6
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
FAR[31:16]
w
15
14
13
12
11
10
FAR[15:0]
w
Updated by hardware with the currently/last used address. For Page Erase operations, this
should be updated by software to indicate the chosen page.
Bits 31:0 FAR: Flash Address
Chooses the address to program when programming is selected, or a page to erase when
Page Erase is selected.
Note: Write access to this register is blocked when the BSY bit in the FLASH_SR register is
set.
3.7
Not used
Reserved
RDPRT
Data0
OPTERR
Data1
WDG_SW
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
nRST_STOP
The reset value of this register depends on the value programmed in the option byte and the
OPTERR bit reset value depends on the comparison of the option byte and its complement
during the option byte loading phase.
nRST_STDBY
Note:
27/31
Register descriptions
PM0075
3.8
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
WRP[31:16]
r
15
14
13
12
11
10
WRP[15:0]
r
28/31
PM0075
Register descriptions
Table 11.
FLASH_SR
0x020
FLASH_OBR
Reset value
FLASH_WRPR
Reset value
Data1
Reserved
1 1 1 1
WRP[31:0]
1 1 1 1
Data0
RDPRT
0x01C
OPTERR
WDG_SW
nRST_STOP
OPTPG
nRST_STDBY
STRT
OPTER
LOCK
0
Reserved
ERRIE
OPTWRE
0x018
FAR[31:0]
0 0 0 0 0 0 0
Reserved
EOPIE
Reset value
FLASH_AR
Reset value
LATENCY
[2:0]
Reserved
0x014
Reserved
HLFCYA
Reserved
FLASH_CR
PRFTBE
Reset value
0x010
BSY
ERLYBSY
PG
PER
PGERR
MER
0x00C
FKEYR[31:0]
x x x x x x
OPTKEYR[31:0]
x x x x x x
Reserved
Reset value
FLASH_KEYR
Reset value
x
FLASH_OPTKEYR
0x008
Reset Value
x
0x004
Reserved
Reserved
PRFTBS
FLASH_ACR
EOP
0x000
Register
WRPRTERR
Offset
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
3.9
Not used
29/31
Revision history
PM0075
Revision history
Table 12.
30/31
Date
Revision
Changes
30-Aug-2010
27-Aug-2012
PM0075
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.
UNLESS EXPRESSLY APPROVED IN WRITING BY TWO AUTHORIZED ST REPRESENTATIVES, ST PRODUCTS ARE NOT
RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING
APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY,
DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE
GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USERS OWN RISK.
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.
31/31