7. Embedded flash memory (FLASH)

7.1 Introduction

The embedded flash memory (FLASH) manages the accesses of any master to the 128 Kbytes of embedded non-volatile memory. It implements the read, program and erase operations, error corrections, as well as various integrity and confidentiality protection mechanisms.

The embedded flash memory manages the automatic loading of non-volatile user option bytes at power-on reset, and implements the dynamic update of these options.

The embedded flash memory also features a one-time-programmable (OTP) area and a read-only area provisioned by STMicroelectronics during the product manufacturing.

7.2 FLASH main features

7.3 FLASH functional description

7.3.1 FLASH block diagram

The following figure presents the embedded flash memory block diagram.

Figure 12. Flash block diagram (simplified)

Figure 12: Flash block diagram (simplified). This block diagram illustrates the internal architecture of the embedded flash memory. At the top, external blocks RCC, TAMP, SBS, and DEBUG are shown. RCC provides flash_rst and po_rst signals. TAMP provides tamper_out and tamper_in signals. SBS provides addresses, Product state, and HDP signals. DEBUG provides dbg_en and Cert_ok signals. The main FLASH block contains a 32-bit AHB bus and a 128-bit AHB bus. The 32-bit AHB bus connects to an AHB Interface Configuration port, which in turn connects to Register banks (containing OB words). The 128-bit AHB bus connects to an AHB Interface for user, system flash access, and Read-Only, OTP Area, engi, user Option. This interface connects to Flash Interface Logic. The Flash Interface Logic interacts with IRQ Logic (which outputs flash_it) and two Non-volatile Memory Banks (Bank1 and Bank2). Data paths between the Flash Interface Logic and the memory banks are 128 bits wide. Control and status signals, as well as ECC and redundancy information, are exchanged between the Flash Interface Logic and both memory banks. The entire assembly is labeled FLASH, with the reference MSv68854V3 at the bottom right.
Figure 12: Flash block diagram (simplified). This block diagram illustrates the internal architecture of the embedded flash memory. At the top, external blocks RCC, TAMP, SBS, and DEBUG are shown. RCC provides flash_rst and po_rst signals. TAMP provides tamper_out and tamper_in signals. SBS provides addresses, Product state, and HDP signals. DEBUG provides dbg_en and Cert_ok signals. The main FLASH block contains a 32-bit AHB bus and a 128-bit AHB bus. The 32-bit AHB bus connects to an AHB Interface Configuration port, which in turn connects to Register banks (containing OB words). The 128-bit AHB bus connects to an AHB Interface for user, system flash access, and Read-Only, OTP Area, engi, user Option. This interface connects to Flash Interface Logic. The Flash Interface Logic interacts with IRQ Logic (which outputs flash_it) and two Non-volatile Memory Banks (Bank1 and Bank2). Data paths between the Flash Interface Logic and the memory banks are 128 bits wide. Control and status signals, as well as ECC and redundancy information, are exchanged between the Flash Interface Logic and both memory banks. The entire assembly is labeled FLASH, with the reference MSv68854V3 at the bottom right.

7.3.2 FLASH signals

The flash memory has two AHB connections: the flash AHB register interface and the main AHB interface.

Flash AHB register interface

Main AHB interface

The AHB data bus size is 128 bits.

This interface is used to handle three different targets:

The main AHB interface is implemented as follows:

By default, all the AHB memory range is cacheable. For regions where caching is not practical (OTP, RO), MPU has to be used to disable local cacheability.

7.3.3 Flash memory architecture and usage

Flash memory architecture

The following figure shows the non-volatile memory organization supported by the embedded flash memory.

Figure 13. Embedded flash memory organization

Figure 13. Embedded flash memory organization diagram. The diagram shows the internal structure of the flash memory, including Bank1 and Bank2, connected via Flash Interface Logic to the Main AHB system bus and AHB config port. Bank2 contains System memory (per bank) with 4 sectors of 8 kB each and 9-bit ECC per 128-bit flash word, and a Read-only area. Bank1 contains User main memory (per bank) with 8 sectors of 8 kB each and 9-bit ECC per 128-bit flash word, and a Special region (Bank 1 only) with 6-bit ECC per 16-bit, OTP writable only once, and Read-only writable only by STMicroelectronics. The diagram also shows OTP, Option Bytes, and various access protection labels like 'No user access' and 'Write-protected'.

The diagram illustrates the embedded flash memory organization. It features two main banks, Bank1 and Bank2, managed by Flash Interface Logic. The Main AHB system bus and AHB config port are connected to the Flash Interface Logic. Bank2 is divided into System memory (per bank) and a Read-only area. The System memory (per bank) in Bank2 consists of 4 sectors of 8 kB each, with 9-bit ECC per 128-bit flash word. The Read-only area in Bank2 is labeled 'Read-only'. Bank1 is divided into User main memory (per bank) and a Special region (Bank 1 only). The User main memory (per bank) in Bank1 consists of 8 sectors of 8 kB each, with 9-bit ECC per 128-bit flash word. The Special region (Bank 1 only) has 6-bit ECC per 16-bit, is OTP writable only once, and is Read-only writable only by STMicroelectronics. The diagram also shows OTP, Option Bytes, and various access protection labels like 'No user access' and 'Write-protected'.

Figure 13. Embedded flash memory organization diagram. The diagram shows the internal structure of the flash memory, including Bank1 and Bank2, connected via Flash Interface Logic to the Main AHB system bus and AHB config port. Bank2 contains System memory (per bank) with 4 sectors of 8 kB each and 9-bit ECC per 128-bit flash word, and a Read-only area. Bank1 contains User main memory (per bank) with 8 sectors of 8 kB each and 9-bit ECC per 128-bit flash word, and a Special region (Bank 1 only) with 6-bit ECC per 16-bit, OTP writable only once, and Read-only writable only by STMicroelectronics. The diagram also shows OTP, Option Bytes, and various access protection labels like 'No user access' and 'Write-protected'.

The embedded Flash non-volatile memory is composed of:

The overall flash memory architecture and its corresponding access interface is summarized in Table 24.

Partition usage

The following figure shows how the embedded flash memory is used both by STMicroelectronics and the application software.

Figure 14. Embedded flash memory usage

STM32H503xx NV Memory partition usage showing memory layout under SWAP_BANK=0 and SWAP_BANK=1 modes.
STM32H503xx NV Memory partition usage showing memory layout under SWAP_BANK=0 and SWAP_BANK=1 modes.

User and system memories are used differently according to product state and other option bytes settings:

Note:For more information on option byte setup for boot, refer to Section 7.4.7.

7.3.4 FLASH read operations

Read operation overview

Read access to main flash memory and system flash memory operates as follows:

Read access to OTP, RO operates as follows:

  1. 1. Flash data word of 137 bits is read and stored in a temporary buffer
  2. 2. The interface parses the 137 bits data word and selects the 16-bit or 32-bit data requested
  3. 3. While parsing the 137-bit data word, two wait states are added and the AHB bus is stalled
  4. 4. If the application reads an OTP data not previously written, a double ECC error is reported and only word full of set bits is returned (see Section 7.3.9: OTP and RO memory access for details). The read data (in 16 bits) is stored in FLASH_ECCDR register so that the user can identify if the double ECC error is due to a virgin data or a real ECC error
  5. 5. Reading two times the same address triggers two reads in the flash memory
  6. 6. For 8-bit accesses, an AHB bus error is generated.

Note: The embedded flash memory can perform single-error correction and double-error detection while read operations are being executed (see Section 7.3.8: Flash memory error protections).

Instruction prefetch

The Cortex-M33 fetches instructions and literal pools (constants/data) over the C-Bus and through the instruction cache if it is enabled. The prefetch block aims at increasing the efficiency of C-Bus accesses when the instruction cache is enabled, by reducing the cache refill latency.

Prefetch is efficient in case of sequential code; prefetch in the flash memory allows the next sequential instruction line to be read from the flash memory, while the current instruction line is being filled in instruction cache and executed by the CPU.

Prefetch is enabled by setting the PRFTEN bit in the flash memory access control register (FLASH_ACR). PRFTEN must be set only if at least one wait state is needed to access the Flash memory.

Adjusting read timing constraints

The embedded flash memory clock must be enabled and running before reading data from a non-volatile memory.

To correctly read data from the flash memory, the number of wait states (LATENCY) must be correctly programmed in the Flash access control register (FLASH_ACR) according to the embedded flash memory main AHB interface clock frequency, and the internal voltage range of the device (\(V_{core}\)).

The table below shows the correspondence between the number of wait states (LATENCY), the programming delay parameter (WRHIGHFREQ), the embedded flash memory clock frequency and the supply voltage ranges.

Table 20. FLASH recommended number of wait states and programming delay

Number of wait states
(LATENCY)
Programming delay
(WRHIGHFREQ)
Interface clock frequency v.s. \(V_{core}\) range
VOS3 range
0.95 V - 1.05 V
VOS2 range
1.05 V - 1.15 V
VOS1 range
1.15 V - 1.26 V
VOS0 range
1.30 V - 1.40 V
0 WS
(1 FLASH clock cycle)
00[0 MHz;
20 MHz]
[0 MHz;
30 MHz]
[0 MHz;
34 MHz]
[0 MHz;
42 MHz]
1 WS
(2 FLASH clock cycles)
[20 MHz;
40 MHz]
[30 MHz;
60 MHz]
[34 MHz;
68 MHz]
[42 MHz;
84 MHz]
2 WS
(3 FLASH clock cycles)
01[40 MHz;
60 MHz]
[60 MHz;
90 MHz]
[68 MHz;
102 MHz]
[84 MHz;
126 MHz]
3 WS
(4 FLASH clock cycles)
[60 MHz;
80 MHz]
[90 MHz;
120 MHz]
[102 MHz;
136 MHz]
[126 MHz;
168 MHz]
4 WS
(5 FLASH clock cycles)
10[80 MHz;
100 MHz]
[120 MHz;
150 MHz]
[136 MHz;
170 MHz]
[168 MHz;
210 MHz]
5 WS
(6 FLASH clock cycles)
N/AN/A[170 MHz;
200 MHz]
[210 MHz;
250 MHz]

Note: The voltage range from 1.26 to 1.30 V is not supported.

Adjusting system frequency

After power-on, the embedded flash memory is clocked by the 32 MHz high-speed internal oscillator (HSI), with a voltage range set at a voltage scaling value of VOS3. As a result, a conservative 3 wait-state latency is specified in FLASH_ACR register (see the previous table).

When changing the bus frequency, the application software must follow the sequence described below, in order to tune the number of wait states required to access the non-volatile memory.

To increase the CPU frequency:

  1. 1. If necessary, program the LATENCY and WRHIGHFREQ bits to the right value in the FLASH_ACR register, as described in Table 20.
  2. 2. Check that the new number of wait states is taken into account by reading back the FLASH_ACR register.
  3. 3. Modify the embedded flash memory clock source and/or the clock prescaler in the RCC_CFGR register of the reset and clock controller (RCC).
  4. 4. Check that the new embedded flash memory clock source and/or the new AHB clock prescaler value are taken in account by reading back the embedded flash memory

clock source status and/or the prescaler value in the RCC_CFGR register of the reset and clock controller (RCC).

To decrease the CPU frequency:

  1. 1. Modify the embedded flash memory clock source and/or the clock prescaler in the RCC_CFGR register of reset and clock controller (RCC).
  2. 2. Check that the embedded flash memory new clock source and/or the new clock prescaler value are taken in account by reading back the embedded flash memory clock source status and/or the AHB interface prescaler value in the RCC_CFGR register of reset and clock controller (RCC).
  3. 3. If necessary, program the LATENCY and WRHIGHFREQ bits to the right value in FLASH_ACR register, as described in Table 20.
  4. 4. Check that the new number of wait states has been taken into account by reading back the FLASH_ACR register.

Error code correction (ECC)

The embedded flash memory embeds an error correction mechanism. Single-error correction and double-error detection are performed for each read operation. For more details, refer to Section 7.3.8: Flash memory error protections.

Read errors

When the ECC mechanism is not able to correct the read operation, the embedded flash memory reports read errors as described in Section 7.8.6: Error correction code error (ECCC/ECCD)

Read interrupts

See Section 7.9: FLASH interrupts for details.

7.3.5 FLASH program operations

Program operation overview

Program operation consists in issuing write commands. The embedded flash memory supports the execution of only one write-command at a time. Write-while-write are not supported. Nothing prevents overwriting a non-virgin flash word but this is not recommended. The result may lead to invalid data and inconsistent ECC code.

User Flash and system Flash memories sectors:

For the user and system flash memories, 9-bits ECC is associated to each 128-bits data Flash word. In this case, the embedded flash memory must always perform write operations to non-volatile memory with a 128-bit word granularity. Once the write buffer is full (128 bits), the Busy flag is set and a programming operation is triggered.

There is a write buffer common to Bank1 and 2 which support multiple write-access types (128, 64, 32, 16 or 8 bits). The application can decide to write as little as 8 bits to a 128 Flash word. In this case, a force-write mechanism to the 128 bits + ECC is used (see NSFW bit of FLASH_NSCR register).

When the write request is issued to the memory any new write request stalls the main AHB bus.

Moreover, while a write operation is ongoing, any new read request to the same bank stalls the main AHB bus.

OTP and RO:

When the target memory is OTP, RO sectors, 6-bits ECC code is associated to each 16-bit data Flash word. The embedded flash memory supports 16-bit or 32-bit write operations (8-bit write operations are not supported). For 8-bit accesses, write accesses are ignored. There is no write data buffer. Each write access triggers a write in the flash memory.

Note: The OTP area is typically write-protected on the final product, as described in Section 7.3.9: OTP and RO memory access.

The write protection check is performed at the reception of the write request (during address phase). Write protection is not checked anymore at the output of the write buffer. If a write protection violation is detected, the write operation is canceled and write protection error (WRPERR) is raised in FLASH_NSSR register.

For write protections of main Flash, ICP, and OTP see Section 7.5.

Monitoring ongoing write operations

The application software can use a status flags located in FLASH_NSSR to monitor ongoing write operations. Since only one operation is possible at a time, this flag indicates if any operation (write, erase, option change) is ongoing; whatever the banks.

They are cleared when the current operation is ending or in case of error.

Note: If the flash memory is busy at the receipt of the AHB write request, the CPU execution is stalled.

Enabling write operations

Before programming the user flash memory in Bank1 or in Bank2, the application software must make sure that the PG bit is set to 1 in FLASH_NSCR. If it is not the case, an unlock sequence must be used (see Section 7.5.5: Flash memory configuration protection) and the PG bit must be set.

