3 Embedded Flash memory interface
3 Embedded Flash memory interface
3.1 Introduction
The Flash memory interface manages CPU AHB I-Code and D-Code accesses to the Flash
memory. It implements the erase and program Flash memory operations and the read and
write protection mechanisms.
The Flash memory interface accelerates code execution with a system of instruction
prefetch and cache lines.
!("
53" (3 PERIPH
%THERNET
-36
!("
##- DATA PERIPH
!("
2!-
BIT
$-! SYSTEM BUS 32!- AND
EXTERNAL
$-!
MEMORIES
$-!$ !("
PERIPH
,#$ 4&4
53" (3
%THERNET
Table 6. Flash module - 2 Mbyte dual bank organization (STM32F42xxx and STM32F43xxx)
Block Bank Name Block base addresses Size
DB1M=0 DB1M=1
Main memory Sector number Sector size Main memory Sector number Sector size
Sector 0 16 Kbytes Sector 0 16 Kbytes
Sector 1 16 Kbytes Sector 1 16 Kbytes
Sector 2 16 Kbytes Sector 2 16 Kbytes
Sector 3 16 Kbytes Bank 1 Sector 3 16 Kbytes
Sector 4 64 Kbytes 512KB Sector 4 64 Kbytes
Sector 5 128 Kbytes Sector 5 128 Kbytes
Sector 6 128 Kbytes Sector 6 128 Kbytes
Sector 7 128 Kbytes Sector 7 128 Kbytes
1MB
Sector 8 128 Kbytes Sector 12 16 Kbytes
Sector 9 128 Kbytes Sector 13 16 Kbytes
Sector 10 128 Kbytes Sector 14 16 Kbytes
Sector 11 128 Kbytes Bank 2 Sector 15 16 Kbytes
- - 512KB Sector 16 64 Kbytes
- - Sector 17 128 Kbytes
- - Sector 18 128 Kbytes
- - Sector 19 128 Kbytes
Table 9. 1 Mbyte dual bank Flash memory organization (STM32F42xxx and STM32F43xxx)
Block Name Block base addresses Size
3.5.1 Relation between CPU clock frequency and Flash memory read time
To correctly read data from Flash memory, the number of wait states (LATENCY) must be
correctly programmed in the Flash access control register (FLASH_ACR) according to the
frequency of the CPU clock (HCLK) and the supply voltage of the device.
The prefetch buffer must be disabled when the supply voltage is below 2.1 V. The
correspondence between wait states and CPU clock frequency is given in Table 10 and
Table 11.
Note: On STM32F405xx/07xx and STM32F415xx/17xx devices:
- when VOS = '0', the maximum value of fHCLK = 144 MHz.
- when VOS = '1', the maximum value of fHCLK = 168 MHz.
On STM32F42xxx and STM32F43xxx devices:
- when VOS[1:0] = '0x01', the maximum value of fHCLK is 120 MHz.
- when VOS[1:0] = '0x10', the maximum value of fHCLK is 144 MHz. It can be extended to
168 MHz by activating the over-drive mode.
- when VOS[1:0] = '0x11, the maximum value of fHCLK is 168 MHz. It can be extended to
180 MHz by activating the over-drive mode.
- The over-drive mode is not available when VDD ranges from 1.8 to 2.1 V.
Refer to Section 5.1.4: Voltage regulator for STM32F42xxx and STM32F43xxx for details on
how to activate the over-drive mode.
Table 10. Number of wait states according to CPU clock (HCLK) frequency
(STM32F405xx/07xx and STM32F415xx/17xx)
HCLK (MHz)
Wait states (WS) Voltage range
(LATENCY) Voltage range Voltage range Voltage range
1.8 V - 2.1 V
2.7 V - 3.6 V 2.4 V - 2.7 V 2.1 V - 2.4 V
Prefetch OFF
0 WS (1 CPU cycle) 0 < HCLK ≤30 0 < HCLK ≤24 0 < HCLK ≤22 0 < HCLK ≤20
1 WS (2 CPU cycles) 30 < HCLK ≤60 24 < HCLK ≤48 22 < HCLK ≤44 20 <HCLK ≤40
2 WS (3 CPU cycles) 60 < HCLK ≤90 48 < HCLK ≤72 44 < HCLK ≤66 40 < HCLK ≤60
3 WS (4 CPU cycles) 90 < HCLK ≤120 72 < HCLK ≤96 66 < HCLK ≤88 60 < HCLK ≤80
4 WS (5 CPU cycles) 120 < HCLK ≤150 96 < HCLK ≤120 88 < HCLK ≤110 80 < HCLK ≤100
5 WS (6 CPU cycles) 150 < HCLK ≤168 120 < HCLK ≤144 110 < HCLK ≤132 100 < HCLK ≤120
6 WS (7 CPU cycles) 144 < HCLK ≤168 132 < HCLK ≤154 120 < HCLK ≤140
7 WS (8 CPU cycles) 154 < HCLK ≤168 140 < HCLK ≤160
Table 11. Number of wait states according to CPU clock (HCLK) frequency
(STM32F42xxx and STM32F43xxx)
HCLK (MHz)
Wait states (WS) Voltage range
(LATENCY) Voltage range Voltage range Voltage range
1.8 V - 2.1 V
2.7 V - 3.6 V 2.4 V - 2.7 V 2.1 V - 2.4 V
Prefetch OFF
0 WS (1 CPU cycle) 0 <HCLK ≤30 0 <HCLK ≤24 0 <HCLK ≤22 0 < HCLK ≤20
1 WS (2 CPU cycles) 30 <HCLK ≤60 24 < HCLK ≤48 22 <HCLK ≤44 20 <HCLK ≤40
2 WS (3 CPU cycles) 60 <HCLK ≤90 48 < HCLK ≤72 44 < HCLK ≤66 40 < HCLK ≤60
3 WS (4 CPU cycles) 90 <HCLK ≤120 72 < HCLK ≤96 66 <HCLK ≤88 60 < HCLK ≤80
4 WS (5 CPU cycles) 120 <HCLK ≤150 96 < HCLK ≤120 88 < HCLK ≤110 80 < HCLK ≤100
5 WS (6 CPU cycles) 150 <HCLK ≤180 120 <HCLK ≤144 110 < HCLK ≤132 100 < HCLK ≤120
6 WS (7 CPU cycles) 144 <HCLK ≤168 132 < HCLK ≤154 120 < HCLK ≤140
7 WS (8 CPU cycles) 168 <HCLK ≤180 154 <HCLK ≤176 140 < HCLK ≤160
8 WS (9 CPU cycles) 176 <HCLK ≤180 160 < HCLK ≤168
After reset, the CPU clock frequency is 16 MHz and 0 wait state (WS) is configured in the
FLASH_ACR register.
It is highly recommended to use the following software sequences to tune the number of
wait states needed to access the Flash memory with the CPU frequency.
Note: A change in CPU clock configuration or wait state (WS) configuration may not be effective
straight away. To make sure that the current CPU clock frequency is the one you have
configured, you can check the AHB prescaler factor and clock source status values. To
make sure that the number of WS you have programmed is effective, you can read the
FLASH_ACR register.
Instruction prefetch
Each Flash memory read operation provides 128 bits from either four instructions of 32 bits
or 8 instructions of 16 bits according to the program launched. So, in case of sequential
code, at least four CPU cycles are needed to execute the previous read instruction line.
Prefetch on the I-Code bus can be used to read the next sequential instruction line from the
Flash memory while the current instruction line is being requested by the CPU. Prefetch is
enabled by setting the PRFTEN bit in the FLASH_ACR register. This feature is useful if at
least one wait state is needed to access the Flash memory.
Figure 5 shows the execution of sequential 32-bit instructions with and without prefetch
when 3 WSs are needed to access the Flash memory.
& $ %
7!)4
7ITHOUT PREFETCH
& $ %
& $ %
& $ %
& $ %
7!)4
& $ %
& $
&
!(" PROTOCOL
INS INS INS INS INS INS INS INS
FETCH FETCH FETCH FETCH FETCH FETCH FETCH FETCH ADDRESS REQUESTED
& &ETCH STAGE
$ $ECODE STAGE
2EAD INS 'IVES INS 'IVES INS % %XECUTE STAGE
-36
When the code is not sequential (branch), the instruction may not be present in the currently
used instruction line or in the prefetched instruction line. In this case (miss), the penalty in
terms of number of cycles is at least equal to the number of wait states.
Data management
Literal pools are fetched from Flash memory through the D-Code bus during the execution
stage of the CPU pipeline. The CPU pipeline is consequently stalled until the requested
literal pool is provided. To limit the time lost due to literal pools, accesses through the AHB
databus D-Code have priority over accesses through the AHB instruction bus I-Code.
If some literal pools are frequently used, the data cache memory can be enabled by setting
the data cache enable (DCEN) bit in the FLASH_ACR register. This feature works like the
instruction cache memory, but the retained data size is limited to 8 rows of 128 bits.
Note: Data in user configuration sector are not cacheable.
Note: The FLASH_CR register is not accessible in write mode when the BSY bit in the FLASH_SR
register is set. Any attempt to write to it with the BSY bit set will cause the AHB bus to stall
until the BSY bit is cleared.
Note: Any program or erase operation started with inconsistent program parallelism/voltage range
settings may lead to unpredicted results. Even if a subsequent read operation indicates that
the logical value was effectively written to the memory, this value may not be retained.
To use VPP, an external high-voltage supply (between 8 and 9 V) must be applied to the VPP
pad. The external supply must be able to sustain this voltage range even if the DC
consumption exceeds 10 mA. It is advised to limit the use of VPP to initial programming on
the factory line. The VPP supply must not be applied for more than an hour, otherwise the
Flash memory might be damaged.
3.6.3 Erase
The Flash memory erase operation can be performed at sector level or on the whole Flash
memory (Mass Erase). Mass Erase does not affect the OTP sector or the configuration
sector.
Sector Erase
To erase a sector, follow the procedure below:
1. Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register
2. Set the SER bit and select the sector out of the 12 sectors (for STM32F405xx/07xx and
STM32F415xx/17xx) and out of 24 (for STM32F42xxx and STM32F43xxx) in the main
memory block you wish to erase (SNB) in the FLASH_CR register
3. Set the STRT bit in the FLASH_CR register
4. Wait for the BSY bit to be cleared
Mass Erase
To perform Mass Erase, the following sequence is recommended:
1. Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register
2. Set the MER bit in the FLASH_CR register (on STM32F405xx/07xx and
STM32F415xx/17xx devices)
3. Set both the MER and MER1 bits in the FLASH_CR register (on STM32F42xxx and
STM32F43xxx devices).
4. Set the STRT bit in the FLASH_CR register
5. Wait for the BSY bit to be cleared
Note: If MERx and SER bits are both set in the FLASH_CR register, mass erase is performed.
If both MERx and SER bits are reset and the STRT bit is set, an unpredictable behavior may
occur without generating any error flag. This condition should be forbidden.
3.6.4 Programming
Standard programming
The Flash memory programming sequence is as follows:
1. Check that no main Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register.
2. Set the PG bit in the FLASH_CR register
3. Perform the data write operation(s) to the desired memory address (inside main
memory block or OTP area):
– Byte access in case of x8 parallelism
– Half-word access in case of x16 parallelism
– Word access in case of x32 parallelism
– Double word access in case of x64 parallelism
4. Wait for the BSY bit to be cleared.
Note: Successive write operations are possible without the need of an erase operation when
changing bits from ‘1’ to ‘0’. Writing ‘1’ requires a Flash memory erase operation.
If an erase and a program operation are requested simultaneously, the erase operation is
performed first.
Programming errors
It is not allowed to program data to the Flash memory that would cross the 128-bit row
boundary. In such a case, the write operation is not performed and a program alignment
error flag (PGAERR) is set in the FLASH_SR register.
The write access type (byte, half-word, word or double word) must correspond to the type of
parallelism chosen (x8, x16, x32 or x64). If not, the write operation is not performed and a
program parallelism error flag (PGPERR) is set in the FLASH_SR register.
If the standard programming sequence is not respected (for example, if there is an attempt
to write to a Flash memory address when the PG bit is not set), the operation is aborted and
a program sequence error flag (PGSERR) is set in the FLASH_SR register.
1. Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register (BSY is active when erase/program operation is on going on bank
1 or bank 2)
2. Set the PG bit in the FLASH_CR register
3. Perform the data write operation(s) to the desired memory address inside main
memory block or OTP area
4. Wait for the BSY bit to be reset.
3.6.6 Interrupts
Setting the end of operation interrupt enable bit (EOPIE) in the FLASH_CR register enables
interrupt generation when an erase or program operation ends, that is when the busy bit
(BSY) in the FLASH_SR register is cleared (operation completed, correctly or not). In this
case, the end of operation (EOP) bit in the FLASH_SR register is set.
If an error occurs during a program, an erase, or a read operation request, one of the
following error flags is set in the FLASH_SR register:
• PGAERR, PGPERR, PGSERR (Program error flags)
• WRPERR (Protection error flag)
• RDERR (Read protection error flag) for STM32F42xxx and STM32F43xxx devices
only.
In this case, if the error interrupt enable bit (ERRIE) is set in the FLASH_CR register, an
interrupt is generated and the operation error bit (OPERR) is set in the FLASH_SR register.
Note: If several successive errors are detected (for example, in case of DMA transfer to the Flash
memory), the error flags cannot be cleared until the end of the successive write requests.
0x1FFF C0000 Reserved ROP & user option bytes (RDP & USER)
SPRMOD and Write protection nWRP bits for
0x1FFF C008 Reserved
sectors 0 to 11
Bit 15:8 0xCC: Level 2, chip protection (debug and boot from RAM features
disabled)
Others: Level 1, read protection of memories (debug features limited)
USER: User option byte
This byte is used to configure the following features:
Select the watchdog event: Hardware or software
Reset event when entering the Stop mode
Reset event when entering the Standby mode
nRST_STDBY
Bit 7 0: Reset generated when entering the Standby mode
1: No reset generated
nRST_STOP
Bit 6 0: Reset generated when entering the Stop mode
1: No reset generated
WDG_SW
Bit 5 0: Hardware independent watchdog
1: Software independent watchdog
BFB2: Dual bank boot
0: Boot from Flash memory bank 1 or system memory depending on boot pin
Bit 4
state (Default).
1: Boot always from system memory (Dual bank boot mode).
Note: The value of an option byte is automatically modified by first erasing the user configuration
sector (bank 1 and 2) and then programming all the option bytes with the values contained
in the FLASH_OPTCR and FLASH_OPTCR1 registers.
--
,EVEL
2$0 !!H
2$0 ##H
7RITE OPTIONS DEFAULT 7RITE OPTIONS
INCLUDING INCLUDING
2$0 ##H 7RITE OPTIONSINCLUDING 2$0 !!H
2$0 ##H !!H
, EV E L , EV E L
2$0 ##H 2$0 !! H
7RITE OPTIONS
INCLUDING
2$0 ##H
/PTIONS WRITE 2$0 LEVEL DECREASE INCLUDES /PTIONS WRITE 2$0 LEVEL IDENTICAL INCLUDES
-ASS ERASE /PTIONS ERASE
/PTIONS ERASE .EW OPTIONS PROGRAM
.EW OPTIONS PROGRAM
AI
When a sector is readout protected (PCROP mode activated), it can only be accessed for
code fetch through ICODE Bus on Flash interface:
• Any read access performed through the D-bus triggers a RDERR flag error.
• Any program/erase operation on a PCROPed sector triggers a WRPERR flag error.
7RITE OPTIONS
30-/$ ACTIVE
AND VALID N720I
,EVEL
2$0 X!!
2$0 X##
7RITE OPTIONS DEFAULT 7RITE OPTIONS .O RESTRICTION ON
30-/$ ACTIVE 30-/$ ACTIVE 7RITE OPTIONS
AND VALID N720I AND VALID N720I
,EVEL ,EVEL
2$0 X## 2$0 X!!
7RITE OPTIONS
30-/$ ACTIVE
7RITE OPTIONS
AND VALID N720I
30-/$ ACTIVE
5SER OPTION SECTOR ERASE AND VALID N720I
0ROGRAM NEW OPTIONS
The deactivation of the SPRMOD and/or the unprotection of PCROPed user sectors can
only occur when, at the same time, the RDP level changes from 1 to 0. If this condition is not
respected, the user option byte modification is cancelled and the write error WRPERR flag
is set. The modification of the users option bytes (BOR_LEV, RST_STDBY, ..) is allowed
since none of the active nWRPi bits is reset and SPRMOD is kept active.
Note: The active value of nWRPi bits is inverted when PCROP mode is active (SPRMOD =1).
If SPRMOD = 1 and nWRPi =1, then user sector i of bank 1, respectively bank 2 is
read/write protected (PCROP).
The OTP area is divided into 16 OTP data blocks of 32 bytes and one lock OTP block of 16
bytes. The OTP data and lock blocks cannot be erased. The lock block contains 16 bytes
LOCKBi (0 ≤i ≤15) to lock the corresponding OTP data block (blocks 0 to 15). Each OTP
data block can be programmed until the value 0x00 is programmed in the corresponding
OTP lock byte. The lock bytes must only contain 0x00 and 0xFF values, otherwise the OTP
bytes might not be taken into account correctly.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Reserved
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DCRST ICRST DCEN ICEN PRFTEN LATENCY[2:0]
Reserved Reserved
rw w rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Reserved
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DCRST ICRST DCEN ICEN PRFTEN LATENCY[3:0]
Reserved Reserved
rw w rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
KEY[31:16]
w w w w w w w w w w w w w w w w
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
KEY[15:0]
w w w w w w w w w w w w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
OPTKEYR[31:16
w w w w w w w w w w w w w w w w
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OPTKEYR[15:0]
w w w w w w w w w w w w w w w w
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
BSY
Reserved
r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PGSERR PGPERR PGAERR WRPERR OPERR EOP
Reserved Reserved
rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
BSY
Reserved
r
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RDERR PGSERR PGPERR PGAERR WRPERR OPERR EOP
Reserved Reserved
rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1 rc_w1
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LOCK ERRIE EOPIE STRT
Reserved Reserved
rs rw rw rs
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PSIZE[1:0] SNB[3:0] MER SER PG
Reserved Res.
rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
LOCK ERRIE EOPIE STRT
Reserved Reserved
rs rw rw rs
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MER1 PSIZE[1:0] SNB[4:0] MER SER PG
Reserved
rw rw rw rw rw rw rw rw rw rw rw
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
nWRP[11:0]
Reserved
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
nRST_ nRST_ WDG_ OPTST OPTLO
RDP[7:0] Reserve BOR_LEV
STDBY STOP SW RT CK
d
rw rw rw rw rw rw rw rw rw rw rw rw rw rs rs
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
SPR
DB1M nWRP[11:0]
MOD Reserved
rw rw rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
nRST_ nRST_ WDG_ OPTST OPTLO
RDP[7:0] BFB2 BOR_LEV
STDBY STOP SW RT CK
rw rw rw rw rw rw rw rw rw rw rw rw rw rw rs rs
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
nWRP[11:0]
Reserved
rw rw rw rw rw rw rw rw rw rw rw rw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Reserved
10
11
9
8
7
6
5
4
3
2
1
0
PRFTEN
DCRST
LATENCY
ICRST
DCEN
ICEN
FLASH_ACR
0x00 Reserved Reserved [2:0]
Reset value 0 0 0 0 0 0 0 0
FLASH_
KEY[31:16] KEY[15:0]
0x04 KEYR
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
FLASH_OPT
OPTKEYR[31:16] OPTKEYR[15:0]
0x08 KEYR
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
WRPERR
PGSERR
PGPERR
PGAERR
OPERR
Reserved
EOP
BSY
FLASH_SR
0x0C Reserved Reserved
Reset value 0 0 0 0 0 0 0
PSIZE[1:0]
EOPIE
LOCK
STRT
Reserved
MER
SER
FLASH_CR SNB[3:0]
PG
0x10 Reserved Reserved Reserved
Reset value 1 0 0 0 0 0 0 0 0 0 0
BOR_LEV[1:0]
nRST_STDBY
nRST_STOP
OPTLOCK
OPTSTRT
WDG_SW
FLASH_
Reserved
nWRP[11:0] RDP[7:0]
0x14 OPTCR Reserved
Reset value 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 0 1
Table 20. Flash register map and reset values (STM32F42xxx and STM32F43xxx)
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
PRFTEN
DCRST
ICRST
DCEN
ICEN
FLASH_ACR LATENCY[3:0]
0x00 Reserved Reserved
Reset value 0 0 0 0 0 0 0 0 0
FLASH_
OPTKEYR[31:16] OPTKEYR[15:0]
OPTKEYR
0x08
Reset value 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
WRPERR
PGSERR
PGPERR
PGAERR
RDERR
OPERR
Reserved
EOP
BSY
FLASH_SR
0x0C Reserved Reserved
Reset value 0 0 0 0 0 0 0 0
Table 20. Flash register map and reset values (STM32F42xxx and STM32F43xxx) (continued)
Offset Register
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
10
11
9
8
7
6
5
4
3
2
1
0
PSIZE[1:0]
EOPIE
MER1
LOCK
STRT
MER
SER
PG
FLASH_CR SNB[4:0]
0x10 Reserved Reserved Reserved
Reset value 1 0 0 0 0 0 0 0 0 0 0 0 0 0
BOR_LEV[1:0]
nRST_STDBY
nRST_STOP
OPTLOCK
OPTSTRT
WDG_SW
SPRMOD
DB1M
BFB2
Reserved
Reset value 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 0 1 1 0 1
FLASH_
Reserved
nWRP[11:0]
OPTCR1
0x18 Reserved
Reset value 1 1 1 1 1 1 1 1 1 1 1 1