When the option bytes must be modified, the application software must make sure that FLASH_OPTCR is unlocked. If this is not the case, an unlock sequence must be used (see Section 7.5.5: Flash memory configuration protection).

Note: The application software must not unlock an already unlocked register, otherwise this register remains locked until the next system reset.

If needed, the application software can update the programming delay, as described in Adjusting programming timing constraints.

Writing to the FLASH control register FLASH_NSCR and FLASH_OPTCR

The FLASH_NSCR, FLASH_OPTCR registers are not accessible in write mode when the BSY bit is set. Any attempt to write these registers while the BSY bit is set causes the AHB bus to stall until BSY bit is cleared.

Single-write sequence

The recommended single-write sequence is the following:

  1. 1. Make sure protection mechanism does not prevent to attempt programming
  2. 2. Check that no flash memory operation is ongoing by checking the BSY bit in the FLASH_NSSR register and DBNE bits in the FLASH_NSSR register. Check that the write buffer is empty by checking the NSWBNE bit in the FLASH_NSSR register
  3. 3. Check and clear all the error flags due to previous programming/erase operation
  4. 4. Unlock the FLASH_NSCR register, as described in Section 7.5.5: Flash memory configuration protection (only if register is not already unlocked)
  5. 5. Enable write operations by setting PG bit in the FLASH_NSCR register
  6. 6. Write one Flash-word at aligned address

Note: NSWBNE flag indicates if the 128-bit write buffer is waiting for new data.

Note: No erase request, options change request is allowed between the first write and the completion of the Flash write operation.

  1. 7. Wait for the BSY bit to be cleared in the corresponding FLASH_NSSR register
  2. 8. Clear PG bit in FLASH_NSCR register if there are not any more programming requests

If step 6 is executed incrementally (for example byte per byte), the write buffer can become partially filled. In this case the application software can decide to force-write what is stored in the write buffer by using NSFW bit in FLASH_NSCR register. In this particular case, the unwritten bits are automatically set to 1. If no bit in the write buffer is cleared to 0, the NSFW bit has no effect.

Note: Using a force-write operation prevents the application from updating later the missing bits with a value different from 1, which is likely to lead to a unexpected or inconsistent data or ECC.

Adjusting programming timing constraints

Program operation timing constraints depend of the embedded flash memory clock frequency, which directly impacts the performance. If timing constraints are too tight, the non-volatile memory does not operate correctly, if they are too lax, the programming speed is not optimal.

The user must therefore trim the optimal programming delay through the WRHIGHFREQ parameter in the FLASH_ACR register. Refer to Table 20 in Section 7.3.4: FLASH read operations for the recommended programming delay depending on the embedded flash memory clock frequency.

FLASH_ACR configuration register is common to both banks.

The application software must check that no program/erase operation is ongoing before modifying WRHIGHFREQ parameter.

Caution: Modifying WRHIGHFREQ while programming/erasing the flash memory can corrupt the flash memory content.

Programming errors

When a program operation fails, an error can be reported as described in Section 7.8: FLASH error management.

Programming interrupts

See Section 7.9: FLASH interrupts for details.

7.3.6 FLASH erase operations

Erase operation overview

The embedded flash memory can perform erase operations on 8-Kbyte user sectors, on one user flash memory bank or on two user flash memory banks (for example mass erase).

For more details in user flash memory, user options and OTP erase protection see Section 7.5: FLASH security and protections.

Erase commands are issued through the AHB configuration interface. Since the embedded flash memory supports one operation at a time, if it receives simultaneously a write and an erase request an error flag is raised and both operation are canceled. See Section 7.8: FLASH error management for details.

Erase and WRP

If the application software attempts to erase a user sector that is write protected, the sector erase operation is aborted and the WRPERR flag is raised in the FLASH_NSSR register, as described in Section 7.8.2: Write protection error (WRPERR).

Flash Busy

Busy signals is described in Section : Monitoring ongoing write operations in Section 7.3.5: FLASH program operations

Writing to the FLASH control register FLASH_NSCR and FLASH_OPTCR

Refer to Writing to the FLASH control register FLASH_NSCR and FLASH_OPTCR in Section 7.3.5: FLASH program operations

Enabling erase operations

Before erasing a sector, the application software must make sure that FLASH_NSCR is unlocked. If this is not the case, an unlock sequence must be used (see Section 7.5.5: Flash memory configuration protection).

Note: The application software must not unlock a register that is already unlocked, otherwise this register remains locked until next system reset. This can be used to deliberately lock-out a register from further accesses.

Similar constraints apply to bank erase requests.

Flash sector erase sequence

To erase a 8-Kbyte user sector , proceed as follows:

  1. 1. Make sure protection mechanism does not prevent to attempt sector erase (WRP, HDP).
  2. 2. Check that no flash memory operation is ongoing by checking the BSY and DBNE bits in the FLASH_NSSR register and that the write buffer is empty by checking the WBNE bit in the FLASH_NSSR register.
  3. 3. Check and clear all the error flags due to previous programming/erase operation. Refer to Section 7.8: FLASH error management for details
  4. 4. Unlock the FLASH_NSCR register, as described in Section 7.5.5: Flash memory configuration protection (only if register is not already unlocked)
  5. 5. Set the BKSEL bit, the SER bit and SNB bitfield in the FLASH_NSCR register. BKSEL indicates in which physical bank sector has to be erased, then SER indicates a sector erase operation, while SNB contains the target sector number.
  6. 6. Set the STRT bit in the FLASH_NSCR register.
  7. 7. Wait for the BSY bit to be cleared in the FLASH_NSSR register.
  8. 8. STRT bit is automatically cleared at the end of the sector erase or in case of error.
  9. 9. Clear SER in FLASH_NSCR register if there are not anymore sector erase request to be issued.

Note: If another erase flag is requested simultaneously to the sector erase, an PGSERR error is generated.

Standard flash memory bank erase sequence

To erase bank :

  1. 1. Make sure protection mechanism does not prevent to attempt sector erase.
  2. 2. Check that no flash memory operation is ongoing by checking the BSY and DBNE bits in the FLASH_NSSR register and that the write buffer is empty by checking the WBNE bit in the same register.
  3. 3. Check and clear all the error flags due to previous programming/erase operation. Refer to Section 7.8: FLASH error management for details.
  4. 4. Unlock the FLASH_NSCR register, as described in Section 7.5.5: Flash memory configuration protection (only if register is not already unlocked).
  5. 5. Set the BKSEL bit and the BER bit in the FLASH_NSCR register to the targeted physical bank (swap setting is ignored).
  6. 6. Set the STRT bit in the FLASH_NSCR register to start the bank erase operation. Then wait until the BSY bit is cleared in the FLASH_NSSR register.
  7. 7. STRT bit is automatically cleared at the end of erase sequence or in case of error.
  8. 8. Clear BER in FLASH_NSCR register if there is not other bank erase request to be issued.

Flash mass erase sequence

The application software can set the MER bit to 1 in FLASH_NSCR register, as described below:

  1. 1. Make sure protection mechanisms do not prevent to attempt mass erase (Chapter 7.5)
  2. 2. Check that no flash memory operation is ongoing by checking the BSY and DBNE bits in the FLASH_NSSR register and that the write buffer is empty by checking the WBNE bit in the FLASH_NSSR register
  3. 3. Check and clear all the error flags due to previous programming/erase operation. Refer to Section 7.8: FLASH error management for details
  4. 4. Unlock the FLASH_NSCR register as described in Section 7.5.5: Flash memory configuration protection (only if the registers are not already unlocked)
  5. 5. Set the MER bit to 1 in FLASH_NSCR register
  6. 6. Set the STRT bit in the FLASH_NSCR register. Then wait until BSY bit is cleared in the FLASH_NSSR register
  7. 7. STRT bit is cleared automatically at the end of the erase sequence or in case of error
  8. 8. Clear MER in FLASH_NSCR register

7.3.7 FLASH parallel operations

Since the non-volatile memory is divided into two independent banks but encapsulated in the same macro, the embedded flash memory interface only supports reading in one bank while writing or erasing is executed in the other bank. This feature is called read-while-write capability (RWW). It does not support write-while-write or read-while-read.

In all cases, the sequences are described in Section 7.3.4: FLASH read operations, Section 7.3.5: FLASH program operations and Section 7.3.6: FLASH erase operations apply.

7.3.8 Flash memory error protections

Error correction codes (ECC)

The embedded flash memory supports an error correction code (ECC) mechanism. It is based on the SECDED algorithm in order to correct single errors and detect double errors.

This mechanism uses 9 ECC bits per 128-bit Flash word, and applies to user and system memory. For read-only, OTP, a stronger 6 ECC bits per 16-bit word is used. A double ECC error is generated for an OTP virgin word (for example a word with 22 bits at 1). When this OTP word is no more virgin, the ECC error disappears.

More specifically, during each read operation from a 128-bit Flash word, the embedded flash memory retrieves the 9-bit ECC information, computes the ECC of the Flash word, and compares the result with the reference value. If they do not match, the corresponding ECC error is raised as described in Section 7.8.6: Error correction code error (ECCC/ECCD)

During each program operation, a 9-bit ECC code is associated to each 128-bit data Flash word, and the resulting 137-bit Flash word information is written in non-volatile memory.

A similar mechanism applies to read-only and OTP areas, but with 6-bit ECC for 16-bit data.

7.3.9 OTP and RO memory access

OTP and RO memory are accessed through main AHB interface. The OTP is accessible at the address 0x08FF_F000 to 0x08FF_F7FF and the read only section is accessible from 0x08FF_F800 to 0x08FF_FFFF.

FLASH one-time programmable area

The embedded flash memory offers a 2048-byte memory area dedicated to application non-confidential, one-time programmable data (OTP). This area is composed of 1024 words of 16 bits (plus 6 bits of ECC). It cannot be erased, and can be written only once. The OTP area can be accessed through the main AHB interface from address 0x08FF_F000 to 0x08FF_F7FE (last whole readable 16-bit word).

OTP data can be programmed by the application software by chunks of 16 bits. Overwriting an already programmed 16-bit half-word can lead to data and ECC errors and is therefore not supported.

Note: The OTP area is virgin when the device is delivered by STMicroelectronics.

When reading OTP data with a single error corrected or a double error detected, the embedded flash memory reports read errors as described in Section 7.8.6: Error correction code error (ECCC/ECCD).

When reading OTP data not written by the application software (such as virgin OTP), the ECC correction reports a double-error detection (ECCD), and the data are to be found if FLASH_ECCDR register. ECCD implies a NMI raised, unless setting in SBS prevents that.

OTP write protection

OTP data are organized as 32 blocks of 32 OTP words, as shown in Table 21. An entire OTP block can be protected (locked) from write accesses by setting the LOCKBLi (i = 0 to 31) bit corresponding to each OTP block (i = 0 to 31) in the FLASH_OTPBLR option byte register. A block can be write-protected whether or not it has been programmed (even partially).

The OTP block locking operation is irreversible and independent from the product life state.

Note: The OTP area can only be accessed in read mode.

Table 21. Flash memory OTP organization

OTP blockAHB addressAHB wordLock bit
[31:16][15:0]
Block 00x08FF F000OTP001OTP000LOCKBL0
0x08FF F004OTP003OTP002
...
0x08FF F03COTP031OTP030
Block 10x08FF F040OTP033OTP032LOCKBL1
0x08FF F044OTP035OTP034
...
0x08FF F07COTP063OTP062
Block 20x08FF F080OTP065OTP064LOCKBL2
0x08FF F084OTP067OTP066
...
0x08FF F0BCOTP95OTP94
...
Block 310x08FF F7C0OTP993OTP992LOCKBL31
0x08FF F7C4OTP995OTP994
...
0x08FF F7FCOTP1023OTP1022

OTP write sequence

Follow the sequence below to write an OTP word:

  1. 1. Check that no flash memory operation is ongoing by checking the BSY bit in the FLASH_NSSR register and that the data buffer is empty by checking the DBNE bit in the FLASH_NSSR register
  2. 2. Check and clear all the error flags due to previous programming/erase operation.
  3. 3. Set PG bit in the FLASH_NSCR register
  4. 4. Check the protection status of the target OTP word (see Table 21). The corresponding LOCKBLi bit must not be set to 1
  5. 5. Write two OTP words (32 bits) corresponding to the 4-byte aligned address shown in Table 21. Alternatively, the application software can program separately the 16-bit MSB

Note: Do not write twice an OTP 16-bit word, otherwise an ECC error can be generated. Writing OTP data at byte level is not supported and generates a bus error. To avoid data corruption, it is important to complete the OTP write process (for example by reading back the OTP value), before starting an option change.

Flash read-only area

The embedded flash memory offers a 2-Kbyte memory area to store read-only data. This area is mapped as described in Table 22: Read-only public data organization. It can be accessed through the AHB main port. This read-only area is protected by a robust ECC scheme, as explained in Section 7.3.8: Flash memory error protections.

The read-only information that can be used by the application software are described in the table below. This information is programmed by STMicroelectronics.

Table 22. Read-only public data organization

Read-only data nameAddressComment
Unique device ID0x08FF F800U_ID[31:0]
0x08FF F804U_ID[63:32]
0x08FF F808U_ID[96:64]
Flash memory size/
package
0x08FF F80CFlash memory size[15:0] || Package code[15:0]
Reserved0x08FF F810 to
0x08FF FFFF
Reserved information

7.3.10 Flash bank swapping

The embedded flash memory Bank1 and Bank2 can be swapped for the user Flash. This feature can be used after a firmware upgrade to restart the device on the new firmware. Bank swapping is an User Option byte flag controlled by the SWAP_BANK bit of the FLASH_OPTCR register.

Bank specific settings for data area and security attributes follow the original bank and its contents. Control bit always refers to physical bank, not the SWAP_BANK setting.

The following table shows the memory map that can be accessed depending on the SWAP_BANK bit configuration.

Table 24. memory map and the swapping option

Flash memory areaFlash memory corresponding bankStart addressEnd addressSize (bytes)Region name
SWAP_BANK=0SWAP_BANK=1
User main memoryBank1Bank20x0800 00000x0800 1FFF8 KSector 0
0x0800 20000x0800 3FFF8 KSector 1
............
0x0800 E0000x0800 FFFF8 KSector 7
Bank2Bank10x0801 00000x0801 1FFF8 KSector 0
0x0801 20000x0801 3FFF8 KSector 1
............
0x0801 E0000x0801 FFFF8 KSector 7
System memoryBank10x0BF8 00000x0BF8 1FFF8 KSystem 1 Sector 0
0x0BF8 20000x0BF8 3FFF8 KSystem 1 Sector 1
............
0x0BF8 60000x0BF8 7FFF8 KSystem 1 Sector 3
Bank20x0BF9 80000x0BF9 9FFF8 KSystem 2 Sector 0
0x0BF9 A0000x0BF9 BFFF8 KSystem 2 Sector 1
............
0x0BF8 E0000x0BF9 FFFF8 KSystem 2 Sector 3

The SWAP_BANK bit in FLASH_OPTCR register is loaded from the SWAP_BANK option bit only after system reset or POR.

To change the SWAP_BANK bit (for example to apply a new firmware update), respect the sequence below:

  1. 1. Check that no flash memory operation is ongoing by checking the BSY and DBNE bits in the FLASH_NSSR register and that the write buffer is empty by checking the NSWBNE bit in the FLASH_NSSR register
  2. 2. Clear all error flags due to a previous operation
  3. 3. Unlock OPTLOCK bit, if not already unlocked
  4. 4. Set the new desired SWAP_BANK value in the FLASH_OPTSR_PRG register
  5. 5. Start the option byte change sequence by setting the OPTSTRT bit in the FLASH_OPTCR register
  6. 6. Once the option byte change has completed, FLASH_OPTSR_CUR contains the expected SWAP_BANK value, but SWAP_BANK bit in FLASH_OPTCR has not yet been modified and the bank swapping is not yet effective
  7. 7. Force a system reset or a POR. When the reset rises up, the bank swapping is effective (SWAP_BANK value updated in FLASH_OPTCR) and the new firmware shall be executed.

Note: The SWAP_BANK bit in FLASH_OPTCR is read-only and cannot be modified by the application software.

The SWAP_BANK option bit in FLASH_OPTSR_PRG can be modified whatever the product state. Instead of being locked by PRODUCT_STATE, it is locked by NSBOOT_LOCK User OB.

The following figure gives an overview of the bank swapping sequence.

Figure 15. Flash bank swapping sequence

Flowchart of Flash bank swapping sequence. The process starts with 'Begin', followed by 'Update new firmware in user Flash bank 1/2'. Then 'Set/unset SWAP_BANK_OPT option bit in FLASH_OPTSR_PRG'. Next, 'Write START bit in FLASH_OPTCR to start option byte change sequence'. A 'System reset' occurs, leading to 'SWAP_BANK of FLASH_OPTSR_CUR is copied to SWAP_BANK_OPT bit in FLASH_OPTCR'. Finally, 'End' and 'Execution of new firmware'. The diagram also shows the interaction between FLASH_OPTSR_PRG, FLASH_OPTSR_CUR, and FLASH_OPTCR registers, and the AHB bus connecting to User Flash memory SWAP logic and Non-volatile memory Bank1 and Bank2.
graph TD
    Begin([Begin]) --> Update[Update new firmware in user Flash bank 1/2]
    Update --> Set[Set/unset SWAP_BANK_OPT option bit in FLASH_OPTSR_PRG]
    Set --> Write[Write START bit in FLASH_OPTCR to start option byte change sequence]
    Write --> Reset1[System reset]
    Reset1 --> Copy[SWAP_BANK of FLASH_OPTSR_CUR is copied to SWAP_BANK_OPT bit in FLASH_OPTCR]
    Copy --> End([End])
    End --> Execution[Execution of new firmware]

    subgraph Registers
        FLASH_OPTSR_PRG[FLASH_OPTSR_PRG: SWAP BANK OPT]
        FLASH_OPTSR_CUR[FLASH_OPTSR_CUR: SWAP BANK OPT]
        FLASH_OPTCR[FLASH_OPTCR: SWAP BANK]
    end

    FLASH_OPTSR_PRG -- "Option byte programming" --> NonVol[Non-volatile memory]
    NonVol -- "Option byte reload" --> FLASH_OPTSR_CUR
    FLASH_OPTSR_CUR -- "System reset option byte reload" --> FLASH_OPTCR
    FLASH_OPTCR -- "New swap policy effective" --> SWAPLogic[User Flash memory SWAP logic]
    SWAPLogic <-->|AHB bus| NonVolBank1[Non-volatile memory Bank1]
    SWAPLogic <-->|AHB bus| NonVolBank2[Non-volatile memory Bank2]
    
Flowchart of Flash bank swapping sequence. The process starts with 'Begin', followed by 'Update new firmware in user Flash bank 1/2'. Then 'Set/unset SWAP_BANK_OPT option bit in FLASH_OPTSR_PRG'. Next, 'Write START bit in FLASH_OPTCR to start option byte change sequence'. A 'System reset' occurs, leading to 'SWAP_BANK of FLASH_OPTSR_CUR is copied to SWAP_BANK_OPT bit in FLASH_OPTCR'. Finally, 'End' and 'Execution of new firmware'. The diagram also shows the interaction between FLASH_OPTSR_PRG, FLASH_OPTSR_CUR, and FLASH_OPTCR registers, and the AHB bus connecting to User Flash memory SWAP logic and Non-volatile memory Bank1 and Bank2.

7.3.11 FLASH reset and clocks

Reset management

The embedded flash memory can be reset by a core domain reset, driven by the reset and clock control (RCC). The main effects of this reset are the following:

The embedded flash memory can be reset by a power-on core domain reset, driven by the reset and clock control (RCC). When the reset falls, all option byte registers are reset. When the reset rises up, the option bytes are loaded, potentially applying new features. During this loading sequence, the device remains under reset and the embedded flash memory is not accessible.

Reset occurring during Flash operation

If a reset occurs during a Flash operation (programing, erase or option change), the content of the flash memory is not guaranteed. It is mandatory for flash memory integrity than user restarts operation. The status register FLASH_OPSR gives information if any Flash operation has been interrupted by a reset.

FLASH_OPSR.CODE_OP gives opcode of operation. The following table indicates how to use FLASH_OPSR and which operation is required.

Table 25. Recommended reactions to FLASH_OPSR contents

CODE_OPOperation interruptedOTP_OPSYSF_OPBK_OPFlash areaADDR_O P minADDR_O P maxRecommended action
0x000No Flash operation ongoing while reset000_(1)--No extra action
0x001Write operation000/1User Flash0x00000xFFFFErase sector and rewrite
100OTP0x06000x07FF
0x011Sector erase(2)000/1User Flash0x00000xFFFFRelaunch sector erase
0x100Bank erase000/1User Flash--Relaunch bank erase
0x101Mass erase000User Flash--Relaunch mass erase
0x110Option change000User configuration--New attempt on option change

1. Dash represents “does not matter”.

2. Addresses indicated are aligned to sector start, data area sectors are erased by erase request to corresponding user flash memory sector.

Clock management

The embedded flash memory uses the microcontroller system clock (sys_ck), here the AHB interface clock.

7.4 FLASH option bytes

7.4.1 About option bytes

The embedded flash memory includes a set of non-volatile option bytes. They are loaded at power-on reset and can be read and modified only through configuration registers. This section documents:

7.4.2 Option-byte loading

There are multiple ways of loading the option bytes into embedded flash memory:

1. Power-on wakeup

When the device is first powered, the embedded flash memory automatically loads all the option bytes. During the option byte loading sequence, the device remains under reset and the embedded flash memory cannot be accessed.

2. Wakeup from system Standby

When the core power domain, which contains the embedded flash memory, is switched from Standby mode to Run mode, the embedded flash memory behaves as during a power-on sequence. During loading time the device is not under reset, unlike power-on sequence.

3. Dedicated option byte reloading by the application

When the user application successfully modifies the option byte content through the embedded flash memory registers, the non-volatile option bytes are programmed and the embedded flash memory automatically reloads all option bytes to update the option registers.

Note: The option-byte read sequence is protected by error correction code.

In case of error, the option bytes are loaded with default values (see Section 7.4.3: Option-byte modification). This value differs from the initial values (user default configuration) and tends to be more restrictive.

7.4.3 Option-byte modification

Changing user option bytes

A user option-byte change operation can be used to modify the configuration and the protection settings saved in the non-volatile option byte area.

There are numerous rules enforced when attempting to change a user option byte, they are all summarized in Section 7.4.8: Specific rules for modifying option bytes. Failing to stick to those rules usually results in error, described in Section 7.8.7: Option byte change error (OPTCHANGEERR).

The embedded flash memory features two sets of option byte registers:

When the OPTLOCK bit in FLASH_OPTCR register is set, modifying the FLASH_XXX_PRG registers is not possible.

When OPTSTRT bit is set to 1, the embedded flash memory checks the programming sequence (PGSERR) and the conditions described in Section 7.4.8: Specific rules for modifying option bytes (OPTCHANGEERR). If no error has been detected (PGSERR/OPTCHANGEERR), the embedded flash memory launches the option byte modification in its non-volatile memory and updates the option byte registers with _CUR extension.

If one of the condition described in Section 7.4.8: Specific rules for modifying option bytes, Section 7.8.7: Option byte change error (OPTCHANGEERR) or Section 7.8.3: Programming sequence error (PGSERR) is not respected, the embedded flash memory aborts the option byte change operation. In this case, the FLASH_XXX_PRG registers are not overwritten by current option value. The user application can check what was wrong in their configuration.

Unlocking the option-byte modification

After reset, the OPTLOCK bit is set to 1 and the FLASH_OPTCR is locked. As a result, the application software must unlock the option configuration register before attempting to change the option bytes. The FLASH_OPTCR unlock sequence is described in Section 7.5.5: Flash memory configuration protection.

Option-byte modification sequence

To modify user option bytes, follow the sequence below:

  1. 1. Check that no flash memory operation is ongoing by checking the BSY bit in the FLASH_NSSR register and that the write buffer is empty by checking the NSWBNE bit in the FLASH_NSSR register
  2. 2. Check the data buffer is empty (DBNE=0) in FLASH_NSSR register.
  3. 3. Clear all error flags due to a previous operation
  4. 4. Unlock FLASH_OPTCR register as described in Section 7.5.5: Flash memory configuration protection, unless the register is already unlocked.
  5. 5. Write the desired new option byte values in the corresponding option registers (FLASH_XXX_PRG).
  6. 6. Set the option byte start change OPTSTRT bit to 1 in the FLASH_OPTCR register.
  7. 7. Wait that BSY bit is cleared in FLASH_NSSR register
  8. 8. OPTSTRT bit is cleared automatically at the end of the sequence (or in case of error)
  9. 9. Reset the device. This step is mandatory in case any of the following OB were included in the modification: Product state and NSBOOTADDR. Reset is recommended for other option-byte, but it is not strictly required.

Note: If a reset or a power-down occurs while the option byte modification is ongoing, the original option byte value is kept. A new option byte modification sequence is required to program the new value

7.4.4 Option-byte overview

The following table lists all the user option bytes managed through the embedded flash memory registers, as well as initial values before the first option byte change (user default configuration).

Table 26. Option-byte organization

RegisterBitfield
FLASH_OPTSR[31:16]31302928272625242322212019181716
SWAP_BANKResRes.IWDG_STDBYIWDG_STOPRes.IO_VDDIO2_HSLV
IO_VDD_HSLV
Default factory value0010110100110000
FLASH_OPTSR[15:0]1514131211109876543210
PRODUCT_STATENRST_STDBYNRST_STOPRes.WWDG_SWIWDG_SWBORH_ENBOR_LEV
Default factory value1110110111011000

Table 26. Option-byte organization (continued)

RegisterBitfield
FLASH_OPTSR2[31:16]31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Default factory value1100001100000000
FLASH_OPTSR2[15:0]1514131211109876543210
Res.Res.Res.Res.Res.SRAM1_ECCSRAM1_RSTRes.Res.SRAM2_ECCRes.BKPRAM_ECCSRAM2_RSTRes.Res.Res.
Default factory value0000011001011000
FLASH_NSBOOTR[31:16]31302928272625242322212019181716
NSBOOTADD[23:8]
Default factory value0x0800
FLASH_NSBOOTR[15:0]1514131211109876543210
NSBOOTADD[7:0]NSBOOT_LOCK
Default factory value0x000xC3
FLASH_WRP1R[31:16]31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Default factory value1111111111111111
FLASH_WRP1R[15:0]1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.WRP[7]WRP[6]WRP[5]WRP[4]WRP[3]WRP[2]WRP[1]WRP[0]
Default factory value1111111111111111
FLASH_WRP2R[31:16]31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Default factory value1111111111111111
FLASH_WRP2R[15:0]1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.WRP[7]WRP[6]WRP[5]WRP[4]WRP[3]WRP[2]WRP[1]WRP[0]
Default factory value1111111111111111
FLASH_OTPBLR[31:16]31302928272625242322212019181716
LOCKBL
Default factory value0000000000000000

Table 26. Option-byte organization (continued)

RegisterBitfield
FLASH_OTPBLR[15:0]1514131211109876543210
LOCKBL
Default factory value0000000000000000
FLASH_HDP1R[31:16]31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP1_END
Default factory value0000000000000001
FLASH_HDP1R[15:0]1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP1_STRT
Default factory value0000000000000000
FLASH_HDP2R[31:16]31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP2_END
Default factory value0000000000000001
FLASH_HDP2R[15:0]1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP2_STRT
Default factory value0000000000000000

7.4.5 Description of user and system option bytes

The general-purpose option bytes that can be used by the application are listed below:

Note: If the hardware watchdog “control selection” feature is enabled (set to 0), the watchdog is automatically enabled at power-on, thus generating a reset unless the watchdog key register is written to or the down-counter is reloaded before the end-of-count is reached. Depending on the configuration of IWDG_STOP and IWDG_STDBY options, the IWDG can continue counting (1) or not (0) when the device is in Stop or Standby mode, respectively.

When the IWDG is kept running during Stop or Standby mode, it can wake up the device from these modes.

Note: Whenever a Standby (respectively Stop) mode entry sequence is successfully executed, the device is reset instead of entering Standby (respectively Stop) mode if NRST_STDBY (respectively NRST_STOP) is cleared to 0.

When STMicroelectronics delivers the device, the values programmed in the general-purpose option bytes are the following:

Refer to Section 7.10: FLASH registers for details.

7.4.6 Description of data protection option bytes

The option bytes that can be used to enhance data protection are listed below:

When factory programmed, values of the data protection option bytes are the following:

Refer to Section 7.10: FLASH registers for details.

7.4.7 Description of boot address option bytes

Below the list of option bytes that can be used to configure the appropriate boot address for an application:

When STMicroelectronics delivers the device, the PRODUCT_STATE is Open, BOOT_LOCK is not set (0xC3). Address NSBOOTADD = 0x0800 0000.

Refer to Section 7.10: FLASH registers for details.

7.4.8 Specific rules for modifying option bytes

On top of OPTLOCK bit and register access rules, there are also other protection means for selected security-sensitive option byte fields.

More option bytes can be modified simultaneously, but if they rely on each other for protection, both states are checked.

With few exceptions listed in this chapter, failing to uphold the rules results in raising OPTCHANGEERR flag (Section 7.8.7: Option byte change error (OPTCHANGEERR) for additional details).

Table 27. Specific OB modifying rules overview

OBHDPLValueProduct state
PRODUCT_STATE0,1(1)Set of possible transitionsSet of possible transitions (Table 37)
HDP0,1(1)--
NSBOOTADD--Open or Provisioning, NSBOOT_LOCK disabled
LOCKBL-One way switch(1)-
SWAP_BANK---
NSBOOT_LOCK--Open, Regression or Provisioning to unlock

1. Most transitions are possible regardless of HDPL. Only selected few require specific HDPL, see text below.

Even in the closed PRODUCT_STATE progression, some OB can still be modified, if all the other constraints are satisfied. An overview is presented in the following table.

Table 28. OB modifiable in closed product

PRODUCT_STATEOBs that may be modified
ClosedSWAP_BANK, LOCKBL, PRODUCT_STATE
LockedSWAP_BANK, LOCKBL

Specific rules must be respected to update the following OB:

Note: For all user option bytes above: default values are loaded and Tamper is signaled when a double ECC error occurs during OBL.

7.5 FLASH security and protections

Since sensitive information are stored in the flash memory, it is important to protect it against unwanted operations such as reading confidential areas, illegal programming of immutable sectors, or malicious flash memory erasing.

For that purpose flash memory implements the following protection mechanisms:

This section provides a detailed description of all these security mechanisms.

Two access modes are possible:

The flash memory interface evaluates the access restrictions in the following order:

  1. 1. Write protection (for write access)
  2. 2. HDP
  3. 3. Privilege

7.5.1 Hide protection (HDP)

One non-volatile secure hide protection (HDP) area per bank can be defined with a sector granularity. Access to the hide protection area can be denied by progressing the HDPL level in the SBS.

When the HDPL = 1, no user Flash is protected by the HDP. With HDPL ≥ 2 the user OB defined HDP area in each bank is closed. No read, write, fetch or erase is allowed in the HDP area.

The HDP area can be extended, the extension setting is only a register value, not stored in OB. With HDPL = 3 the HDP area remains activated and the extension is added. If extension is added while the base user OB defined area is not active, the extension covers one more sector, because HDPx_END sector is also protected.

The HDPL level can be only cleared by a system reset, there is no means to deactivate the HDP area.

The protected HDP area is defined by setting its size using start and end sectors .

The size of the inaccessible area can be extended using register FLASH_HDPEXTR values HDPx_EXT. The value HDPx_EXT is a number of sectors added to the HDP area (past the HDPx_END sector). The volatile HDPx_EXT value in the register can be increased, but cannot decrement.

In case of HDPx_STRT > HDPx_END the extension will cover (HDPx_EXT + 1) size area between sectors marked by HDPx_END and HDPx_END + HDPx_EXT.

By default both the HDPx_END is set to zero and HDPx_STRT is set to one. This means that the HDP area in user Flash is zero size and extends from the Flash start address (first sector).

For example, to protect area by HDP from the address 0x0800 2000 (included) to the address 0x0800 5FFF (included):

Figure 16. HDP in user flash memory

Diagram of HDP in user flash memory showing a Flash bank from Sector 0 to Sector 7. A protection region is defined by PSTRT = 0x01 and PEND = 0x03. The region is divided into HDP1- HDPL1 closes and HDP_EXT=0x02.

The diagram illustrates the HDP protection mechanism in user flash memory. A horizontal bar represents the 'Flash bank' from Sector 0 to Sector 7. Above the bar, a protection region is defined by two markers: PSTRT = 0x01 and PEND = 0x03. The region between these markers is divided into two parts: 'HDP1- HDPL1 closes' and 'HDP_EXT=0x02'. The 'Flash bank' label is centered within the bar, and 'Sector 0' and 'Sector 7' are labeled at the ends.

Diagram of HDP in user flash memory showing a Flash bank from Sector 0 to Sector 7. A protection region is defined by PSTRT = 0x01 and PEND = 0x03. The region is divided into HDP1- HDPL1 closes and HDP_EXT=0x02.

Note: For more details on the bank swapping mechanism, refer to Section 7.5.4: Flash memory banks attributes in case of bank swap.

Table 29. HDP protected definition

User FlashOB HDP Area enabledHDP extension enabled
HDPL = 0,1HDP protected = 0HDP protected = 0
HDPL = 2HDP protected = 1HDP protected = 0
HDPL = 3HDP protected = 1HDP protected = 1

Table 30. Secure hide protection

HDPx watermark option bytes values
(x = 1,2)
Hide protection area
HDPL ≤ 1-
No inaccessible HDP area in user Flash

Table 30. Secure hide protection

HDPx watermark option bytes values
(x = 1,2)
Hide protection area
HDPL = 2HDPx_END < HDPx_STRTNo inaccessible HDP area in user flash memory
HDPx_END = HDPx_STRTExactly one sector is protected by HDP
HDPx_END > HDPx_STRTThe area between HDPx_STRT and HDPx_END is HDP protected
HDPL = 3HDPx_END < HDPx_STRT and HDPx_EXT=0No inaccessible HDP area in user flash memory
HDPx_END ≥ HDPx_STRT or HDPx_EXT>0The area between min(HDPx_STRT, HDPx_END) and (HDPx_END + HDPx_EXT) is HDP protected

Table 31. HDP protections summary

HDP protectionUser Flash
Access to OB HDP areaAccess to EXT HDP area
HDPL 2 or 3HDPL0 or HDPL1HDPL3HDPL0, 1 or 2
FetchBUS ERROROKBUS ERROROK
ReadRAZRAZ
WriteWI, WRPERRIf WRP disabled: OK
else: WI, WRPERR
WI, WRPERRIf WRP disabled: OK
else: WI, WRPERR
Erase (mass erase)

7.5.2 Privileged flash memory area protection

Any sector can be programmed on-the-fly as privileged or unprivileged using the configuration registers. FLASH_PRIVBB1x (respectively FLASH_PRIVBB2x) registers are used to configure the privilege attribute for sectors in Bank1 (respectively Bank2).

When the sector privilege attribute PRIVBByx[i] bit is set, the sector is only accessible by a privileged access. An unprivileged sector is accessible by a privileged or unprivileged access.

To modify a block-based privilege attribution, it is recommended to:

Caution: Switching a sector from privileged to unprivileged does not erase the content of the associated sector.

Table 32. Privilege protection summary

AccessMain Flash
Unprivilege sectorPrivilege sector
PrivilegeFetchOK
Read
Write
Erase
UnprivilegeFetchOKRAZ
ReadWI, WRPERR
Write
Erase

Table 33. Privilege and mass or bank erase

AccessMain Flash
Unprivilege FLASHPrivilege FLASHMix unprivilege and privilege FLASH
Privilege mass eraseOK
Unprivilege mass eraseOKWI, WRPERR

Note: For PRIVBByx[ij] access control, refer to Table 34: Privilege configuration register access conditions.

Table 34. Privilege configuration register access conditions

AccessSector setting access in PRIVBBRxy
XP/NPBus error
RP/NPOK
WPOK
WNPWI

7.5.3 Flash memory registers privileged and unprivileged modes

The Flash registers can be read and written by privileged and unprivileged accesses depending on the NSPRIV bits in FLASH privilege configuration register (FLASH_PRIVCFGR).

7.5.4 Flash memory banks attributes in case of bank swap

The SWAP_BANK option bit modifies the address of each bank in the memory map. When SWAP_BANK is reset, Flash Bank1 is mapped at the lower address range. When SWAP_BANK is set, Flash Bank1 is mapped at the higher address range. Flash bank attributes follow their bank contents so there is no need to modify their setting registers when swapping banks:

The SWAP_BANK is rendered immutable by setting NSBOOT_LOCK.

Note: The BK_ECC bit in the FLASH ECC correction register (FLASH_ECCCORR) and FLASH ECC detection register (FLASH_ECCDETR), BKSEL bit in FLASH control register (FLASH_NSCR) always refers to Bank1 (respectively Bank2) when it is low (respectively high), regardless of the SWAP_BANK value.

The figure below shows how security attributes and protections behave in case of bank swap.

Figure 17. Protection attributes in case of bank swap illustration

Diagram illustrating protection attributes in case of bank swap. It shows two memory banks, Bank 1 and Bank 2, each with a specific protection structure. Bank 1 (purple) contains an HDP area (pink) at the top, followed by a Write protection blocks section (yellow), and then a large Bank 1 area. Bank 2 (green) contains a large Bank 2 area with no protections defined. A central 'SWAP' icon with two crossed arrows indicates the swap between the banks. The memory addresses for Bank 1 are 0x0800_0000 to 0x0800_FFFF, and for Bank 2 are 0x0801_0000 to 0x0801_FFFF.

The diagram illustrates the protection attributes in case of bank swap. It shows two memory banks, Bank 1 and Bank 2, each with a specific protection structure. Bank 1 (purple) contains an HDP area (pink) at the top, followed by a Write protection blocks section (yellow), and then a large Bank 1 area. Bank 2 (green) contains a large Bank 2 area with no protections defined. A central 'SWAP' icon with two crossed arrows indicates the swap between the banks. The memory addresses for Bank 1 are 0x0800_0000 to 0x0800_FFFF, and for Bank 2 are 0x0801_0000 to 0x0801_FFFF.

Diagram illustrating protection attributes in case of bank swap. It shows two memory banks, Bank 1 and Bank 2, each with a specific protection structure. Bank 1 (purple) contains an HDP area (pink) at the top, followed by a Write protection blocks section (yellow), and then a large Bank 1 area. Bank 2 (green) contains a large Bank 2 area with no protections defined. A central 'SWAP' icon with two crossed arrows indicates the swap between the banks. The memory addresses for Bank 1 are 0x0800_0000 to 0x0800_FFFF, and for Bank 2 are 0x0801_0000 to 0x0801_FFFF.

7.5.5 Flash memory configuration protection

The embedded flash memory uses hardware mechanisms to protect the following assets against unwanted or spurious modifications (such as software bugs):

The embedded flash memory configuration registers protection is summarized in the next table. Registers not present in this table are not protected by a key.

Table 35. Flash interface register protection summary
Register nameUnlocking registerProtected asset
FLASH_NSCRFLASH_NSKEYRWrite/erase control
FLASH_OPTCRFLASH_OPTKEYRFlash bank option byte words change

7.5.6 Write protection

The purpose of embedded flash memory write protection is to prevent unwanted modifications to embedded non-volatile code and/or data.

Any 8 Kbytes sector can be independently write-protected or unprotected by clearing/setting the corresponding WRP1/2 bit in the FLASH_WRP1/2 register (see FLASH write sector protection for Bank1 (FLASH_WRP1R_CUR) and FLASH write sector protection for Bank2 (FLASH_WRP2R_CUR)).

A write-protected sectors can neither be erased nor programmed. As a result, a bank erase cannot be performed if some sector is write-protected.

Note: Write protection errors are documented in Section 7.8: FLASH error management.

7.5.7 Life cycle management

Non-volatile states, or debug states, are determined by the product state set by user option bytes. Debug possibility and possibility to change selected security settings are related to this state. While the state is stored in the OB, it is the SBS that controls the debug policy.

HDP works equally regardless of the debug state. Even in debug the HDP area is hidden when HDPL increments.

The following states are defined:

Table 36. Product states, debug states and debug policy
PRODUCT_STATECode in OBDescription
Open0xEDUser Flash open (~RDP0)
Provisioning0x17Provisioning - OEM immutable root of trust is being installed.
Provisioned0x2EOEM complete - the OEM immutable root of trust is installed. (~RDP 0.5)
Closed0x72State for running application. Debug disabled, regression is possible.
Locked0x5CTransition to other state, policy change or debug is not permitted.(1)
Regression0x9AThe temporary state initiated by the debug authentication system in transition to Open

1. Effectively the same situation is Closed state with incorrect or not defined debug certificates.

1. no debug protection

Read, program and erase operations into the Flash main memory area are possible. Least restriction on the option bytes.

2. full product protection

All debug features are disabled:

7.5.8 Product state transitions

Progressing to more closed state is the normal product life cycle, that does not require security measures. Transition in direction to open state is a regression, controlled by the debug authentication control. If debug unlock policy is set to “locked”, no regression is accepted. Locked state may be reinforced by invalidating the debug authentication certificates.

All transitions not listed in this chapter are invalid.

There is no restriction on reading the current product state.

Transitions in progress direction

Transition from Open to any of the closed states is matter of correct product configuration and provisioning. The transitions must be done in correct order.

The normal progression is:

Transition is managed either by a software running on the device, or directly, using a debug interface. By software it is assumed that transitions are triggered by bootloader, or root of trust services, but generally any software running on the device can do a progress transition.

Transition to open debug state

This transition is a full regression. The starting state is any except Open and Locked. The debug tools are used to authenticate debug regression access rights with the debug authentication library, running on the device in HDPL=1 (refer to Section 13.3.6: SBS debug control). After verifying the credentials, it puts the device into intermediate state Regression. From this state the device regresses securely in HDPL=0 to Open.

The transition has the following consequence:

Table 37. PRODUCT_STATE transitions

FromTo(1)
OpenProvisioningProvisionedClosedLocked(Full) regression
Open-OKOKXXX
ProvisioningX-OKOKOKOK (HDPL1)
ProvisionedXX-OKOKOK (HDPL1)
ClosedXXX-XOK (HDPL1)
LockedXXXX-X
(Full) regressionOK (HDPL0)XXXX-

In the Table 37: PRODUCT_STATE transitions the X marks transitions that are not permitted, dash marks no change, OK marks valid transitions. Some transitions are only possible in correct HDPL provided in parenthesis. Attempt to do a illegal transition results on OPTCHANGEERR.

Incorrect PRODUCT_STATE (on OBL) is interpreted as Locked.

7.5.9 One-time-programmable and read-only memory protections

Sections of OTP/RO in the flash memory are described in details in Section 7.3.9: OTP and RO memory access. There is no protection provided by the Flash interface other than the dedicated write protection.

No write is possible to the RO area, once it was established in manufacturing. The OTP write protection section describes a method of locking out the OTP area.

The access conditions are summarized in the following table.

Table 38. OTP/RO access constraints
-8 Kbytes sector dedicated to RO/OTP
0x08FF_E000 - E7FF0x08FF_E800 - EFFF
Reserved
0x08FF_F000 - F7FF
OTP
0x08FF_F800 - FFFF
RO
XBUS ERRORBUS ERROR
RIf correct size(1) RAZ,
else Bus Error
If correct size OK, else Bus Error
WIf correct size WI, else
Bus Error
Bus Error if incorrect
size.
WRPERR if block is
protected by
LOCKBL, else OK.
If correct size WI, else
Bus Error
eraseWI

1. Word size is 16-bits, 32b access is possible. Other access attempt leads to bus error.

7.6 System memory

7.6.1 System memory introduction

System memory stores RSS (root secure services) firmware that is programmed by ST during STM32H503xx production. The RSS provides runtime services to user firmware. These services are described hereafter in this section.

7.6.2 RSS user functions

The RSS provides runtime services thanks to RSS library. As other microcontroller peripherals features and mapping, the RSS library functions are exposed to user within the CMSIS device header file provided by the STM32CubeH5 firmware package. Please refer to UM2656 to get more details regarding STM32CubeH5 firmware package. RSS library provides runtime services through prefixed NSSLIB functions.

Table 39. C defined macro for RSS services
C defined macroLocation in flash memory
NSSLIB_PFUNC0x0BF8FE6C

NSSLIB

The user firmware calls NSSLIB functions using NSSLIB_PFUNC C defined macro, that points to a location within system memory.

Table 40. NSSlib interface function list
LibraryFunction
NSSLIB_PFUNCJumpHDPLvl2
JumpHDPLvl3

The NSSLIB functions are described within section hereafter.

a) JumpHDPLvl2

Prototype:

uint32_t JumpHDPLvl2(uint32_t VectorTableAddr, uint32_t MPUIndex)

User code function call example:

NSSLIB_PFUNC->JumpHDPLvl2((uint32_t)NextVectorTableAddr, 1U );

Arguments:

Input parameter, address of the next vector table to apply.

The vector table format is the one used by the Cortex-M33 core.

Input parameter, MPU region index. Caller function shall define but keep disable the corresponding MPU region before calling JumpHDPLvl2. The function enables the MPU region before jumping to the Reset Handler of the vector table. The vector table Reset Handler function shall belong to the MPU region.

Descriptions:

User calls JumpHDPLvl2 to:

After closing HDPL1, JumpHDPLvl2 enables the MPU region provided as input parameter. Once the MPU is enabled, the function sets the SP to the address provided by the passed Vector Table and jumps to the Reset Handler function supported by the Vector Table too. JumpHDPLvl2 does not set the new vector table.

On successful execution, the function does not return and does not push LR onto the stack.

Errors:

In case of failure (bad input parameter value), RSSLIB_Sec_JumpHDPLvl2 returns 0xF5F5F5F5.

b) JumpHDPLvl3

Prototype

uint32_t JumpHDPLvl3(uint32_t VectorTableAddr, uint32_t MPUIndex)

User code function call example:

NSSLIB_PFUNC->JumpHDPLvl3((uint32_t)NextVectorTableAddr, 1U );

Arguments:

Descriptions:

User calls JumpHDPLvl3 to:

After closing HDPL1/2, JumpHDPLvl3 enables the MPU region provided as input parameter. Once the MPU is enabled, the function sets the SP to the address provided by the passed Vector Table and jumps to the Reset Handler function supported by the Vector Table too. JumpHDPLvl3 does not set the new vector table.

On successful execution, the function does not return and does not push LR onto the stack.

Errors:

In case of failure (bad input parameter value), JumpHDPLvl3 returns 0xF5F5F5F5.

7.7 FLASH low-power modes

Table 41 summarizes the behavior of embedded flash memory in STM32 low-power modes. Embedded flash memory belongs to the core domain.

Table 41. Effect of low-power modes on the embedded flash memory

Power modeCore domain voltage rangeAllowed if FLASH BusyFLASH power mode
Run/SleepVOS0/1/2/3YesRun
Stop (clock stopped)SVOS3/4/5NoClock gated (in normal or Low-power mode)(1)
StandbyOffNoOff

1. Flash is forced in Low-power mode when SVOS5 is selected.

When the system state changes or within a given system state, the embedded flash memory might get a different voltage supply range (VOS) according to the application. The procedure to switch the embedded flash memory into various power mode (run, clock gated, stopped, off) is described hereafter.

Note: For more information in the microcontroller power states, refer to the Power control section (PWR).

Managing the FLASH domain switching to Stop or Standby

As explain in Table 41, if the embedded flash memory informs the reset and clock controller (RCC) that it is busy (BSY, DBNE, NS/WBNE is set), the microcontroller cannot switch the core domain to Stop or Standby mode.

There are two ways to release the embedded flash memory:

The microcontroller can then switch the domain to Stop or Standby mode.

7.8 FLASH error management

7.8.1 Introduction

The embedded flash memory automatically reports when an error occurs during a read, program or erase operation. A wide range of errors are reported:

The application software can individually enable the interrupt for each error, as detailed in Section 7.9: FLASH interrupts.

Note: For all errors, the application software must clear the error flag before attempting a new modify operation.

Since there is just one write buffer and only one operation is allowed at a time, the write control bits and status bits are shared by both banks:

7.8.2 Write protection error (WRPERR)

When an illegal erase/program operation is attempted to the non-volatile memory, the embedded flash memory sets the write protection error flag WRPERR in FLASH_NSSR register.

An erase operation is rejected and flagged as illegal if it targets one of the following memory areas:

A program operation is ignored and flagged as illegal if it targets one of the following memory areas:

When WRPERR flag is raised, the operation is rejected and nothing is changed in the corresponding bank.

If this error is detected the write buffer is invalidated.

Note: WRPERR flag has to be cleared before any erase/program operation.

WRPERR flag is cleared by setting CLR_WRPERR bit to 1 in FLASH_NSCCR register.

If WRPERRIE bit in FLASH_NSCR register is set to 1, an interrupt is generated when WRPERR flag is raised (see Section 7.9: FLASH interrupts for details).

7.8.3 Programming sequence error (PGSERR)

When the programming sequence is incorrect, the Flash interface sets the programming sequence error flag PGSERR in FLASH_NSSR register.

More specifically, PGSERR flag is set when one of below conditions is met:

When PGSERR flag is raised as consequence of failed write attempt (Flash programming), the current program operation is aborted and nothing is changed in the corresponding bank. The write data buffer is also invalidated.

Note: When PGSERR flag is raised, there is a risk that the last write operation performed by the application has been lost because of the above protection mechanism. Hence it is recommended to generate interrupts on PGSERR and verify in the interrupt handler if the last write operation has been successful by reading back the value in the flash memory.

The PGSERR flag also blocks any new program operation. This means that PGSERR must be cleared before starting a new program operation.

PGSERR flag is cleared by setting CLR_PGSERR bit to 1 in FLASH_NSCCR register.

If PGSERRIE bit in FLASH_NSCR register is set to 1, an interrupt is generated when PGSERR flag is raised. See Section 7.9: FLASH interrupts for details.

7.8.4 Strobe error (STRBERR)

When the application software writes several times to the same byte in the write buffer, the Flash interface sets the strobe error flag STRBERR (FLASH_NSSR) whatever the target bank of the write access.

When STRBERR flag is raised, the current program operation is aborted and the write buffer is invalidated.

STRBERR flag is cleared by setting CLR_STRBERR bit to 1 in FLASH_NSCCR register.

If STRBERRIE bit in FLASH_NSCR register is set to 1, an interrupt is generated when STRBERR flag is raised. See Section 7.9: FLASH interrupts for details.

7.8.5 Inconsistency error (INCERR)

When a programming inconsistency in access is detected, the Flash interface sets the inconsistency error flag INCERR in register FLASH_NSSR.

More specifically, INCERR flag is set when one of the following conditions is met:

Note: INCERR flag must be cleared before starting a new write operation, otherwise a sequence error (PGSERR) is raised.

It is recommended to follow the sequence below to avoid losing data when an inconsistency error occurs:

  1. 1. Execute a handler routine when INCERR flag is raised.
  2. 2. Stop all write requests to embedded flash memory.
  3. 3. Clear INCERR bit.
  4. 4. Restart the write operations where they have been interrupted.

INCERR flag is cleared by setting CLR_INCERR bit to 1 in FLASH_NSCCR register.

If INCERRIE bit in FLASH_NSCR register is set to 1, an interrupt is generated when INCERR flag is raised (see Section 7.9: FLASH interrupts for details).

7.8.6 Error correction code error (ECCC/ECCD)

When a single-error correction is detected during a read, the Flash interface sets the single-error correction flag ECCC in FLASH_ECCCORR register.

When two ECC errors are detected during a read, the Flash interface sets the double error detection flag ECCD in FLASH_ECCDETR register.

When ECCC flag is raised, the corrected read data are returned. Hence the application can ignore the error and request new read operations. When ECCD flag is raised a NMI is generated. The software must invalidate the instruction cache (CACHEINV=1) in the NMI interrupt service routine when the ECCD flag is set. This NMI can be masked in SBS registers SBS flit ECC NMI mask register (SBS_ECCNMIR) for data access (OTP, data area, RO data).

When ECCC or ECCD flag is raised, the address of the Flash word that generated the error is saved in the FLASH_ECCCORR (FLASH_ECCDETR) register. If the address corresponds to a read-only area or to an OTP area, the OTP_ECC bit is also set to 1 in the FLASH_ECCCORR (FLASH_ECCDETR) register. This register is automatically cleared when the associated flag that generated the error is reset.

A BK_ECC flag indicates in which Flash bank the error occurred.

A SYSF_ECC flag indicates error detected in the system Flash area.

Table 42. Locating ECC failure

OTP_ECCSYSF_ECCBK_ECCFlash areaADDR_ECC minADDR_ECC max
000/1User Flash0x00000xFFFF
010/1System Flash0x00000x0FFF
100OTP0x06000x07FF

Note: In case of successive single correction or double detection errors, only the address corresponding to the first error is stored in FLASH_ECCCORR (FLASH_ECCDETR) register.

Note: It is mandatory to clear ECCC or ECCD flags before starting a new read operation.

Note: As the ECC interface is shared by the two banks, if the same error is registered simultaneously, a physical Bank1 error is registered. Both errors are registered if one bank reports ECCD and the other bank ECCC.

ECCC (respectively ECCD) flag is cleared by setting to 1 ECCC bit (respectively ECCD bit) in FLASH_ECCCORR (FLASH_ECCDETR) register.

If ECCC bit in FLASH_ECCCORR register is set to 1, an interrupt is generated when ECCC flag is raised. Only NMI is generated for the ECCD. See Section 7.9: FLASH interrupts for details.

7.8.7 Option byte change error (OPTCHANGEERR)

When the Flash interface finds an error during an option change operation, it aborts the operation and sets the option byte change error flag OPTCHANGEERR in FLASH_NSSR register.

The error is raised after OPTSTRT bit set if:

Note: Exceptions and details provided in the OB description (see Section 7.4.8: Specific rules for modifying option bytes) and Table 27.

OPTCHANGEERR flag is cleared by setting CLR_OPTCHANGEERR bit to 1 in FLASH_CCR register.

If OPTCHANGEERRIE bit in FLASH_NSCR register is set to 1, an interrupt is generated when OPTCHANGEERR flag is raised (see Section 7.9: FLASH interrupts for details).

It is mandatory to clean the OPTCHANGEERR flag before starting a new operation (option change, erase or write).

7.8.8 Miscellaneous HardFault errors

The following events generate a bus error on the corresponding bus interface:

7.9 FLASH interrupts

The Flash interface can generate a maskable interrupt to signal the following events on a given bank:

A NMI is raised on double ECC error detection during read operation.

The user can individually enable or disable Flash interface interrupt sources by changing the mask bits in the FLASH_CR, FLASH_ECCCORR and FLASH_ECCDETR register. Setting the appropriate mask bit to 1 enables the interrupt.

Note: Prior to writing, FLASH_CR register must be unlocked as explained in Section 7.5.5: Flash memory configuration protection.

Table 43 gives a summary of the available Flash interface interrupt features. As mentioned in the table below, some flags need to be cleared before a new operation is triggered.

Table 43. Flash interrupt request

Interrupt event
Event flag
Error flag label in
register
Enable control bitClear flag to
resume
operation
End of operation eventEOPEOPIEN/A
Write protection errorWRPERRWRPERRIEYes
Programming sequence errorPGSERRPGSERRIEYes
Strobe errorSTRBERRSTRBERRIEYes
Inconsistency errorINCERRINCERRIEYes
Option byte errorOPTCHANGEERR-Yes
ECC single error correction eventECCCECCCIENo
ECC double error detection event(1)ECCDDisabledNo

1. NMI.

The status of the individual maskable interrupt sources described in Table 43 (except for option byte error and ECC) can be read from the FLASH_NSSR register. They can be cleared by setting to 1 the adequate bit in FLASH_NSCCR register.

Note: No unlocking mechanism is required to clear an interrupt.

End of operation event

Setting the end of operation interrupt enable bit (EOPIE) in the FLASH_NSCR register enables the generation of an interrupt at the end of an erase operation, a program operation or an option byte change.

Setting CLR_EOP bit to 1 in FLASH_NSCCR register clears EOP flag.

7.10 FLASH registers

Each register is assigned a offset address and a reset value. In case of registers representing option byte value, the reset value is determined by the OBL process. In case of success the reset value is loaded from OB. In case of OBL failure, a highly restrictive default value is set.

7.10.1 FLASH access control register (FLASH_ACR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

For more details, refer to Section 7.3.4: FLASH read operations and Section 7.3.5: FLASH program operations.

Address offset: 0x000

Reset value: 0x0000 0013

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.PRFTENRes.Res.WRHIGHFREQ[1:0]LATENCY[3:0]
rwrwrwrwrwrwrw

Bits 31:9 Reserved, must be kept at reset value.

Bit 8 PRFTEN: Prefetch enable. When bit value is modified, user must read back ACR register to be sure PRFTEN has been taken into account.

Bits used to control the prefetch.

0: prefetch disabled.

1: prefetch enabled when latency is at least one wait state.

Bits 7:6 Reserved, must be kept at reset value.

Bits 5:4 WRHIGHFREQ[1:0]: Flash signal delay

These bits are used to control the delay between non-volatile memory signals during programming operations. Application software has to program them to the correct value depending on the embedded flash memory interface frequency. Please refer to Table 20 for details.

Note: No check is performed to verify that the configuration is correct.

Two WRHIGHFREQ values can be selected for some frequencies.

Bits 3:0 LATENCY[3:0]: Read latency

These bits are used to control the number of wait states used during read operations on both non-volatile memory banks. The application software has to program them to the correct value depending on the embedded flash memory interface frequency and voltage conditions.

0000: zero wait state used to read a word from non-volatile memory

0001: one wait state used to read a word from non-volatile memory

0010: two wait states used to read a word from non-volatile memory

...

0111: seven wait states used to read a word from non-volatile memory

1111: 15 wait states used to read from non-volatile memory

Note: No check is performed by hardware to verify that the configuration is correct.

7.10.2 FLASH key register (FLASH_NSKEYR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

FLASH_NSKEYR is a write-only register. The following values must be programmed consecutively to unlock FLASH_NSCR register and allow programming/erasing it. A wrong sequence locks the FLASH_NSCR register until next system reset.

1st key = 0x4567 0123

2nd key = 0xCDEF 89AB

Address offset: 0x004

Reset value: 0x0000 0000

31302928272625242322212019181716
NSKEY[31:16]
wwwwwwwwwwwwwwww
1514131211109876543210
NSKEY[15:0]
wwwwwwwwwwwwwwww

Bits 31:0 NSKEY[31:0]: Non-volatile memory configuration access unlock key

7.10.3 FLASH option key register (FLASH_OPTKEYR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

FLASH_OPTKEYR is a write-only register. The following values must be programmed consecutively to unlock FLASH_OPTCR register. A wrong sequence locks FLASH_OPTCR register until next system reset.

1st key = 0x0819 2A3B

2nd key = 0x4C5D 6E7F

Address offset: 0x00C

Reset value: 0x0000 0000

31302928272625242322212019181716
OPTKEY[31:16]
wwwwwwwwwwwwwwww
1514131211109876543210
OPTKEY[15:0]
wwwwwwwwwwwwwwww

Bits 31:0 OPTKEY[31:0]: FLASH option bytes control access unlock key

7.10.4 FLASH operation status register (FLASH_OPSR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Address offset: 0x0018

Reset value: 0xXXXX XXXX

31302928272625242322212019181716
CODE_OP[2:0]Res.Res.Res.Res.OTP_OPSYSF_OPBK_OPRes.Res.ADDR_OP[19:16]
rrrrrrrrrr
1514131211109876543210
ADDR_OP[15:0]
rrrrrrrrrrrrrrrr

Bits 31:29 CODE_OP[2:0]: Flash memory operation code

Bits 28:25 Reserved, must be kept at reset value.

Bit 24 OTP_OP: OTP operation interrupted

Indicates that reset interrupted an ongoing operation in OTP area.

Bit 23 SYSF_OP: Operation in system flash memory interrupted

Indicates that reset interrupted an ongoing operation in System Flash.

Bit 22 BK_OP: Interrupted operation bank

It indicates which bank was concerned by operation.

Bits 21:20 Reserved, must be kept at reset value.

Bits 19:0 ADDR_OP[19:0]: Interrupted operation address.

7.10.5 FLASH option control register (FLASH_OPTCR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Access: No wait state when no flash memory operation is ongoing. The FLASH_OPTCR register is not accessible in write mode when the BSY bit is set. Any attempt to write to it while the BSY bit set causes the AHB bus to stall until the BSY bit is cleared.

Address offset: 0x01C

Reset value: 0xX000 0001

31302928272625242322212019181716
SWAP_BANKRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
r
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OPTSTRTOPTLOCK
rwrs

Bit 31 SWAP_BANK: Bank swapping option configuration bit

SWAP_BANK controls whether Bank1 and Bank2 are swapped or not. This bit is loaded with the SWAP_BANK bit of FLASH_OPTSR_CUR register only after reset or POR.

0: Bank1 and Bank2 not swapped

1: Bank1 and Bank2 swapped

Bits 30:2 Reserved, must be kept at reset value.

Bit 1 OPTSTRT: Option byte start change option configuration bit

OPTSTRT triggers an option byte change operation. The user can set OPTSTRT only when the OPTLOCK bit is cleared to 0. It's set only by Software and cleared when the option byte change is completed or an error occurs (PGSERR or OPTCHANGEERR). It's reseted at the same time as BSY bit.

The user application cannot modify any FLASH_XXX_PRG flash memory register until the option change operation has been completed.

Before setting this bit, the user has to write the required values in the FLASH_XXX_PRG registers. The FLASH_XXX_PRG registers are locked until the option byte change operation has been executed in non-volatile memory.

Bit 0 OPTLOCK: FLASH_OPTCR lock option configuration bit

The OPTLOCK bit locks the FLASH_OPTCR register as well as all _PRG registers. The correct write sequence to FLASH_OPTKEYR register unlocks this bit. If a wrong sequence is executed, or the unlock sequence to FLASH_OPTKEYR is performed twice, this bit remains locked until next system reset.

It is possible to set OPTLOCK by programming it to 1. When set to 1, a new unlock sequence is mandatory to unlock it. When OPTLOCK changes from 0 to 1, the others bits of FLASH_OPTCR register do not change.

0: FLASH_OPTCR register unlocked

1: FLASH_OPTCR register locked.

7.10.6 FLASH status register (FLASH_NSSR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Address offset: 0x020

Reset value: 0x0000 000X

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.OPTCH
ANGEER
RR
Res.Res.INCER
R
STRBE
RR
PGSER
R
WRPE
RR
EOP
rrrrrr
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DBNERes.WBNEBSY
rrr

Bits 31:24 Reserved, must be kept at reset value.

Bit 23 OPTCHANGEERR: Option byte change error flag

OPTCHANGEERR flag indicates that an error occurred during an option byte change operation. When OPTCHANGEERR is set to 1, the option byte change operation did not successfully complete. An interrupt is generated when this flag is raised if the OPTCHANGEERRIE bit of FLASH_NSCR register is set to 1.

Writing 1 to CLR_OPTCHANGEERR of register FLASH_CCR clears OPTCHANGEERR.

0: no option byte change errors occurred

1: one or more errors occurred during an option byte change operation.

Note: The OPTSTRT bit in FLASH_OPTCR cannot be set while OPTCHANGEERR is set.

Bits 22:21 Reserved, must be kept at reset value.

Bit 20 INCERR: inconsistency error flag

INCERR flag is raised when a inconsistency error occurs. An interrupt is generated if INCERRIE is set to 1. Writing 1 to CLR_INCERR bit in the FLASH_NSCCR register clears INCERR.

0: no inconsistency error occurs

1: a inconsistency error occurs

Bit 19 STRBERR: strobe error flag

STRBERR flag is raised when a strobe error occurs (when the master attempts to write several times the same byte in the write buffer). An interrupt is generated if the STRBERRIE bit is set to 1. Writing 1 to CLR_STRBERR bit in FLASH_NSCCR register clears STRBERR.

0: no strobe error occurred

1: a strobe error occurred

Bit 18 PGSERR: programming sequence error flag

PGSERR flag is raised when a sequence error occurs. An interrupt is generated if the PGSERRIE bit is set to 1. Writing 1 to CLR_PGSERR bit in FLASH_NSCCR register clears PGSERR.

0: no sequence error occurred

1: a sequence error occurred

Bit 17 WRPERR: write protection error flag

WRPERR flag is raised when a protection error occurs during a program operation. An interrupt is also generated if the WRPERRIE is set to 1. Writing 1 to CLR_WRPERR bit in FLASH_NSCCR register clears WRPERR.

0: no write protection error occurred

1: a write protection error occurred

Bit 16 EOP: end of operation flag

EOP flag is set when a operation (program/erase) completes. An interrupt is generated if the EOPIE is set to 1. It is not necessary to reset EOP before starting a new operation. EOP bit is cleared by writing 1 to CLR_EOP bit in FLASH_NSCCR register.

0: no operation completed

1: a operation completed

Bits 15:4 Reserved, must be kept at reset value.

Bit 3 DBNE: data buffer not empty flag

DBNE flag is set when the flash memory interface is processing 6-bits ECC data in dedicated buffer. This bit cannot be set to 0 by software. The hardware resets it once the buffer is free.

0: data buffer not used

1: data buffer used, wait

Bit 2 Reserved, must be kept at reset value.

Bit 1 WBNE: write buffer not empty flag

WBNE flag is set when the embedded flash memory is waiting for new data to complete the write buffer. In this state, the write buffer is not empty. WBNE is reset by hardware each time the write buffer is complete or the write buffer is emptied following one of the event below:

This bit cannot be reset by software writing 0 directly. To reset it, clear the write buffer by performing any of the above listed actions, or send the missing data.

0: write buffer empty or full

1: write buffer waiting data to complete

Bit 0 BSY: busy flag

BSY flag indicates that a flash memory is busy by an operation (write, erase, option byte change). It is set at the beginning of a flash memory operation and cleared when the operation finishes or an error occurs.

0: no programming, erase or option byte change operation being executed

1: programming, erase or option byte change operation being executed

7.10.7 FLASH control register (FLASH_NSCR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register..

Access: No wait state when no flash memory operation is ongoing. The FLASH_NSCR register is not accessible in write mode when the BSY bit is set. Any attempt to write to it with the BSY bit set causes the AHB bus to stall until the BSY bit is cleared.

Address offset: 0x028

Reset value: 0x0000 0001

31302928272625242322212019181716
BKSELRes.Res.Res.Res.Res.Res.Res.OPTCH
ANGEER
RRIE
Res.Res.INCER
RIE
STRBE
RRIE
PGSER
RIE
WRPE
RRIE
EOPIE
rwrwrwrwrwrwrw
1514131211109876543210
MERRes.Res.Res.Res.Res.Res.SNB[2:0]STRTFWBERSERPGLOCK
rwrwrwrwrsrwrwrwrwrs

Bit 31 BKSEL: Bank selector bit

BKSEL can only be programmed when LOCK is cleared to 0. The bit selects physical bank, SWAP_BANK setting is ignored.

0: Bank1 is selected for Bank erase / sector erase / interrupt enable

1: Bank2 is selected for BER / SER

Bits 30:24 Reserved, must be kept at reset value.

Bit 23 OPTCHANGEERRIE: Option byte change error interrupt enable bit

OPTCHANGEERRIE bit controls if an interrupt has to be generated when an error occurs during an option byte change. This bit can be programmed only when LOCK bit is cleared to 0.

0: no interrupt is generated when an error occurs during an option byte change

1: an interrupt is generated when and error occurs during an option byte change.

Bits 22:21 Reserved, must be kept at reset value.

Bit 20 INCERRIE: inconsistency error interrupt enable bit

When INCERRIE bit is set to 1, an interrupt is generated when an inconsistency error occurs during a write operation. INCERRIE can be programmed only when LOCK is cleared to 0.

0: no interrupt generated when a inconsistency error occurs

1: interrupt generated when a inconsistency error occurs.

Bit 19 STRBERRIE: strobe error interrupt enable bit

When STRBERRIE bit is set to 1, an interrupt is generated when a strobe error occurs (the master programs several times the same byte in the write buffer) during a write operation. STRBERRIE can be programmed only when LOCK is cleared to 0.

0: no interrupt generated when a strobe error occurs

1: interrupt generated when strobe error occurs.

Bit 18 PGSERRIE: programming sequence error interrupt enable bit

When PGSERRIE bit is set to 1, an interrupt is generated when a sequence error occurs during a program operation. PGSERRIE can be programmed only when LOCK is cleared to 0.

0: no interrupt generated when a sequence error occurs

1: interrupt generated when sequence error occurs

Bit 17 WRPERRIE: write protection error interrupt enable bit

When WRPERRIE bit is set to 1, an interrupt is generated when a protection error occurs during a program operation. WRPERRIE can be programmed only when LOCK is cleared to 0.

0: no interrupt generated when a protection error occurs

1: interrupt generated when a protection error occurs

Bit 16 EOPIE: end of operation interrupt control bit

Setting EOPIE bit to 1 enables the generation of an interrupt at the end of a program or erase operation. EOPIE can be programmed only when LOCK is cleared to 0.

Bit 15 MER: Mass erase request

Setting MER bit to 1 requests a mass erase operation (user flash memory only). MER can be programmed only when LOCK is cleared to 0.

If BER or SER are both set, a PGSERR is raised.

Error is triggered when a mass erase is required and some sectors are protected.

Bits 14:9 Reserved, must be kept at reset value.

Bits 8:6 SNB[2:0]: sector erase selection number

These bits are used to select the target sector for an erase operation (they are unused otherwise). SNB can be programmed only when LOCK is cleared to 0.

Bit 5 STRT: erase start control bit

STRT bit is used to start a sector erase or a bank erase operation. STRT can be programmed only when LOCK is cleared to 0.

STRT is reset at the end of the operation or when an error occurs. It cannot be reseted by software.

Bit 4 FW: write forcing control bit

FW forces a write operation even if the write buffer is not full. In this case all bits not written are set to 1 by hardware. FW can be programmed only when LOCK is cleared to 0.

The embedded flash memory resets FW when the corresponding operation has been acknowledged.

Note: Using a force-write operation prevents the application from updating later the missing bits with something else than 1, because it is likely that it leads to permanent ECC error.

Write forcing is effective only if the write buffer is not empty (in particular, FW does not start several write operations when the force-write operations are performed consecutively).

Since there is just one write buffer, FW can force a write in bank1 or bank2.

Bit 3 BER: erase request

Setting BER bit to 1 requests a bank erase operation (user flash memory only). BER can be programmed only when LOCK is cleared to 0.

If MER and SER are also set, a PGSERR is raised.

Note: Write protection error is triggered when a bank erase is required and some sectors are protected.

Bit 2 SER: sector erase request

Setting SER bit to 1 requests a sector erase. SER can be programmed only when LOCK is cleared to 0.

If MER and SER are also set, a PGSERR is raised.

0: sector erase not requested

1: sector erase requested

Bit 1 PG: programming control bit

PG can be programmed only when LOCK is cleared to 0.

PG allows programming in Bank1 and Bank2.

0: programming disabled

1: programming enabled

Bit 0 LOCK: configuration lock bit

This bit locks the FLASH_NSCR register. The correct write sequence to FLASH_NSKEYR register unlocks this bit. If a wrong sequence is executed, or if the unlock sequence to FLASH_NSKEYR is performed twice, this bit remains locked until the next system reset.

LOCK can be set by programming it to 1. When set to 1, a new unlock sequence is mandatory to unlock it. When LOCK changes from 0 to 1, the other bits of FLASH_NSCR register do not change.

0: FLASH_NSCR register unlocked

1: FLASH_NSCR register locked

7.10.8 FLASH clear control register (FLASH_NSCCR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Address offset: 0x030

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.CLR_OPTCHANGEERRRes.Res.CLR_INCERRCLR_STRBERRCLR_PGSERRCLR_WRPERRCLR_EOP
wwwwww
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.

Bits 31:24 Reserved, must be kept at reset value.

Bit 23 CLR_OPTCHANGEERR: Clear the flag corresponding flag in FLASH_NSSR by writing this bit.

Bits 22:21 Reserved, must be kept at reset value.

Bit 20 CLR_INCERR: INCERR flag clear bit

Setting this bit to 1 resets to 0 INCERR flag in FLASH_NSSR register.

Bit 19 CLR_STRBERR: STRBERR flag clear bit

Setting this bit to 1 resets to 0 STRBERR flag in FLASH_NSSR register.

Bit 18 CLR_PGSERR: PGSERR flag clear bit

Setting this bit to 1 resets to 0 PGSERR flag in FLASH_NSSR register.

Bit 17 CLR_WRPERR: WRPERR flag clear bit
Setting this bit to 1 resets to 0 WRPERR flag in FLASH_NSSR register.

Bit 16 CLR_EOP: EOP flag clear bit
Setting this bit to 1 resets to 0 EOP flag in FLASH_NSSR register.

Bits 15:0 Reserved, must be kept at reset value.

7.10.9 FLASH privilege configuration register (FLASH_PRIVCFGR)

Address offset: 0x03C

Reset value: 0x0000 0000

This register can be read by both privileged and unprivileged access. It can only be written by privilege mode.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NSPRIVRes.
rw

Bits 31:2 Reserved, must be kept at reset value.

Bit 1 NSPRIV: privilege attribute
0: access to registers is always granted
1: access to registers is denied in case of non privileged access.

Bit 0 Reserved, must be kept at reset value.

7.10.10 FLASH HDP extension register (FLASH_HDPEXTR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

The register can only be modified in HDPL<=2.

The values in this register cannot be decremented. Attempt to write a lower value that current is ignored.

Address offset: 0x048

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP2_EXT[2:0]
rwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP1_EXT[2:0]
rwrwrw

Bits 31:19 Reserved, must be kept at reset value.

Bits 18:16 HDP2_EXT[2:0]: HDP area extension in 8 Kbytes sectors in Bank2. Extension is added after the HDP2_END sector (included).

Bits 15:3 Reserved, must be kept at reset value.

Bits 2:0 HDP1_EXT[2:0]: HDP area extension in 8 Kbytes sectors in Bank1. Extension is added after the HDP1_END sector (included).

7.10.11 FLASH option status register (FLASH_OPTSR_CUR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Default value: 0x0030 5CD8 (value in case of double ECC issue during OBL).

This read-only register reflects the current values of corresponding option bits.

Address offset: 0x050

Reset value: 0XXXXX XXXX

(Register bits 0 to 31 are loaded with values from the flash memory at OBL)

31302928272625242322212019181716
SWAP_BANKRes.Res.Res.Res.Res.Res.Res.Res.Res.IWDG_STDBYIWDG_STOPRes.Res.IO_VDDIO2_HSLVIO_VDDIO2_HSLV
rrrrr
1514131211109876543210
PRODUCT_STATE[7:0]NRST_STDBYNRST_STOPRes.WWDG_SWIWDG_SWBORH_ENBOR_LEV[1:0]
rrrrrrrrrrrrrrr

Bit 31 SWAP_BANK: Bank swapping option status bit

SWAP_BANK reflects whether Bank1 and Bank2 are swapped or not.

SWAP_BANK is loaded to SWAP_BANK of FLASH_OPTCR after a reset.

0: Bank1 and Bank2 not swapped

1: Bank1 and Bank2 swapped

Bits 30:22 Reserved, must be kept at reset value.

Bit 21 IWDG_STDBY: IWDG Standby mode freeze option status bit

When set to 0 the independent watchdog IWDG is frozen in system Standby mode.

0: Independent watchdog frozen in Standby mode

1: Independent watchdog keep running in Standby mode.

Bit 20 IWDG_STOP: IWDG Stop mode freeze option status bit

When set to 0 the independent watchdog IWDG is frozen in system Stop mode.

0: Independent watchdog frozen in system Stop mode

1: Independent watchdog keep running in system Stop mode.

Bits 19:18 Reserved, must be kept at reset value.

Bit 17 IO_VDDIO2_HSLV: High-speed IO at low VDDIO2 voltage status bit. This bit can be set only with VDDIO2 below 2.7 V.

0: High-speed IO at low VDDIO2 voltage feature disabled (VDDIO2 can exceed 2.7 V)

1: High-speed IO at low VDDIO2 voltage feature enabled (VDDIO2 remains below 2.7 V)

7.10.12 FLASH option status register (FLASH_OPTSR_PRG)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

This register is used to program values in corresponding option bits. Values after reset reflects the current values of the corresponding option bits.

Address offset: 0x054

Reset value: 0xXXXX XXXX

(Register bits 0 to 31 are loaded with values from the flash memory at OBL)

31302928272625242322212019181716
SWAP_BANKRes.Res.Res.Res.Res.Res.Res.Res.Res.IWDG_STDBYIWDG_STOPRes.Res.IO_VDDIO2_HSLVIO_VDD_HSLV
rwrwrwrwrw
1514131211109876543210
PRODUCT_STATE[7:0]NRST_STDBYNRST_STOPRes.WWDG_SWIWDG_SWBORH_ENBOR_LEV[1:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 SWAP_BANK: Bank swapping option configuration bit

SWAP_BANK option bit is used to configure whether the Bank1 and Bank2 are swapped or not. This bit is loaded with the SWAP_BANK bit of FLASH_OPTSR_CUR register after a reset.

0: Bank1 and Bank2 not swapped

1: Bank1 and Bank2 swapped

Bits 30:22 Reserved, must be kept at reset value.

Bit 21 IWDG_STDBY: IWDG Standby mode freeze option configuration bit

When set the independent watchdog IWDG is frozen in system Standby mode.

0: Independent watchdog frozen in Standby mode

1: Independent watchdog keep running in Standby mode.

Bit 20 IWDG_STOP: IWDG Stop mode freeze option configuration bit

When set the independent watchdog IWDG is in system Stop mode.

0: Independent watchdog frozen in system Stop mode

1: Independent watchdog keep running in system Stop mode.

Bits 19:18 Reserved, must be kept at reset value.

Bit 17 IO_VDDIO2_HSLV: High-speed IO at low VDDIO2 voltage configuration bit. This bit can be set only with VDDIO2 below 2.7 V.

0: High-speed IO at low VDDIO2 voltage feature disabled (VDDIO2 can exceed 2.7 V)

1: High-speed IO at low VDDIO2 voltage feature enabled (VDDIO2 remains below 2.7 V)

Bit 16 IO_VDD_HSLV: High-speed IO at low VDD voltage configuration bit. This bit can be set only with VDD below 2.7 V.

0: High-speed IO at low VDD voltage feature disabled (VDD can exceed 2.7 V)

1: High-speed IO at low VDD voltage feature enabled (VDD remains below 2.7 V)

Bits 15:8 PRODUCT_STATE[7:0]: Life state code (based on Hamming 8,4). More information in Section 7.5.8: Product state transitions.

7.10.13 FLASH option status register 2 (FLASH_OPTSR2_CUR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Default value: 0xC300 0658

This read-only register reflects the current values of corresponding option bits.

Address offset: 0x070

Reset value: 0XXXXX XXXX

(Register bits 0 to 31 are loaded with values from the flash memory at OBL)

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.SRAM1_ECCSRAM1_RSTRes.Res.SRAM2_ECCRes.BKPRA M_ECCSRAM2_RSTRes.Res.Res.
rrrrr

Bits 31:11 Reserved, must be kept at reset value.

Bit 10 SRAM1_ECC: SRAM1 ECC detection and correction disable

Bit 9 SRAM1_RST: SRAM1 erase upon system reset

Bits 8:7 Reserved, must be kept at reset value.

Bit 6 SRAM2_ECC: SRAM2 ECC detection and correction disable

Bit 5 Reserved, must be kept at reset value.

Bit 4 BKPRAM_ECC: Backup RAM ECC detection and correction disable

Bit 3 SRAM2_RST: SRAM2 erase when system reset

Bits 2:0 Reserved, must be kept at reset value.

7.10.14 FLASH option status register 2 (FLASH_OPTSR2_PRG)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

This register is used to program values in corresponding option bits. Values after reset reflects the current values of the corresponding option bits.

Address offset: 0x074

Reset value: 0xXXXX XXXX

(Register bits 0 to 31 are loaded with values from the flash memory at OBL)

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.SRAM1_ECCSRAM1_RSTRes.Res.SRAM2_ECCRes.BKPRAM_ECCSRAM2_RSTRes.Res.Res.
rwrwrwrwrw

Bits 31:11 Reserved, must be kept at reset value.

Bit 10 SRAM1_ECC: SRAM1 ECC detection and correction disable
0: SRAM1 ECC check enabled
1: SRAM1 ECC check disabled

Bit 9 SRAM1_RST: SRAM1 erase upon system reset
0: SRAM1 erased when a system reset occurs
1: SRAM1 not erased when a system reset occurs

Bits 8:7 Reserved, must be kept at reset value.

Bit 6 SRAM2_ECC: SRAM2 ECC detection and correction disable
0: SRAM2 ECC check enabled
1: SRAM2 ECC check disabled

Bit 5 Reserved, must be kept at reset value.

Bit 4 BKPRAM_ECC: Backup RAM ECC detection and correction disable
0: BKPRAM ECC check enabled
1: BKPRAM ECC check disabled

Bit 3 SRAM2_RST: SRAM2 erase when system reset
0: SRAM2 erased when a system reset occurs
1: SRAM2 not erased when a system reset occurs.

Bits 2:0 Reserved, must be kept at reset value.

7.10.15 FLASH unique boot entry register (FLASH_NSBOOTR_CUR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

This register reflects the current values of corresponding option bits.

Address offset: 0x080

Reset value: 0xXXXX XXXX

(Register bits 0 to 31 are loaded with values from the flash memory at OBL)

31302928272625242322212019181716
NSBOOTADD[23:8]
rrrrrrrrrrrrrrrr
1514131211109876543210
NSBOOTADD[7:0]NSBOOT_LOCK[7:0]
rrrrrrrrrrrrrrrr

Bits 31:8 NSBOOTADD[23:0]: unique boot entry address
These bits reflect the UBE address

Bits 7:0 NSBOOT_LOCK[7:0]: A field locking the values of SWAP_BANK, and NSBOOTADD settings.
0xC3: The SWAP_BANK and NSBOOTADD can still be modified following their individual rules.
0xB4: The NSBOOTADD and SWAP_BANK are frozen.

ST logo
ST logo

7.10.16 FLASH unique boot entry address (FLASH_NSBOOTR_PRG)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

This register is used to program values in corresponding option bits.

Address offset: 0x084

Reset value: 0xXXXX XXXX

(Register bits 0 to 31 are loaded with values from the flash memory at OBL)

31302928272625242322212019181716
NSBOOTADD[23:8]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
NSBOOTADD[7:0]NSBOOT_LOCK[7:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:8 NSBOOTADD[23:0]: Unique boot entry address

These bits allow configuring the BOOT address

Bits 7:0 NSBOOT_LOCK[7:0]: A field locking the values of SWAP_BANK, and NSBOOTADD settings.

0xC3: The SWAP_BANK and NSBOOTADD can still be modified following their individual rules.

0xB4: The NSBOOTADD and SWAP_BANK are frozen.

7.10.17 FLASH OTP block lock (FLASH_OTPBLR_CUR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

This register reflects the current values of corresponding option bits.

Address offset: 0x090

Reset value: 0xXXXX XXXX

31302928272625242322212019181716
LOCKBL[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
LOCKBL[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 LOCKBL[31:0]: OTP block lock

Block n corresponds to OTP 16-bit word 32 × n to 32 × n+31.

LOCKBL[n] = 1 indicates that all OTP 16-bit words in OTP Block n are locked and attempt to program them results in WRPERR.

LOCKBL[n] = 0 indicates that all OTP 16-bit words in OTP Block n are not locked.

When one block is locked, it's not possible to remove the write protection.

Also if not locked, it is not possible to erase OTP words.

7.10.18 FLASH OTP block lock (FLASH_OTPBLR_PRG)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

This register is used to program values in corresponding option bits.

Address offset: 0x094

Reset value: 0XXXXX XXXX

31302928272625242322212019181716
LOCKBL[31:16]
rsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrs
1514131211109876543210
LOCKBL[15:0]
rsrsrsrsrsrsrsrsrsrsrsrsrsrsrsrs

Bits 31:0 LOCKBL[31:0]: OTP block lock

Block n corresponds to OTP 16-bit word 32 × n to 32 × n+31.

LOCKBL[n] = 1 indicates that all OTP 16-bit words in OTP Block n are locked and attempt to program them results in WRPERR.

LOCKBL[n] = 0 indicates that all OTP 16-bit words in OTP Block n are not locked.

When one block is locked, it is not possible to remove the write protection.

LOCKBL bits can be set if the corresponding bit in FLASH_OTPBLR_CUR is cleared.

7.10.19 FLASH privilege register for bank 1 (FLASH_PRIVBB1R1)

This register is privileged. It can be read written only by a privileged access.

Address offset: 0x0C0

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.PRIVBB1[7:0]
rwrwrwrwrwrwrwrw

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:0 PRIVBB1[7:0]: Privileged / unprivileged 8 Kbytes Flash Bank1 sector attribute (y = 0 to 7)
0: sectors y in bank 1 is non privileged
1: sector y in bank 1 is privileged

7.10.20 FLASH write sector protection for Bank1 (FLASH_WRP1R_CUR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

This read-only register reflects the current values of corresponding option bits.

Address offset: 0x0E8

Reset value: 0xXXXX XXXX

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.WRPSG1[7:0]
rrrrrrrr

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:0 WRPSG1[7:0]: Bank1 sector protection option status byte
Setting WRPSG1 bits to 0 write protects the corresponding sectors in bank 1 (0: write protected; 1: not write protected)

7.10.21 FLASH write sector protection for Bank1 (FLASH_WRP1R_PRG)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

This register is used to program values in corresponding option bits.

Address offset: 0x0EC

Reset value: 0xXXXX XXXX

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.WRPSG1[7:0]
rwrwrwrwrwrwrwrw

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:0 WRPSG1[7:0]: Bank1 sector protection option status byte
Setting WRPSG1 bits to 0 write protects the corresponding sectors in bank 1 (0: write protected; 1: not write protected)

7.10.22 FLASH HDP Bank1 register (FLASH_HDP1R_CUR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

This register is initially loaded with the values of corresponding option bits.

Address offset: 0x0F8

Reset value: 0XXXXX XXXX

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP1_END[2:0]
www
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP1_STRT[2:0]
www

Bits 31:19 Reserved, must be kept at reset value.

Bits 18:16 HDP1_END[2:0]: HDPL barrier end set in number of 8 Kbytes sectors

Bits 15:3 Reserved, must be kept at reset value.

Bits 2:0 HDP1_STRT[2:0]: HDPL barrier start set in number of 8 Kbytes sectors

7.10.23 FLASH HDP Bank1 register (FLASH_HDP1R_PRG)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Register is accessible only in HDPL0 and HDPL1. In HDPL=2 or 3 it is WI, RAZ.

This register is used to program values in corresponding option bits.

Address offset: 0x0FC

Reset value: 0XXXXX XXXX

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP1_END[2:0]
rrr
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP1_STRT[2:0]
rrr

Bits 31:19 Reserved, must be kept at reset value.

Bits 18:16 HDP1_END[2:0]: Bank 1 HDPL barrier end set in number of 8 Kbytes sectors

Bits 15:3 Reserved, must be kept at reset value.

Bits 2:0 HDP1_STRT[2:0]: Bank 1 HDPL barrier start set in number of 8 Kbytes sectors

7.10.24 FLASH ECC correction register (FLASH_ECCCORR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Address offset: 0x100

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.ECCCRes.Res.Res.Res.ECCCI
E
OTP_E
CC
SYSF_
ECC
BK_EC
C
Res.Res.Res.Res.Res.Res.
rwrwrrr
1514131211109876543210
ADDR_ECC[15:0]
rrrrrrrrrrrrrrrr

Bit 31 Reserved, must be kept at reset value.

Bit 30 ECCC: ECC correction set by hardware when single ECC error has been detected and corrected.

Cleared by writing 1.

Bits 29:26 Reserved, must be kept at reset value.

Bit 25 ECCIE: ECC single correction error interrupt enable bit When ECCIE bit is set to 1, an interrupt is generated when an ECC single correction error occurs during a read operation.

0: no interrupt generated when an ECC single correction error occurs
1: interrupt generated when an ECC single correction error occurs

Bit 24 OTP_ECC: OTP ECC error bit

This bit is set to 1 when one single ECC correction occurred during the last successful read operation from the read-only/ OTP area. The address of the ECC error is available in ADDR_ECC bitfield.

Bit 23 SYSF_ECC: ECC flag for corrected ECC error in system FLASH

It indicates if system flash memory is concerned by ECC error.

Bit 22 BK_ECC: ECC bank flag for corrected ECC error

It indicates which bank is concerned by ECC error

Bits 21:16 Reserved, must be kept at reset value.

Bits 15:0 ADDR_ECC[15:0]: ECC error address

When an ECC error occurs (for single correction) during a read operation, the ADDR_ECC contains the address that generated the error.

ADDR_ECC is reset when the flag error is reset.

The embedded flash memory programs the address in this register only when no ECC error flags are set. This means that only the first address that generated an ECC error is saved.

The address in ADDR_ECC is relative to the flash memory area where the error occurred (user flash memory, system flash memory, data area, read-only/OTP area).

7.10.25 FLASH ECC detection register (FLASH_ECCDETR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Address offset: 0x104

Reset value: 0x0000 0000

31302928272625242322212019181716
ECCDRes.Res.Res.Res.Res.Res.OTP_ECCSYSF_ECCBK_ECCRes.Res.Res.Res.Res.Res.
rwrrr
1514131211109876543210
ADDR_ECC[15:0]
rrrrrrrrrrrrrrrr

Bit 31 ECCD: ECC detection set by hardware when two ECC error has been detected.
When this bit is set, a NMI is generated.
Cleared by writing 1. Needs to be cleared in order to detect subsequent double ECC errors.

Bits 30:25 Reserved, must be kept at reset value.

Bit 24 OTP_ECC: OTP ECC error bit
This bit is set to 1 when double ECC detection occurred during the last read operation from the read-only/ OTP area. The address of the ECC error is available in ADDR_ECC bit field.

Bit 23 SYSF_ECC: ECC fail for double ECC error in system flash memory
It indicates if system flash memory is concerned by ECC error.

Bit 22 BK_ECC: ECC fail bank for double ECC Error
It indicates which bank is concerned by ECC error

Bits 21:16 Reserved, must be kept at reset value.

Bits 15:0 ADDR_ECC[15:0]: ECC error address
When an ECC error occurs (double detection) during a read operation, the ADDR_ECC contains the address that generated the error.
ADDR_ECC is reset when the flag error is reset.
The embedded flash memory programs the address in this register only when no ECC error flags are set. This means that only the first address that generated an double ECC error is saved.
The address in ADDR_ECC is relative to the flash memory area where the error occurred (user flash memory, system flash memory, data area, read-only/OTP area).

7.10.26 FLASH ECC data (FLASH_ECCDR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Address offset: 0x108

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
DATA_ECC[15:0]
rrrrrrrrrrrrrrrr

Bits 31:16 Reserved, must be kept at reset value.

Bits 15:0 DATA_ECC[15:0]: ECC error data

When an double detection ECC error occurs on special areas with 6-bit ECC on 16-bit of data (data area, read-only/OTP area), the failing data is read to this register.

By checking if it is possible to determine whether the failure was on a real data, or due to access to uninitialized memory.

7.10.27 FLASH privilege register for Bank2 (FLASH_PRIVBB2R1)

This register is privileged. It can be read written only by a privileged access.

Address offset: 0x1C0

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.PRIVBB2[7:0]
rwrwrwrwrwrwrwrw

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:0 PRIVBB2[7:0]: Privileged / unprivileged 8 Kbytes Flash Bank2 sector attribute (y = 0 to 7)

0: sectors y in bank 2 is non privileged

1: sector y in bank 2 is privileged

7.10.28 FLASH write sector protection for Bank2 (FLASH_WRP2R_CUR)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

This read-only register reflects the current values of corresponding option bits.

Address offset: 0x1E8

Reset value: 0xXXXX XXXX

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.WRPSG2[7:0]
rrrrrrrr

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:0 WRPSG2[7:0]: Bank2 sector protection option status byte

Setting WRPSG2 bits to 0 write protects the corresponding sectors in bank 2 (0: write protected; 1: not write protected)

7.10.29 FLASH write sector protection for Bank2 (FLASH_WRP2R_PRG)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

This register is used to program values in corresponding option bits.

Address offset: 0x1EC

Reset value: 0xXXXX XXXX

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.WRPSG2[7:0]
rwrwrwrwrwrwrwrw

Bits 31:8 Reserved, must be kept at reset value.

Bits 7:0 WRPSG2[7:0]: Bank2 sector protection option status byte

Setting WRPSG2 bits to 0 write protects the corresponding sectors in bank 2 (0: write protected; 1: not write protected)

7.10.30 FLASH HDP Bank2 register (FLASH_HDP2R_CUR)

This register is initially loaded with the values of corresponding option bits.

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Address offset: 0x1F8

Reset value: 0XXXXX XXXX

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP2_END[2:0]
rrr
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP2_STRT[2:0]
rrr

Bits 31:19 Reserved, must be kept at reset value.

Bits 18:16 HDP2_END[2:0]: Bank 2 HDPL barrier end set in number of 8 Kbytes sectors

Bits 15:3 Reserved, must be kept at reset value.

Bits 2:0 HDP2_STRT[2:0]: Bank 2 HDPL barrier start set in number of 8 Kbytes sectors

7.10.31 FLASH HDP Bank2 register (FLASH_HDP2R_PRG)

This register can be protected against unprivileged access when NSPRIV = 1 in the FLASH_PRIVCFGR register.

Register is accessible only in HDPL0 and HDPL1. In HDPL=2 or 3 it is WI, RAZ.

This register is used to program values in corresponding option bits.

Address offset: 0x1FC

Reset value: 0XXXXX XXXX

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP2_END[2:0]
rwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP2_STRT[2:0]
rwrwrw

Bits 31:19 Reserved, must be kept at reset value.

Bits 18:16 HDP2_END[2:0]: Bank 2 HDPL barrier end set in number of 8 Kbytes sectors

Bits 15:3 Reserved, must be kept at reset value.

Bits 2:0 HDP2_STRT[2:0]: Bank 2 HDPL barrier start set in number of 8 Kbytes sectors

7.10.32 FLASH register map

Table 44. Register map and reset value table

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x000FLASH_ACRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRFTENRes.Res.WRHIGHFREQ[1:0]LATENCY[3:0]
0x0000 00130010011
0x004FLASH_NSKEYRNSKEY[31:0]
0x0000 000000000000000000000000000000000000
0x00CFLASH_OPTKEYROPTKEY
0x0000 000000000000000000000000000000000000
0x018FLASH_OPSRCODE_OP[2:0]Res.Res.Res.Res.OTP_OPSYSF_OPBK_OPRes.Res.ADDR_OP[19:0]
0xXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0x01CFLASH_OPTCRSWAP_BANKRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OPTSTRTOPTLOCK
0xX000 0001001
0x020FLASH_NSSRRes.Res.Res.Res.Res.Res.Res.Res.OPTCHANGERRRes.Res.INCERRSTRBERRPGSERRWRPERREOPRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DBNERes.WBNEBSY
0x0000 000X000000000
0x028FLASH_NSCRBKSEL.Res.Res.Res.Res.Res.Res.Res.OPTCHANGEERRIERes.Res.INCERRIE.STRBERRIEPGSERRIEWRPERRIEEOPIEMERRes.Res.Res.Res.Res.Res.Res.SNB[2:0]STRTFWBERSERPGLOCK
0x0000 000100000000000000001
0x030FLASH_NSCCRRes.Res.Res.Res.Res.Res.Res.Res.CLR_OPTCHANGEERR.Res.Res.CLR_INCERRCLR_STRBERRCLR_PGSERRCLR_WRPERRCLR_EOPRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
0x0000 0000000000
ST logo
ST logo

Table 44. Register map and reset value table (continued)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x03CFLASH_PRIVCFGRResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResNSPRIVRes
0x0000 00000
0x048FLASH_HDPEXTRResResResResResResResResResResResResResResResHDP2_EXT[2:0]ResResResResResResResResResResResResHDP1_EXTT[2:0]
0x0000 0000000000
0x050FLASH_OPTSR_CURSWAP_BANKResResResResResResResResResIWDG_STDBYIWDG_STOPResResIO_VDDIO2_HSLVIO_VDD_HSLVPRODUCT_STATE[7:0]NRST_STDBYNRST_STOPResResResResResBORH_ENBOR_LEV[1:0]
0XXXXX XXXXXXXXXXXXXXXXXXXXX
0x054FLASH_OPTSR_PRGSWAP_BANKResResResResResResResResResIWDG_STDBYIWDG_STOPResResIO_VDDIO2_HSLVIO_VDD_HSLVPRODUCT_STATE[7:0]NRST_STDBYNRST_STOPResResResResResBORH_ENBOR_LEV[1:0]
0XXXXX XXXX011111011011110
0x070FLASH_OPTSR2_CURResResResResResResResResResResResResResResResResResResResResResResSRAM1_ECCSRAM1_RSTResResResResResResResRes
0XXXXX XXXXXX
0x074FLASH_OPTSR2_PRGResResResResResResResResResResResResResResResResResResResResResResSRAM1_ECCSRAM1_RSTResResResResResResResRes
0XXXXX XXXXXX
0x080FLASH_NSBOOTR_CURNSBOOTADD[23:0]NSBOOT_LOCK[7:0]
0XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0x084FLASH_NSBOOTR_PRGNSBOOTADD[23:0]NSBOOT_LOCK[7:0]
0XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0x090FLASH_OTPBLR_CURLOCKBL[31:0]
0XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0x094FLASH_OTPBLR_PRGLOCKBL[31:0]
0XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Table 44. Register map and reset value table (continued)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x0C0FLASH_PRIVBB1R1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRIVBB1[7:0]
0x0000 000000000000
0x0E8FLASH_WRP1RCURRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.WRP1[7:0]
0xXXXX XXXXXXXXXXXX
0x0ECFLASH_WRP1R_PRGRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.WRP1[7:0]
0xXXXX XXXXXXXXXXXX
0x0F8FLASH_HDP1R_CURRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP1_END[2:0]Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP1_STRT[2:0]
0xXXXX XXXXXXXXXX
0x0FCFLASH_HDP1R_PRGRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP1_END[2:0]Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP1_STRT[2:0]
0xXXXX XXXXXXXXXX
0x100FLASH_ECCCORRRes.ECCRRes.Res.Res.Res.ECCCIEOTP_ECCSYSF_ECCBK_ECCRes.Res.Res.Res.Res.Res.ADDR_ECC[15:0]
0x0000 0000000000000000000000000
0x104FLASH_ECCDETRECCRRes.Res.Res.Res.Res.Res.OTP_ECCSYSF_ECCBK_ECCRes.Res.Res.Res.Res.Res.ADDR_ECC[15:0]
0x0000 00000000
0x108FLASH_ECCDRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DATA_ECC[15:0]
0x0000 00000000000000000000
0x1C0FLASH_PRIVBB2R1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRIVBB2[7:0]
0x0000 000000000000
0x1E8FLASH_WRP2R_CURRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.WRPSG2[7:0]
0xXXXX XXXXXXXXXXXX
0x1ECFLASH_WRP2R_PRGRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.WRPSG2[7:0]
0xXXXX XXXXXXXXXXXX

Table 44. Register map and reset value table (continued)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x1F8FLASH_HDP2R_CURRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP2_END[2:0]Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP2_STRT[2:0]
0XXXXX XXXXXXXXXX
0x1FCFLASH_HDP2R_PRGRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP2_END[2:0]Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.HDP2_STRT[2:0]
0XXXXX XXXXXXXXXX

Refer to Section 2.2 for the register boundary addresses.