This reference manual targets application developers. It provides complete information on
how to use the STM32F05xxx microcontroller memory and peripherals.
The STM32F05xxx is a family of microcontrollers with different memory sizes, packages and
peripherals.
For ordering information, mechanical and electrical device characteristics please refer to the
corresponding datasheet.
Figure 299. Block diagram of STM32F05xxx MCU and Cortex-M0-level debug support . . . . . . . . . . 718
Doc ID 018940 Rev 133/742
Documentation conventionsRM0091
1 Documentation conventions
1.1 List of abbreviations for registers
The following abbreviations are used in register descriptions:
read/write (rw)Software can read and write to these bits.
read-only (r)Software can only read these bits.
write-only (w)Software can only write to this bit. Reading the bit returns the reset value.
read/clear (rc_w1)Software can read as well as clear this bit by writing 1. Writing ‘0’ has no effect on
the bit value.
read/clear (rc_w0)Software can read as well as clear this bit by writing 0. Writing ‘1’ has no effect on
the bit value.
read/clear by read
(rc_r)
Software can read this bit. Reading this bit automatically clears it to ‘0’. Writing ‘0’
has no effect on the bit value.
read/set (rs)Software can read as well as set this bit. Writing ‘0’ has no effect on the bit value.
read-only write
trigger (rt_w)
Software can read this bit. Writing ‘0’ or ‘1’ triggers an event but has no effect on
the bit value.
toggle (t)Software can only toggle this bit by writing ‘1’. Writing ‘0’ has no effect.
Reserved (Res.)Reserved bit, must be kept at reset value.
1.2 Glossary
This section gives a brief definition of acronyms and abbreviations used in this document:
●The Cortex-M0 core integrates one debug port: SWD debug port (SWD-DP) provides a
2-pin (clock and data) interface based on the Serial Wire Debug (SWD) protocol.
Please refer to the Cortex-M0 technical reference manual.
●Word: data/instruction of 32-bit length
●Half word: data/instruction of 16-bit length
●Byte: data of 8-bit length
●IAP (in-application programming): IAP is the ability to re-program the Flash memory of
a microcontroller while the user program is running.
●ICP (in-circuit programming): ICP is the ability to program the Flash memory of a
microcontroller using the JTAG protocol, the SWD protocol or the bootloader while the
device is mounted on the user application board.
●Option bytes: product configuration bits stored in the Flash memory
●OBL: option byte loader.
●AHB: advanced high-performance bus.
1.3 Peripheral availability
For peripheral availability and number across all sales types, please refer to the datasheet.
34/742Doc ID 018940 Rev 1
RM0091System and memory overview
2 System and memory overview
2.1 System architecture
The main system consists of:
●Two masters:
–Cortex-M0 core AHB bus
–GP-DMA (general-purpose DMA)
●Four slaves:
–Internal SRAM
–Internal Flash memory
–AHB to APB, which connects all the APB peripherals
–AHB dedicated to GPIO ports
These are interconnected using a multilayer AHB bus architecture as shown in Figure 1:
Figure 1.System architecture
Cortex
M0
DMA
Controller
(Channels
1 to 5)
System bus
DMA
Busmatrix
AHB1 bus
DMA request
AHB2 bus
AHB2APB
Bridge
Reset and
clock
controller
(RCC)
Touch
sensing
controller
(TSC)
CRC
FLITF
Flash interface
SRAM
GPIO Ports
A,B,C,D,F
APB bus
Flash memory
SYSCFG
ADC
DAC
COMP
TIM1
TIM2,TIM3
TIM14,TIM15,TIM16,TIM17
TIM6
IWWDG
WWDG
RTC
I2C1, I2C2
USART1, USART2
SPI1/I2S1, SPI2
HDMI-CEC
DBGMCU
MS19217V1
System bus
This bus connects the system bus of the Cortex-M0 core (peripherals bus) to a BusMatrix
which manages the arbitration between the core and the DMA.
Doc ID 018940 Rev 135/742
System and memory overviewRM0091
DMA bus
This bus connects the AHB master interface of the DMA to the BusMatrix which manages
the access of CPU DCode and DMA to SRAM, Flash memory and peripherals.
BusMatrix
The BusMatrix manages the access arbitration between the core system bus and the DMA
master bus. The arbitration uses a Round Robin algorithm. The BusMatrix is composed of
two masters (CPU AHB, System bus) and four slaves (FLITF, SRAM, AHB2GPIO and
AHB2APB bridges).
AHB peripherals are connected on system bus through a BusMatrix to allow DMA access.
AHB2APB bridges (APB)
The AHB2APB bridges provide full synchronous connections between the AHB and the
APB bus.
Refer to Table 2.2.2 on page 37 for the address mapping of the peripherals connected to
this bridge.
After each device reset, all peripheral clocks are disabled (except for the SRAM and FLITF).
Before using a peripheral you have to enable its clock in the RCC_AHBENR,
RCC_APB2ENR or RCC_APB1ENR register.
Note:When a 16- or 8-bit access is performed on an APB register, the access is transformed into
a 32-bit access: the bridge duplicates the 16- or 8-bit data to feed the 32-bit vector.
36/742Doc ID 018940 Rev 1
RM0091
2.2 Memory organization
2.2.1 Introduction
Program memory, data memory, registers and I/O ports are organized within the same linear
4-Gbyte address space.
The bytes are coded in memory in Little Endian format. The lowest numbered byte in a word
is considered the word’s least significant byte and the highest numbered byte the most
significant.
The addressable memory space is divided into 8 main blocks, each of 512 MB.
All the memory areas that are not allocated to on-chip memories and peripherals are
considered “Reserved”). For the detailed mapping of available memory and register areas,
please refer to the Memory map and register boundary addresses chapter and peripheral
chapters.
2.2.2 Memory map and register boundary addresses
The following table gives the memory map and boundary addresses of the peripherals
available in all STM32F05xxx devices.
Table 2.STM32F05xxx memory map and peripheral register boundary addresses
Main Flash memory,
system memory or SRAM
depending on BOOT
configuration
2.3 Embedded SRAM
The STM32F05xxx features up to 8 Kbytes of static SRAM. It can be accessed as bytes,
half-words (16 bits) or full words (32 bits). This memory can be addressed at maximum
system clock frequency without wait state and thus by both CPU and DMA.
Parity check
The user can enable the parity check using the option bit RAM_PARITY_CHECK in the user
option byte (refer to Table 11 on page 60).
The data bus width is 36 bits because 4 bits are available for parity check (1 bit per byte) in
order to increase memory robustness, as required for instance by Class B or SIL norms.
The parity bits are computed and stored when writing into the SRAM. Then, they are
automatically checked when reading. If one bit fails, an NMI is generated. The same error
can also be linked to the BRK_IN Break input of TIMER15/TIM16/TIM7, with the
SRAM_PARITY_LOCK control bit in the SYSCFG configuration register 2
(SYSCFG_CFGR2). The SRAM Parity Error flag (SRAM_PEF) is available in the SYSCFG
configuration register 2 (SYSCFG_CFGR2).
2.4 Flash memory overview
RM0091
The Flash memory is composed of two distinct physical areas:
●The main Flash memory block. It contains the application program and user data if
necessary.
●The information block. It is composed of two parts:
–Option bytes for hardware and memory protection user configuration.
–System memory which contains the proprietary boot loader code.
Please, refer to Section 3: Embedded Flash memory for more details.
The Flash interface implements instruction access and data access based on the AHB
protocol. It implements the prefetch buffer that speeds up CPU code execution. It also
implements the logic necessary to carry out the Flash memory operations (Program/Erase)
controlled through the Flash registers.
2.5 Boot configuration
In the STM32F05xxx, three different boot modes can be selected through the BOOT0 pin
and nBOOT1 bit in in the User option byte, as shown in the following table.
Table 3.Boot modes
Boot mode selection
BOOT1BOOT0
Boot modeAliasing
x0Main Flash memoryMain Flash memory is selected as boot space
01System memorySystem memory is selected as boot space
11Embedded SRAMEmbedded SRAM is selected as boot space
40/742Doc ID 018940 Rev 1
RM0091
The values on both BOOT0 pin and nBOOT1 bit are latched on the 4th rising edge of
SYSCLK after a reset. It is up to the user to set nBOOT1 and BOOT0 to select the required
boot mode.
The BOOT0 pin and nBOOT1 bit are also re-sampled when exiting from Standby mode.
Consequently they must be kept in the required Boot mode configuration in Standby mode.
After this startup delay has elapsed, the CPU fetches the top-of-stack value from address
0x0000 0000, then starts code execution from the boot memory at 0x0000 0004.
Depending on the selected boot mode, main Flash memory, system memory or SRAM is
accessible as follows:
●Boot from main Flash memory: the main Flash memory is aliased in the boot memory
space (0x0000 0000), but still accessible from its original memory space
(0x0800 0000). In other words, the Flash memory contents can be accessed starting
from address 0x0000 0000 or 0x0800 0000.
●Boot from system memory: the system memory is aliased in the boot memory space
(0x0000 0000), but still accessible from its original memory space (0x
●Boot from the embedded SRAM: the SRAM is aliased in the boot memory space
1FFF EC00).
(0x0000 0000), but it is still accessible from its original memory space (0x2000 0000).
Embedded boot loader
The embedded boot loader is located in the System memory, programmed by ST during
production. It is used to reprogram the Flash memory with the USART1 interface.
Doc ID 018940 Rev 141/742
Embedded Flash memoryRM0091
3 Embedded Flash memory
3.1 Flash main features
●Up to 64 Kbytes of Flash memory
●Memory organization:
–Main Flash memory block:
16 Kwords (16K × 32 bits)
–Information block:
1 Kword (1K × 32 bits)
Flash memory interface features:
●Read interface with prefetch buffer (1 × 32-bit words)
●Option byte Loader
●Flash Program / Erase operation
●Read / Write protection
●Low-power mode
3.2 Flash memory functional description
3.2.1 Flash memory organization
The Flash memory is organized as 32-bit wide memory cells that can be used for storing
both code and data constants.
The memory organization is based on a main Flash memory block containing 64 pages of
1 Kbyte or 16 sectors of 4 Kbytes (4 pages). The sector is the granularity of the write
protection (see Memory protection on page 49).
Table 4.Flash module organization
Flash areaFlash memory addresses
Main Flash
memory
Size
(bytes)
0x0800 0000 - 0x0800 03FF1 KbytePage 0
0x0800 0400 - 0x0800 07FF1 KbytePage 1
0x0800 0800 - 0x0800 0BFF1 KbytePage 2
0x0800 0C00 - 0x0800 0FFF1 KbytePage 3
.
.
.
.
.
.
0x0800 7000 - 0x0800 73FF1 KbytePage 60
0x0800 7400 - 0x0800 77FF1 KbytePage 61
0x0800 7800 - 0x0800 7BFF1 KbytePage 62
0x0800 7C00 - 0x0800 7FFF1 KbytePage 63
NameDescription
Sector 0
.
.
.
.
.
.
Sector 15
42/742Doc ID 018940 Rev 1
RM0091Embedded Flash memory
Table 4.Flash module organization (continued)
Flash areaFlash memory addresses
Information block
Flash memory
interface
registers
0x1FFF EC00- 0x1FFF F7FF3 KbytesSystem memory
0x1FFF F800 - 0x1FFF F80B6Option bytes
0x4002 2000 - 0x4002 20034FLASH_ACR
0x4002 2004 - 0x4002 20074FLASH_KEYR
0x4002 2008 - 0x4002 200B4FLASH_OPTKEYR
0x4002 200C - 0x4002 200F4FLASH_SR
0x4002 2010 - 0x4002 20134FLASH_CR
0x4002 2014 - 0x4002 20174FLASH_AR
0x4002 2018 - 0x4002 201B4Reserved
0x4002 201C - 0x4002 201F4FLASH_OBR
0x4002 2020 - 0x4002 20234FLASH_WRPR
3.2.2 Read operations
The embedded Flash module can be addressed directly, as a common memory space. Any
data read operation accesses the content of the Flash module through dedicated read
senses and provides the requested data.
Size
(bytes)
NameDescription
The instruction fetch and the data access are both done through the same AHB bus. Read
accesses can be performed with the following options managed through the Flash access
control register (FLASH_ACR):
●Instruction fetch: Prefetch buffer enabled for a faster CPU execution.
●Latency: number of wait states for a correct read operation (from 0 to 1)
Instruction fetch
The Cortex-M0 fetches the instruction over the AHB bus. The prefetch block aims at
increasing the efficiency of instruction fetching.
Prefetch buffer
The prefetch buffer is 3 blocks wide where each block consists of 8 bytes. The prefetch
blocks are direct-mapped. A block can be completely replaced on a single read to the Flash
memory as the size of the block matches the bandwidth of the Flash memory.
The implementation of this prefetch buffer makes a faster CPU execution possible as the
CPU fetches one word at a time with the next word readily available in the prefetch buffer.
This implies that the acceleration ratio will be of the order of 2 assuming that the code is
aligned at a 64-bit boundary for the jumps.
Prefetch controller
The prefetch controller decides to access the Flash memory depending on the available
space in the prefetch buffer. The Controller initiates a read request when there is at least
one block free in the prefetch buffer.
After reset, the state of the prefetch buffer is on.
The prefetch buffer should be switched on/off only when SYSCLK is lower than 24 MHz and
Doc ID 018940 Rev 143/742
Embedded Flash memoryRM0091
no prescaler is applied on the AHB clock (SYSCLK must be equal to HCLK). The prefetch
buffer is usually switched on/off during the initialization routine, while the microcontroller is
running on the internal 8 MHz RC (HSI) oscillator.
Note:The prefetch buffer must be kept on (FLASH_ACR[4]=’1’) when using a prescaler different
from 1 on the AHB clock.
Access latency
In order to maintain the control signals to read the Flash memory, the ratio of the prefetch
controller clock period to the access time of the Flash memory has to be programmed in the
Flash access control register with the LATENCY[2:0] bits. This value gives the number of
cycles needed to maintain the control signals of the Flash memory and correctly read the
required data. After reset, the value is zero and only one cycle without additional wait states
is required to access the Flash memory.
3.2.3 Flash program and erase operations
The STM32F05xxx embedded Flash memory can be programmed using in-circuit
programming or in-application programming.
The in-circuit programming (ICP) method is used to update the entire contents of the
Flash memory, using the SWD protocol or the boot loader to load the user application into
the microcontroller. ICP offers quick and efficient design iterations and eliminates
unnecessary package handling or socketing of devices.
In contrast to the ICP method, in-application programming (IAP) can use any
communication interface supported by the microcontroller (I/Os, USB, CAN, UART, I
2
C, SPI,
etc.) to download programming data into memory. IAP allows the user to re-program the
Flash memory while the application is running. Nevertheless, part of the application has to
have been previously programmed in the Flash memory using ICP.
The program and erase operations can be performed over the whole product voltage range.
They are managed through the following seven Flash registers:
●Key register (FLASH_KEYR)
●Option byte key register (FLASH_OPTKEYR)
●Flash control register (FLASH_CR)
●Flash status register (FLASH_SR)
●Flash address register (FLASH_AR)
●Option byte register (FLASH_OBR)
●Write protection register (FLASH_WRPR)
An ongoing Flash memory operation will not block the CPU as long as the CPU does not
access the Flash memory.
On the contrary, during a program/erase operation to the Flash memory, any attempt to read
the Flash memory will stall the bus. The read operation will proceed correctly once the
program/erase operation has completed. This means that code or data fetches cannot be
made while a program/erase operation is ongoing.
For program and erase operations on the Flash memory (write/erase), the internal RC
oscillator (HSI) must be ON.
44/742Doc ID 018940 Rev 1
RM0091Embedded Flash memory
Unlocking the Flash memory
After reset, the Flash memory is protected against unwanted write or erase operations. The
FLASH_CR register is not accessible in write mode. An unlocking sequence should be
written to the FLASH_KEYR register to open the access to the FLASH_CR register. This
sequence consists of two write operations:
●Write KEY1 = 0x45670123
●Write KEY2 = 0xCDEF89AB
Any wrong sequence locks up the FLASH_CR register until the next reset.
In the case of a wrong key sequence, a bus error is detected and a Hard Fault interrupt is
generated. This is done after the first write cycle if KEY1 does not match, or during the
second write cycle if KEY1 has been correctly written but KEY2 does not match.
The FLASH_CR register can be locked again by user software by writing the LOCK bit in the
FLASH_CR register to 1.
Main Flash memory programming
The main Flash memory can be programmed 16 bits at a time. The program operation is
started when the CPU writes a half-word into a main Flash memory address with the PG bit
of the FLASH_CR register set. Any attempt to write data that are not half-word long will
result in a bus error generating a Hard Fault interrupt.
Figure 2.Programming procedure
Read LOCK bit in
FLASH_CR
LOCK bit in FLASH_CR
= 1
No
Write PG bit in FLASH_CR to 1
Perform half-word write at the
desired address
BSY bit in FLASH_SR
= 1
Yes
Perform unlock sequence
Yes
No
Check the programmed value
by reading the programmed
address
Doc ID 018940 Rev 145/742
MS19220V1
Embedded Flash memoryRM0091
The Flash memory interface preliminarily reads the value at the addressed main Flash
memory location and checks that it has been erased. If not, the program operation is
skipped and a warning is issued by the PGERR bit in FLASH_SR register. The only
exception to this is when 0x0000 is programmed. In this case, the location is correctly
programmed to 0x0000 and the PGERR bit is not set.
If the addressed main Flash memory location is write-protected by the FLASH_WRPR
register, the program operation is skipped and a warning is issued by the WRPRTERR bit in
the FLASH_SR register. The end of the program operation is indicated by the EOP bit in the
FLASH_SR register.
The main Flash memory programming sequence in standard mode is as follows:
1.Check that no main Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register.
2. Sett the PG bit in the FLASH_CR register.
3. Perform the data write (half-word) at the desired address.
4. Wait until the BSY bit is reset in the FLASH_SR register.
5. Read the programmed value and verify.
Note:The registers are not accessible in write mode when the BSY bit of the FLASH_SR register
is set.
Flash memory erase
The Flash memory can be erased page by page or completely (Mass Erase).
Page Erase
To erase a page, the procedure below should be followed:
1.Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_CR register
2. Set the PER bit in the FLASH_CR register.
3. Program the FLASH_AR register to select a page to erase.
4. Set the STRT bit in the FLASH_CR register.
5. Wait for the BSY bit to be reset.
6. Read the erased page and verify.
46/742Doc ID 018940 Rev 1
RM0091Embedded Flash memory
Read LOCK bit in
FLASH_CR
LOCK bit in FLASH_CR
=1
Yes
No
Yes
No
Perform unlock sequence
Write into FAR an address
within the page to erase
Write PER bit in FLASH_CR
Write STRT bit in FLASH_CR
to 1
BSY bit in FLASH_SR
= 1
Check the page is erased by
reading all the addresses in
the page
MS19221V1
Figure 3.Flash memory Page Erase procedure
Doc ID 018940 Rev 147/742
Embedded Flash memoryRM0091
Mass Erase
The Mass Erase command can be used to completely erase the user pages of the Flash
memory. The information block is unaffected by this procedure. The following sequence is
recommended:
1.Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register.
2. Set the MER bit in the FLASH_CR register.
3. Set the STRT bit in the FLASH_CR register.
4. Wait for the BSY bit to be reset.
5. Read all the pages and verify.
Figure 4.Flash memory Mass Erase procedure
Read LOCK bit in
FLASH_CR
LOCK bit in FLASH_CR
in FLASH_CR to 1
Write STRT bit in FLASH_CR
Check the erase operation by
reading all the addresses in
the user memory
Option byte programming
=1
No
Write MER bit
to 1
BSY bit in
FLASH_SR
=1
No
Yes
Yes
Perform unlock sequency
MS19222V1
The option bytes are programmed differently from normal user addresses. The number of
option bytes is limited to 6 (2 for write protection, 1 for read protection, 1 for hardware
configuration and 2 free bytes for user data). After unlocking the Flash access, the user has
to authorize the programming of the option bytes by writing the same set of KEYS (KEY1
and KEY2) to the FLASH_OPTKEYR register to set the OPTWRE bit in the FLASH_CR
register (refer to Unlocking the Flash memory for key values). Then the user has to set the
OPTPG bit in the FLASH_CR register and perform a half-word write operation at the desired
Flash address.
48/742Doc ID 018940 Rev 1
RM0091Embedded Flash memory
The value of the addressed option byte is first read to check it is really erased. If not, the
program operation is skipped and a warning is issued by the WRPRTERR bit in the
FLASH_SR register. The end of the program operation is indicated by the EOP bit in the
FLASH_SR register.
The LSB value is automatically complemented into the MSB before the programming
operation starts. This guarantees that the option byte and its complement are always
correct.
The sequence is as follows:
1.Check that no Flash memory operation is ongoing by checking the BSY bit in the
FLASH_SR register.
2. Unlock the OPTWRE bit in the FLASH_CR register.
3. Set the OPTPG bit in the FLASH_CR register
4. Write the data (half-word) to the desired address
5. Wait for the BSY bit to be reset.
6. Read the programmed value and verify.
When the Flash memory read protection option is changed from protected to unprotected, a
Mass Erase of the main Flash memory is performed before reprogramming the read
protection option. If the user wants to change an option other than the read protection
option, then the mass erase is not performed. The erased state of the read protection option
byte protects the Flash memory.
Erase procedure
The option byte erase sequence is as follows:
1.Check that no Flash memory operation is ongoing by reading the BSY bit in the
FLASH_SR register
2. Unlock the OPTWRE bit in the FLASH_CR register
3. Set the OPTER bit in the FLASH_CR register
4. Set the STRT bit in the FLASH_CR register
5. Wait for BSY to reset
6. Read the erased option bytes and verify
3.3 Memory protection
The user area of the Flash memory can be protected against read by untrusted code. The
pages of the Flash memory can also be protected against unwanted write due to loss of
program counter contexts. The write-protection granularity is one sector (four pages).
3.3.1 Read protection
The read protection is activated by setting the RDP option byte and then, by applying a
system reset to reload the new RDP option byte.
Note:If the read protection is set while the debugger is still connected through SWD, apply a POR
(power-on reset) instead of a system reset.
There are three levels of read protection from no protection (level 0) to maximum protection
or no debug (level 2). Refer to Table 6: Access status versus protection level and execution
modes.
Doc ID 018940 Rev 149/742
Embedded Flash memoryRM0091
The Flash memory is protected when the RDP option byte and its complement contain the
pair of values shown in Ta bl e 5 .
Any value
(not necessarily complementary)
except 0x55 and 0x33
Level 0 (ST production
configuration)
Level 1
The System memory area is read accessible whatever the protection level. It is never
accessible for program/erase operation
Level 0: no protection
Read, program and erase operations into the main Flash memory area are possible.
The option bytes are as well accessible by all operations.
Level 1: read protection
This is the default protection level when RDP option byte is erased. It is defined as well
when RDP value is at any value different from 0xAA and 0xCC, or even if the complement is
not correct.
●User mode: Code executing in user mode can access main Flash memory and option
bytes with all operations.
●Debug, boot RAM and boot loader modes: In debug mode (with SWD) or when code
is running from boot RAM or boot loader, the main Flash memory and the backup
registers (RTC_BKPxR in the RTC) are totally inaccessible.
In these modes, even a simple read access generates a bus error and a Hard Fault
interrupt. The main Flash memory is program/erase protected to prevent malicious or
unauthorized users from reprogramming any of the user code with a dump routine. Any
attempted program/erase operation sets the PGERR flag of Flash status register
(FLASH_SR).
When the RPD is reprogrammed to the value 0xAA to move back to Level 0, a mass
erase of the main Flash memory is performed and the backup registers (RTC_BKPxR
in the RTC) are reset.
Level 2: no debug
In this level, the protection level 1 is guaranteed. In addition, the CortexM0 debug
capabilities are disabled. Consequently, the debug port (SWD), the boot from RAM (boot
RAM mode) and the boot from System memory (boot loader mode) are no more available.
In user execution mode, all operations are allowed on the Main Flash memory. On the
contrary, only read and program operations can be performed through option bytes. Option
bytes are accessible for erase operations.
50/742Doc ID 018940 Rev 1
RM0091Embedded Flash memory
Moreover, the RDP bytes cannot be programmed. Thus, the level 2 cannot be removed at
all: it is an irreversible operation. When attempting to program the RDP byte, the protection
error flag WRPRTERR is set in the Flash_SR register and an interrupt can be generated.
Note:1The debug feature is also disabled under reset.
2STMicroelectronics is not able to perform analysis on defective parts on which the level 2
protection has been set.
Table 6.Access status versus protection level and execution modes
Debug/ BootFromRam/
BootFromLoader
Area
Protection
level
User execution
Read Write Erase Read Write Erase
Main Flash
memory
System
memory
(2)
Option bytes
Backup
registers
1. When the protection level 2 is active, the Debug port, the boot from RAM and the boot from system memory are disabled.
2. The system memory is only read-accessible, whatever the protection level (0, 1 or 2) and execution mode.
3. The main Flash memory is erased when the RDP option byte is programmed with all level protections disabled (0xAA).
4. All option bytes can be programmed, except the RDP byte.
1Ye s Ye s Ye s N o No N o
2Yes Yes Yes N/A
(1)
N/A
(1)
1Yes No No Yes No No
2Yes No No NA
1Yes Yes
2Yes Yes
(3)
(4)
Yes Yes Yes
No N/A
(1)
(1)
N/A
(1)
N/A
N/A
(3)
Yes
(1)
N/A
1Ye s Ye sN/ A N oNoYes
(1)
2Yes YesN/A N/A
N/A
(1)
N/A
(3)
N/A
Changing read protection level
It is easy to move from level 0 to level 1 by changing the value of the RDP byte to any value
(except 0xCC).
(1)
(1)
(1)
(1)
By programming the 0xCC value in the RDP byte, it is possible to go to level 2 either directly
from level 0 or from level 1.
On the contrary, the change to level 0 (no protection) is not possible without a main Flash
memory Mass erase operation. This Mass erase is generated as soon as 0xAA is
programmed in the RDP byte.
Note:When the Mass Erase command is used, the backup registers (RTC_BKPxR in the RTC)
are also reset.
To validate the protection level change, the option bytes must be reloaded through the
"OBL_LAUNCH" bit in Flash control register.
3.3.2 Write protection
The write protection is implemented with a granularity of one sector, i.e. four pages. It is
activated by configuring the WRP[1:0] option bytes, and then by reloading them by setting
the OBL_LAUNCH bit in the FLASH_CR register.
Doc ID 018940 Rev 151/742
Embedded Flash memoryRM0091
If a program or an erase operation is performed on a protected sector, the Flash memory
returns a WRPRTERR protection error flag in the Flash memory Status Register
(FLASH_SR).
Write unprotection
To disable the write protection, two application cases are provided:
●Case 1: Read protection disabled after the write unprotection:
–Erase the entire option byte area by using the OPTER bit in the Flash memory
control register (FLASH_CR)
–Program the code 0xAA in the RDP byte to unprotect the memory. This operation
forces a Mass Erase of the main Flash memory.
–Set the OBL_LAUNCH bit in the Flash control register (FLASH_CR) to reload the
option bytes (and the new WRP[1:0] bytes), and to disable the write protection
●Case 2: Read protection maintained active after the write unprotection, useful for in-
application programming with a user boot loader:
–Erase the entire option byte area by using the OPTER bit in the Flash memory
control register (FLASH_CR)
–Set the OBL_LAUNCH bit in the Flash control register (FLASH_CR) to reload the
option bytes (and the new WRP[1:0] bytes), and to disable the write protection.
3.3.3 Option byte write protection
The option bytes are always read-accessible and write-protected by default. To gain write
access (Program/Erase) to the option bytes, a sequence of keys (same as for lock) has to
be written into the OPTKEYR. A correct sequence of keys gives write access to the option
bytes and this is indicated by OPTWRE in the FLASH_CR register being set. Write access
can be disabled by resetting the bit through software.
3.4 Flash interrupts
Table 7.Flash interrupt request
Interrupt eventEvent flagEnable control bit
End of operationEOPEOPIE
Write protection errorWRPRTERRERRIE
Programming error PGERRERRIE
3.5 Flash register description
The Flash memory registers have to be accessed by 32-bit words (half-word and byte
accesses are not allowed).
Set by hardware when a Flash operation (programming / erase) is completed.
Reset by writing a 1
Note: EOP is asserted at the end of each successful program or erase operation
Bit 4 WRPRTERR: Write protection error
Set by hardware when programming a write-protected address of the Flash
memory.
Reset by writing 1.
Bit 3 Reserved, must be kept at reset value.
Bit 2 PGERR: Programming error
Set by hardware when an address to be programmed contains a value different
from '0xFFFF' before programming.
Reset by writing 1.
Note: The STRT bit in the FLASH_CR register should be reset before starting a
programming operation.
Bit 1 Reserved, must be kept at reset value
Bit 0 BSY: Busy
This indicates that a Flash operation is in progress. This is set on the beginning
of a Flash operation and reset when the operation finishes or when an error
occurs.
This bit enables the interrupt generation on an error when PGERR /
WRPRTERR are set in the FLASH_SR register.
0: Interrupt generation disabled
1: Interrupt generation enabled
Bit 9 OPTWRE: Option bytes write enable
When set, the option bytes can be programmed. This bit is set on writing the
correct key sequence to the FLASH_OPTKEYR register.
This bit can be reset by software
Bit 8 Reserved, must be kept at reset value.
Bit 7 LOCK: Lock
Write to 1 only. When it is set, it indicates that the Flash is locked. This bit is reset
by hardware after detecting the unlock sequence.
In the event of unsuccessful unlock operation, this bit remains set until the next
reset.
Bit 6 STRT: Start
This bit triggers an ERASE operation when set. This bit is set only by software
and reset when the BSY bit is reset.
Bit 5 OPTER: Option byte erase
Option byte erase chosen.
Bit 4 OPTPG: Option byte programming
Option byte programming chosen.
Bit 3 Reserved, must be kept at reset value.
Doc ID 018940 Rev 155/742
Embedded Flash memoryRM0091
Bit 2 MER: Mass erase
Erase of all user pages chosen.
Bit 1 PER: Page erase
Page Erase chosen.
Bit 0 PG: Programming
Flash programming chosen.
3.5.6 Flash address register (FLASH_AR)
Address offset: 0x14
Reset value: 0x0000 0000
This register is updated by hardware with the currently/last used address. For Page Erase
operations, this should be updated by software to indicate the chosen page.
31302928272625242322212019181716
FAR [31:16]
wwwwwww w wwwwwww w
1514131211109 87654321 0
FAR[15:0]
wwwwwww w wwwwwww w
Bits 31:0 FAR : Flash Address
Chooses the address to program when programming is selected, or a page to
erase when Page Erase is selected.
Note: Write access to this register is blocked when the BSY bit in the FLASH_SR
register is set.
56/742Doc ID 018940 Rev 1
RM0091Embedded Flash memory
3.5.7 Option byte register (FLASH_OBR)
Address offset 0x1C
Reset value: 0x03FF FFF2
The reset value of this register depends on the value programmed in the option byte and the
OPTERR bit reset value depends on the comparison of the option byte and its complement
during the option byte loading phase.
31302928272625242322212019181716
Data1Data0
rrrrrrr r rrrrrrr r
1514131211109876543210
Res.
VDDA_MONITOR
RAM_PARITY_CHECK
rr r r rrr r
Res.
nBOOT1
nRST_STOP
nRST_STDBY
Res.
Res.
Res.
Res.
Res.
RDPRT2
WDG_SW
RDPRT1
OPTERR
Bits 31:24 Data1
Bits 23:16 Data0
Bits 15:8 User option bytes :
Bit 15 : reserved
Bit 14 : RAM_PARITY_CHECK
Bit 13 : VDDA_MONITOR
Bit 12 : nBOOT1
Bit 11 : reserved
Bit 10 : nRST_STDBY
Bit 9 : nRST_STOP
Bit 8 : WDG_SW
Bits 7:3 Reserved, must be kept at reset value.
Bits 2:1 RDPRT[2:1]: Read protection level status
00: Read protection level 0 is enabled (ST production configuration)
01: Read protection level 1 is enabled
11: Read protection level 2 is enabled.
Bit 0 OPTERR: Option byte error
When set, this indicates that the loaded option byte and its complement do not
match. The corresponding byte and its complement are read as 0xFF in the
FLASH_OBR or FLASH_WRPR register.
Doc ID 018940 Rev 157/742
Embedded Flash memoryRM0091
3.5.8 Write protection register (FLASH_WRPR)
Address offset: 0x20
Reset value: 0xFFFF FFFF
31302928272625242322212019181716
Res.
Res.
Res.
Res.
Res.
Res.
Res.
1514131211109876543210
Bits 31:0 WRP: Write protect
This register contains the write-protection option bytes loaded by the OBL.
Res.
WRP[15:0]
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
3.6 Flash register map
Table 8.Flash interface - register map and reset values
OffsetRegister
0x000
0x004
0x008
0x00C
0x010
0x014
0x01C
0x020
313029282726252423222120191817161514131211
FLASH_ACR
Reset value000000
FLASH_KEYRFKEYR[31:0]
Reset value xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
FLASH_OPTKEYROPTKEYR[31:0]
Reset Value xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
FLASH_SR
Reset value00000
FLASH_CR
Reset value00001000000
FLASH_ARFAR [3 1: 0]
Reset value 00000000000000000000000000000000
FLASH_OBR
Reset value11111111111111111111111100
FLASH_WRPR
Reset value 11111111111111111111111111111111
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.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Data1
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Data0
Res.
Res.
Res.
Res.
Res.
Res.
987654321
10
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.
RAM_PARITY_CHECK
Res.
EOPIE
OBL_LAUNCH
nBOOT1
VDDA_MONITOR
Res.
Res.
ERRIE
OPTWRE
nRST_STOP
nRST_STDBY
WRP[15:0]
Res.
STRT
LOCK
Res.
Res.
WDG_SW
HLFCYA
PRFTBS
PRFTBE
Res.
EOP
WRPRTERR
Res.
OPTER
OPTPG
Res.
Res.
Res.
PGERR
MER
RDPRT2
[2:0]
LATENCY
BSY
ERLYBSY
PG
PER
RDPRT1
OPTERR
0
Refer to Section 2.2.2 on page 37 for the register boundary addresses.
58/742Doc ID 018940 Rev 1
RM0091Option byte description
4 Option byte description
There are six option bytes. They are configured by the end user depending on the
application requirements. As a configuration example, the watchdog may be selected in
hardware or software mode.
A 32-bit word is split up as follows in the option bytes.
Table 9.Option byte format
31-2423-1615 -87-0
Complemented
option byte 1
Option byte 1
Complemented
option byte 0
Option byte 0
The organization of these bytes inside the information block is as shown in Tabl e 1 0 .
The option bytes can be read from the memory locations listed in Ta ble 1 0 or from the
Option byte register (FLASH_OBR).
Note:The new programmed option bytes (user, read/write protection) are loaded after a system
reset.
Table 10.Option byte organization
Address[31:24][23:16][15:8][7:0]
0x1FFF F800nUSERUSERnRDPRDP
0x1FFF F804nData1Data1nData0Data0
0x1FFF F808nWRP1WRP1nWRP0WRP0
Doc ID 018940 Rev 159/742
Option byte descriptionRM0091
Table 11.Description of the option bytes
Flash memory
address
0x1FFF F800
0x1FFF F804
Option bytes
Bits [31:24] nUSER
Bits [23:16] USER: User option byte (stored in FLASH_OBR[15:8])
This byte is used to configure the following features:
–Select the watchdog event: Hardware or software.
–Reset event when entering Stop mode.
–Reset event when entering Standby mode.
Bit 23 : reserved
Bit 22 : RAM_PARITY_CHECK
Together with the BOOT0 pin, it selects the boot mode to the main Flash memory
SRAM or to the System memory.
Refer to Section 2.5: Boot configuration for more details.
Bit 19 : reserved
Bit 18: nRST_STDBY
0: Reset generated when entering Standby mode.
1: No reset generated.
Bit 17: nRST_STOP
0: Reset generated when entering Stop mode
1: No reset generated
Bit 16: WDG_SW
0: Hardware watchdog
1: Software watchdog
Bits [15:8]: nRDP
Bits [7:0]: RDP: Read protection option byte
The value of this byte defines the Flash memory protection level
0xAA : level 0 (ST production configuration)
0xXX (except 0xAA & 0xCC) : Level 1
0xCC : Level 2
Note : The protection level 1 and 2 are stored in the FLASH_OBR Flash option
register (RDPRT1 and RDPRT2 status flags respectively). Refer to Section 3.2.2:
Read operations for more details.
Datax: Two bytes for user data storage.
These addresses can be programmed using the option byte programming
procedure.
Bits [31:24]: nData1
Bits [23:16]: Data1 (stored in FLASH_OBR[25:18])
Bits [15:8]: nData0
Bits [7:0]: Data0 (stored in FLASH_OBR[17:10])
60/742Doc ID 018940 Rev 1
RM0091Option byte description
Table 11.Description of the option bytes (continued)
Flash memory
address
0x1FFF F808
WRPx: Flash memory write protection option bytes
Bits [31:24]: nWRP1
Bits [23:16]: WRP1 (stored in FLASH_WRPR[15:8])
Bits [15:8]: nWRP0
Bits [7:0]: WRP0 (stored in FLASH_WRPR[7:0])
0: Write protection enabled
1: Write protection disabled
Refer to Section 3.3.2: Write protection for more details.
Option bytes
On every system reset, the option byte loader (OBL) reads the information block and stores
the data into the Option byte register (FLASH_OBR) and the Write protection register
(FLASH_WRPR). Each option byte also has its complement in the information block. During
option loading, by verifying the option bit and its complement, it is possible to check that the
loading has correctly taken place. If this is not the case, an option byte error (OPTERR) is
generated. When a comparison error occurs the corresponding option byte is forced to
0xFF. The comparator is disabled when the option byte and its complement are both equal
to 0xFF (Electrical Erase state).
Doc ID 018940 Rev 161/742
Cyclic redundancy check calculation unit (CRC)RM0091
5 Cyclic redundancy check calculation unit (CRC)
5.1 Introduction
The CRC (cyclic redundancy check) calculation unit is used to get a CRC code from a 32-bit
data word and a generator polynomial.
Among other applications, CRC-based techniques are used to verify data transmission or
storage integrity. In the scope of the functional safety standards, they offer a means of
verifying the Flash memory integrity. The CRC calculation unit helps compute a signature of
the software during runtime, to be compared with a reference signature generated at link
time and stored at a given memory location.
●Input buffer to avoid bus stall during calculation
●CRC computation done in 4 AHB clock cycles (HCLK) for 32-bit data
●General-purpose 8-bit register (can be used for temporary storage)
●Reversibility option on I/O data
62/742Doc ID 018940 Rev 1
RM0091Cyclic redundancy check calculation unit (CRC)
MS19882V1
Data register (output)
32-bit (read access)
CRC computation
Data register (input)
32-bit (write access)
AHB bus
5.3 CRC functional description
Figure 5.CRC calculation unit block diagram
The CRC calculation unit has a single 32-bit read/write data register (CRC_DR). It is used to
input new data (write access), and holds the result of the previous CRC calculation (read
access).
Each write operation to the data register creates a combination of the previous CRC value
(stored in CRC_DR) and the new one. CRC computation is done on the whole 32-bit data
word or byte by byte depending on the format of the data being written.
The CRC_DR register can be accessed by word, right-aligned half-word and right-aligned
byte. For the other registers only 32-bit access is allowed.
The duration of the computation depends on data width:
●4 AHB clock cycles for 32-bit
●2 AHB clock cycles for 16-bit
●1 AHB clock cycles for 8-bit
An input buffer allows to immediately write a second data without waiting for any wait states
due to the previous CRC calculation.
The data size can be dynamically adjusted to minimize the number of write accesses for a
given number of bytes. For instance, a CRC for 5 bytes can be computed with a word write
followed by a byte write.
The input data can be reversed, to manage the various endianness schemes. The reversing
operation can be performed on 8 bits, 16 bits and 32 bits depending on the REV_IN[1:0] bits
in the CRC_CR register.
For example: input data 0x1A2B3C4D is used for CRC calculation as:
0x58D43CB2 with bit-reversal done by byte
0xD458B23C with bit-reversal done by half-word
0xB23CD458 with bit-reversal done on the full word
The output data can also be reversed by setting the REV_OUT bit in the CRC_CR register.
The operation is done at bit level: for example, output data 0x11223344 is converted into
0x22CC4488.
Doc ID 018940 Rev 163/742
Cyclic redundancy check calculation unit (CRC)RM0091
The CRC calculator can be initialized to a programmable value using the RESET control bit
in the CRC_CR register (the default value is 0xFFFFFFFF).
The initial CRC value can be programmed with the CRC_INIT register. The CRC_DR
register is automatically initialized upon CRC_INIT register write access.
The CRC_IDR register can be used to hold a temporary value related to CRC calculation. It
is not affected by the RESET bit in the CRC_CR register.
5.4 CRC registers
5.4.1 Data register (CRC_DR)
Address offset: 0x00
Reset value: 0xFFFF FFFF
31302928272625242322212019181716
1514131211109876543210
Bits 31:0 DR[31:0]: Data register bits
DR[31:16]
rw
DR[15:0]
rw
This register is used to write new data to the CRC calculator.
It holds the previous CRC calculation result when it is read.
If the data size is less than 32 bits, the least significant bits are used to write/read the correct value.
Bits 7:0 IDR[7:0]: General-purpose 8-bit data register bits
64/742Doc ID 018940 Rev 1
rw
These bits can be used as a temporary storage location for one byte.
This register is not affected by CRC resets generated by the RESET bit in the CRC_CR register
RM0091Cyclic redundancy check calculation unit (CRC)
This bit controls the reversal of the bit order of the output data.
0: Bit order not affected
1: Bit-reversed output format
These bits control the reversal of the bit order of the input data
00: Bit order not affected
01: Bit reversal done by byte
10: Bit reversal done by half-word
11: Bit reversal done by word
REV_IN[1:0]Res.Res.Res.RESET
Bits 4:3 These bits are generated only if the generic “full_poly” = 1 otherwise they are forced to 0
Bits 2:1 Reserved, must be kept cleared.
Bit 0 RESET: RESET bit
This bit is set by software to reset the CRC calculation unit and set the data register to the value stored
in the CRC_INIT register. This bit can only be set, it is automatically cleared by hardware
Doc ID 018940 Rev 165/742
Cyclic redundancy check calculation unit (CRC)RM0091
5.4.4 Initial CRC value (CRC_INIT)
Address offset: 0x10
Reset value: 0xFFFF FFFF
31302928272625242322212019181716
1514131211109876543210
Bits 31:0 CRC_INIT: Programmable initial CRC value
CRC_INIT[31:16]
rw
CRC_INI[15:0]
rw
This register is used to write the CRC initial value.
5.4.5 CRC register map
Table 12.CRC register map and reset values
OffsetRegister
0x00
0x04
0x08
0x10
313029282726252423222120191817161514131211
CRC_DRData register
Reset value 11111111111111111111111111111111
CRC_IDR
Reset value00000000
CRC_CR
Reset value0000
CRC_INITCRC initial value
Reset value 11111111111111111111111111111111
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Refer to Section 2.2.2 on page 37 for the register boundary addresses.
987654321
10
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Independent data register
Res.
Res.
Res.
Res.
REV_IN
REV_OUT
Res.
Res.
0
Res.
Res.
RESET
66/742Doc ID 018940 Rev 1
RM0091Power control (PWR)
A/D converter
V
DD
V
BAT
V
SS
I/O Ring
V
DDA
BKP registers
Temp. sensor
Reset block
Standby circuitry
PLL
(Wakeup logic,
IWDG)
RTC
Voltage Regulator
Core
Memories
digital
peripherals
Low voltage detector
V
DDA
domain
V
DD
domain
1.8 V domain
Backup domain
LSE crystal 32K osc
RCC BDCR register
V
SSA
D/A converter
6 Power control (PWR)
6.1 Power supplies
The device requires a 2.0 V - 3.6 V operating voltage supply (VDD) and 2.0 V - 3.6 V analog
voltage supply (V
power.
). An embedded regulator is used to supply the internal 1.8 V digital
DDA
The real-time clock (RTC) and backup registers can be powered from the V
the main V
supply is powered off.
DD
Figure 6.Power supply overview
voltage when
BAT
6.1.1 Independent A/D and D/A converter supply and reference voltage
To improve conversion accuracy and to extend the supply flexibility, the ADC and the DAC
have an independent power supply which can be separately filtered and shielded from noise
on the PCB.
●The ADC and DAC voltage supply input is available on a separate V
●An isolated supply ground connection is provided on pin V
The V
supply/reference voltage can be equal or higher than VDD.
DDA
When a single supply is used, V
external filtering circuit in order to ensure a noise free V
Doc ID 018940 Rev 167/742
can be externally connected to VDD, through the
DDA
DDA
SSA
/reference voltage.
DDA
.
pin.
Power control (PWR)RM0091
When V
is different from VDD, it must always be higher or equal to VDD. In order to
DDA
ensure this condition, also during power-up/power-down transitions, an external Shottky
diode may be used between V
6.1.2 Battery backup domain
To retain the content of the Backup registers and supply the RTC function when V
turned off, V
by another source.
The V
BAT
the RTC to operate even when the main power supply is turned off. The switch to the V
supply is controlled by the Power Down Reset embedded in the Reset block.
Warning:During t
pin can be connected to an optional standby voltage supplied by a battery or
BAT
pin powers the RTC unit, the LSE oscillator and the PC13 to PC15 IOs, allowing
is detected, the power switch between V
RSTTEMPO
connected to V
During the startup phase, if V
t
RSTTEMPO
and V
DD
> V
through an internal diode connected between V
power switch (V
If the power supply/battery connected to the V
support this current injection, it is strongly recommended to
connect an external low-drop diode between this power
supply and the V
DD
and V
DDA
.
(temporization at VDD startup) or after a PDR
and VDD remains
BAT
BAT
.
is established in less than
DD
(Refer to the datasheet for the value of t
+ 0.6 V, a current may be injected into V
BAT
DD
BAT
BAT
BAT
).
pin.
DD
RSTTEMPO
BAT
and the
pin cannot
is
BAT
)
If no external battery is used in the application, it is recommended to connect V
BAT
externally to VDD with a 100 nF external ceramic decoupling capacitor (for more details refer
to AN2586).
When the backup domain is supplied by V
(analog switch connected to VDD), the
DD
following functions are available:
●PC13, PC14 and PC15 can be used as GPIO pins
●PC13, PC14 and PC15 can be configured by RTC or LSE (refer to Section 24.3: RTC
functional description on page 536)
Note:Due to the fact that the switch only sinks a limited amount of current (3 mA), the use of
GPIOs PC13 to PC15 in output mode is restricted: the speed has to be limited to 2 MHz with
a maximum load of 30 pF and these IOs must not be used as a current source (e.g. to drive
an LED).
When the backup domain is supplied by V
V
is not present), the following functions are available:
DD
●PC13, PC14 and PC15 can be controlled only by RTC or LSE (refer to Section 24.3:
(analog switch connected to V
BAT
because
BAT
RTC functional description on page 536)
68/742Doc ID 018940 Rev 1
RM0091Power control (PWR)
VDD/V
DDA
Reset
40 mV
hysteresis
POR
PDR
Temporization
t
RSTTEMPO
6.1.3 Voltage regulator
The voltage regulator is always enabled after Reset. It works in three different modes
depending on the application modes.
●In Run mode, the regulator supplies full power to the 1.8 V domain (core, memories
and digital peripherals).
●In Stop mode the regulator supplies low-power to the 1.8 V domain, preserving
contents of registers and SRAM
●In Standby Mode, the regulator is powered off. The contents of the registers and SRAM
are lost except for the Standby circuitry and the Backup Domain.
6.2 Power supply supervisor
6.2.1 Power on reset (POR) / power down reset (PDR)
The device has an integrated power-on reset (POR) and power-down reset (PDR) circuits
which are always active and ensure proper operation above a threshold of 2 V.
The device remains in Reset mode when the monitored supply voltage is below a specified
threshold, V
●The POR monitors only the V
POR/PDR
arrive first and be greater than or equal to V
●
The PDR monitors both the V
supply supervisor can be disabled (by programming a dedicated option bit
V
DDA_MONITOR
sure that V
For more details on the power on / power down reset threshold, refer to the electrical
characteristics section in the datasheet.
, without the need for an external reset circuit.
supply voltage. During the startup phase V
DD
DD
and V
DD.
supply voltages. However, the V
DDA
DDA
DDA
) to reduce the power consumption if the application is designed to make
is higher than or equal to VDD.
DDA
must
power
Figure 7.Power on reset/power down reset waveform
Doc ID 018940 Rev 169/742
Power control (PWR)RM0091
V
DD
PVD output
100 mV
hysteresis
PVD threshold
6.2.2 Programmable voltage detector (PVD)
You can use the PVD to monitor the VDD power supply by comparing it to a threshold
selected by the PLS[2:0] bits in the Power control register (PWR_CR).
The PVD is enabled by setting the PVDE bit.
A PVDO flag is available, in the Power control/status register (PWR_CSR), to indicate if V
DD
is higher or lower than the PVD threshold. This event is internally connected to the EXTI
line16 and can generate an interrupt if enabled through the EXTI registers. The PVD output
interrupt can be generated when V
drops below the PVD threshold and/or when VDD
DD
rises above the PVD threshold depending on EXTI line16 rising/falling edge configuration.
As an example the service routine could perform emergency shutdown tasks.
Figure 8.PVD thresholds
70/742Doc ID 018940 Rev 1
RM0091Power control (PWR)
6.3 Low-power modes
By default, the microcontroller is in Run mode after a system or a power Reset. Several lowpower modes are available to save power when the CPU does not need to be kept running,
for example when waiting for an external event. It is up to the user to select the mode that
gives the best compromise between low-power consumption, short startup time and
available wakeup sources.
The device features three low-power modes:
●Sleep mode (CPU clock off, all peripherals including Cortex-M0 core peripherals like
NVIC, SysTick, etc. are kept running)
●Stop mode (all clocks are stopped)
●Standby mode (1.8V domain powered-off)
In addition, the power consumption in Run mode can be reduce by one of the following
means:
●Slowing down the system clocks
●Gating the clocks to the APB and AHB peripherals when they are unused.
Table 13.Low-power mode summary
Effect on
Mode nameEntrywakeup
Effect on 1.8V
domain clocks
V
DD
domain
clocks
Volt ag e
regulator
Sleep
(Sleep now or
Sleep-on exit)
Stop
Standby
WFIAny interruptCPU clock OFF
WFEWakeup event
Any EXTI line
(configured in the
PDDS and LPDS
bits +
SLEEPDEEP bit
+ WFI or WFE
PDDS bit +
SLEEPDEEP bit
+ WFI or WFE
EXTI registers)
Specific
communication
peripherals on
reception events
(CEC, USART,
I2C)
In Run mode the speed of the system clocks (SYSCLK, HCLK, PCLK) can be reduced by
programming the prescaler registers. These prescalers can also be used to slow down
peripherals before entering Sleep mode.
no effect on other
clocks or analog
clock sources
All 1.8V domain
clocks OFF
NoneON
ON or in lowpower mode
(depends on
HSI and
HSE
oscillators
OFF
Power control
register
(PWR_CR))
OFF
For more details refer to Section 7.4.2: Clock configuration register (RCC_CFGR).
Doc ID 018940 Rev 171/742
Power control (PWR)RM0091
6.3.2 Peripheral clock gating
In Run mode, the HCLK and PCLK for individual peripherals and memories can be stopped
at any time to reduce power consumption.
To further reduce power consumption in Sleep mode the peripheral clocks can be disabled
prior to executing the WFI or WFE instructions.
Peripheral clock gating is controlled by the AHB peripheral clock enable register
(RCC_AHBENR), the APB2 peripheral clock enable register (RCC_APB2ENR) and the
APB1 peripheral clock enable register (RCC_APB1ENR).
6.3.3 Sleep mode
Entering Sleep mode
The Sleep mode is entered by executing the WFI (Wait For Interrupt) or WFE (Wait for
Event) instructions. Two options are available to select the Sleep mode entry mechanism,
depending on the SLEEPONEXIT bit in the Cortex-M0 System Control register:
●Sleep-now: if the SLEEPONEXIT bit is cleared, the MCU enters Sleep mode as soon
as WFI or WFE instruction is executed.
●Sleep-on-exit: if the SLEEPONEXIT bit is set, the MCU enters Sleep mode as soon as
it exits the lowest priority ISR.
In the Sleep mode, all I/O pins keep the same state as in the Run mode.
Refer to Ta bl e 1 4 and Table 1 5 for details on how to enter Sleep mode.
Exiting Sleep mode
If the WFI instruction is used to enter Sleep mode, any peripheral interrupt acknowledged by
the nested vectored interrupt controller (NVIC) can wake up the device from Sleep mode.
If the WFE instruction is used to enter Sleep mode, the MCU exits Sleep mode as soon as
an event occurs. The wakeup event can be generated either by:
●enabling an interrupt in the peripheral control register but not in the NVIC, and enabling
the SEVONPEND bit in the Cortex-M0 System Control register. When the MCU
resumes from WFE, the peripheral interrupt pending bit and the peripheral NVIC IRQ
channel pending bit (in the NVIC interrupt clear pending register) have to be cleared.
●or configuring an external or internal EXTI line in event mode. When the CPU resumes
from WFE, it is not necessary to clear the peripheral interrupt pending bit or the NVIC
IRQ channel pending bit as the pending bit corresponding to the event line is not set.
This mode offers the lowest wakeup time as no time is wasted in interrupt entry/exit.
Refer to Ta bl e 1 4 and Table 1 5 for more details on how to exit Sleep mode.
72/742Doc ID 018940 Rev 1
RM0091Power control (PWR)
Table 14.Sleep-now
Sleep-now modeDescription
WFI (Wait for Interrupt) or WFE (Wait for Event) while:
Mode entry
Mode exit
Wakeup latencyNone
Table 15.Sleep-on-exit
Sleep-on-exitDescription
Mode entry
Mode exitInterrupt: Refer to Table 27: Vector table.
Wakeup latencyNone
– SLEEPDEEP = 0 and
– SLEEPONEXIT = 0
Refer to the Cortex-M0 System Control register.
If WFI was used for entry:
Interrupt: Refer to Table 27: Vector table
If WFE was used for entry
Wakeup event: Refer to Section 11.2.3: Wakeup event management
WFI (wait for interrupt) while:
– SLEEPDEEP = 0 and
– SLEEPONEXIT = 1
Refer to the Cortex-M0 System Control register.
6.3.4 Stop mode
The Stop mode is based on the Cortex-M0 deepsleep mode combined with peripheral clock
gating. The voltage regulator can be configured either in normal or low-power mode. In Stop
mode, all clocks in the 1.8 V domain are stopped, the PLL, the HSI and the HSE oscillators
are disabled. SRAM and register contents are preserved.
In the Stop mode, all I/O pins keep the same state as in the Run mode.
Entering Stop mode
Refer to Ta bl e 1 6 for details on how to enter the Stop mode.
To further reduce power consumption in Stop mode, the internal voltage regulator can be
put in low-power mode. This is configured by the LPDS bit of the Power control register
(PWR_CR).
If Flash memory programming is ongoing, the Stop mode entry is delayed until the memory
access is finished.
If an access to the APB domain is ongoing, The Stop mode entry is delayed until the APB
access is finished.
In Stop mode, the following features can be selected by programming individual control bits:
●Independent watchdog (IWDG): the IWDG is started by writing to its Key register or by
hardware option. Once started it cannot be stopped except by a Reset. See
●real-time clock (RTC): this is configured by the RTCEN bit in the Backup domain control
register (RCC_BDCR)
●Internal RC oscillator (LSI): this is configured by the LSION bit in the Control/status
register (RCC_CSR).
●External 32.768 kHz oscillator (LSE): this is configured by the LSEON bit in the Backup
domain control register (RCC_BDCR).
The ADC or DAC can also consume power during Stop mode, unless they are disabled
before entering this mode. Refer to ADC control register (ADC_CR) and DAC control
register (DAC_CR) for details on how to disable them.
Exiting Stop mode
Refer to Ta bl e 1 6 for more details on how to exit Stop mode.
When exiting Stop mode by issuing an interrupt or a wakeup event, the HSI oscillator is
selected as system clock.
When the voltage regulator operates in low-power mode, an additional startup delay is
incurred when waking up from Stop mode. By keeping the internal regulator ON during Stop
mode, the consumption is higher although the startup time is reduced.
Table 16.Stop mode
Stop modeDescription
Mode entry
Mode exit
Wakeup latencyHSI wakeup time + regulator wakeup time from Low-power mode
6.3.5 Standby mode
WFI (Wait for Interrupt) or WFE (Wait for Event) while:
– Set SLEEPDEEP bit in Cortex-M0 System Control register
– Clear PDDS bit in Power Control register (PWR_CR)
– Select the voltage regulator mode by configuring LPDS bit in PWR_CR
Note: To enter Stop mode, all EXTI Line pending bits (in Pending register
(EXTI_PR)) and RTC Alarm flag must be reset. Otherwise, the Stop mode
entry procedure is ignored and program execution continues.
If WFI was used for entry:
– Any EXTI Line configured in Interrupt mode (the corresponding EXTI
Interrupt vector must be enabled in the NVIC).
– Some specific communication peripherals (CEC, USART, I2C) interrupts,
when programmed in wakeup mode (the peripheral must be programmed
in wakeup mode and the corresponding interrupt vector must be enabled
in the NVIC).
Refer to Table 27: Vector table.
If WFE was used for entry:
Any EXTI Line configured in event mode. Refer to Section 11.2.3:
Wakeup event management on page 160
The Standby mode allows to achieve the lowest power consumption. It is based on the
Cortex-M0 deepsleep mode, with the voltage regulator disabled. The 1.8 V domain is
consequently powered off. The PLL, the HSI oscillator and the HSE oscillator are also
switched off. SRAM and register contents are lost except for registers in the Backup domain
and Standby circuitry (see Figure 6).
74/742Doc ID 018940 Rev 1
RM0091Power control (PWR)
Entering Standby mode
Refer to Ta bl e 1 7 for more details on how to enter Standby mode.
In Standby mode, the following features can be selected by programming individual control
bits:
●Independent watchdog (IWDG): the IWDG is started by writing to its Key register or by
hardware option. Once started it cannot be stopped except by a reset. See
●real-time clock (RTC): this is configured by the RTCEN bit in the Backup domain control
register (RCC_BDCR)
●Internal RC oscillator (LSI): this is configured by the LSION bit in the Control/status
register (RCC_CSR).
●External 32.768 kHz oscillator (LSE): this is configured by the LSEON bit in the Backup
domain control register (RCC_BDCR)
Exiting Standby mode
The microcontroller exits the Standby mode when an external reset (NRST pin), an IWDG
reset, a rising edge on one of the enabled WKUPx pins or the rising edge of an RTC alarm
occurs (see Figure 227: RTC block diagram). All registers are reset after wakeup from
Standby except for Power control/status register (PWR_CSR).
After waking up from Standby mode, program execution restarts in the same way as after a
Reset (boot pin sampling, option bytes loading, reset vector is fetched, etc.). The SBF status
flag in the Power control/status register (PWR_CSR) indicates that the MCU was in Standby
mode.
Refer to Ta bl e 1 7 for more details on how to exit Standby mode.
Table 17.Standby mode
Standby modeDescription
WFI (Wait for Interrupt) or WFE (Wait for Event) while:
Mode entry
Mode exit
Wakeup latencyReset phase
– Set SLEEPDEEP in Cortex-M0 System Control register
– Set PDDS bit in Power Control register (PWR_CR)
– Clear WUF bit in Power Control/Status register (PWR_CSR)
In Standby mode, all I/O pins are high impedance except:
●Reset pad (still available)
●PC13, PC14 and PC15 if configured by RTC or LSE
●WKUPx pins
Doc ID 018940 Rev 175/742
Power control (PWR)RM0091
Debug mode
By default, the debug connection is lost if the application puts the MCU in Stop or Standby
mode while the debug features are used. This is due to the fact that the Cortex-M0 core is
no longer clocked.
However, by setting some configuration bits in the DBGMCU_CR register, the software can
be debugged even when using the low-power modes extensively..
6.3.6 Auto-wakeup from low-power mode
The RTC can be used to wakeup the MCU from low-power mode without depending on an
external interrupt (Auto-wakeup mode). The RTC provides a programmable time base for
waking up from Stop or Standby mode at regular intervals. For this purpose, two of the three
alternative RTC clock sources can be selected by programming the RTCSEL[1:0] bits in the
This clock source provides a precise time base with very low-power consumption (less
than 1µA added consumption in typical conditions)
●Low-power internal RC Oscillator (LSI)
This clock source has the advantage of saving the cost of the 32.768 kHz crystal. This
internal RC Oscillator is designed to add minimum power consumption.
To wakeup from Stop mode with an RTC alarm event, it is necessary to:
●Configure the EXTI Line 17 to be sensitive to rising edge
●Configure the RTC to generate the RTC alarm
To wakeup from Standby mode, there is no need to configure the EXTI Line 17.
76/742Doc ID 018940 Rev 1
RM0091Power control (PWR)
6.4 Power control registers
The peripheral registers can be accessed by half-words (16-bit) or words (32-bit).
6.4.1 Power control register (PWR_CR)
Address offset: 0x00
Reset value: 0x0000 0000 (reset by wakeup from Standby mode)
Bit 8 DBP: Disable backup domain write protection.
In reset state, the RTC and backup registers are protected against parasitic write access.
This bit must be set to enable write access to these registers.
0: Access to RTC and Backup registers disabled
1: Access to RTC and Backup registers enabled
Bits 7:5 PLS[2:0]: PVD level selection.
These bits are written by software to select the voltage threshold detected by the Power
Voltage Detector.
Once the PVD_LOCK is enabled in the SYSCFG configuration register 2 (SYSCFG_CFGR2),
the PLS[2:0] bits cannot be programmed anymore.
Refer to the electrical characteristics of the datasheet for more details.
Bit 4 PVDE: Power voltage detector enable.
This bit is set and cleared by software. Once the PVD_LOCK is enabled in the SYSCFG
configuration register 2 (SYSCFG_CFGR2) register, the PVDE bit cannot be programmed
anymore.
0: PVD disabled
1: PVD enabled
Bit 3 CSBF: Clear standby flag.
This bit is always read as 0.
0: No effect
1: Clear the SBF Standby Flag (write).
Doc ID 018940 Rev 177/742
Power control (PWR)RM0091
Bit 2 CWUF: Clear wakeup flag.
This bit is always read as 0.
0: No effect
1: Clear the WUF Wakeup Flag after 2 System clock cycles. (write)
Bit 1 PDDS: Power down deepsleep.
This bit is set and cleared by software. It works together with the LPDS bit.
0: Enter Stop mode when the CPU enters Deepsleep. The regulator status depends on the
LPDS bit.
1: Enter Standby mode when the CPU enters Deepsleep.
Bit 0 LPDS: Low-power deepsleep.
This bit is set and cleared by software. It works together with the PDDS bit.
0: Voltage regulator on during Stop mode
1: Voltage regulator in low-power mode during Stop mode
Note: When a peripheral that can work in STOP mode requires a clock, the Power controller
automatically switch the voltage regulator from Low-power mode to Normal mode and
remains in this mode until the request disappears.
78/742Doc ID 018940 Rev 1
RM0091Power control (PWR)
6.4.2 Power control/status register (PWR_CSR)
Address offset: 0x04
Reset value: 0x0000 0000 (not reset by wakeup from Standby mode)
Additional APB cycles are needed to read this register versus a standard APB read.
31302928272625242322212019181716
ResResResResResResResResResResResResResResResRes
1514131211109876543210
ResResResResResRes
Bits 31:10 Reserved, must be kept at reset value.
Bit 9 EWUP2: Enable WKUP2 pin
This bit is set and cleared by software.
0: WKUP2 pin is used for general purpose I/O. An event on the WKUP2 pin does not wakeup
the device from Standby mode.
1: WKUP2 pin is used for wakeup from Standby mode and forced in input pull down
configuration (rising edge on WKUP1 pin wakes-up the system from Standby mode).
Note: This bit is reset by a system Reset.
Bit 8 EWUP1: Enable WKUP1 pin
This bit is set and cleared by software.
0: WKUP1 pin is used for general purpose I/O. An event on the WKUP1 pin does not wakeup
the device from Standby mode.
1: WKUP1 pin is used for wakeup from Standby mode and forced in input pull down
configuration (rising edge on WKUP1 pin wakes-up the system from Standby mode).
Note: This bit is reset by a system Reset.
Bits 7:3 Reserved, must be kept at reset value.
EWUP2EWUP
rwrwrrr
ResResResResResPVDOSBFWUF
1
Bit 2 PVDO: PVD output
This bit is set and cleared by hardware. It is valid only if PVD is enabled by the PVDE bit.
is lower than the PVD threshold selected with the PLS[2:0] bits.
0: V
DD
1: V
is higher than the PVD threshold selected with the PLS[2:0] bits.
DD
Notes:
1.The PVD is stopped by Standby mode. For this reason, this bit is equal to 0 after Standby
or reset until the PVDE bit is set.
2. Once the PVD is enabled and configured in the PWR_CR register, PVDO can be used to
generate an interrupt through the External Interrupt controller.
Bit 1 SBF: Standby flag
This bit is set by hardware when the device enters Standby mode and it is cleared only by a
POR/PDR (power on reset/power down reset) or by setting the CSBF bit in the Power control
register (PWR_CR)
0: Device has not been in Standby mode
1: Device has been in Standby mode
Doc ID 018940 Rev 179/742
Power control (PWR)RM0091
Bit 0 WUF: Wakeup flag
This bit is set by hardware to indicate that the device received a wakeup event. It is cleared
only by a POR/PDR (power on reset/power down reset) or by setting the CWUF bit in the
Power control register (PWR_CR)
0: No wakeup event occurred
1: A wakeup event was received from one of the enabled WKUPx pins or from the RTC
alarm.
Note: An additional wakeup event is detected if one WKUPx pin is enabled (by setting the
EWUP bit) when its pin level is already high.
80/742Doc ID 018940 Rev 1
RM0091Power control (PWR)
6.4.3 PWR register map
The following table summarizes the PWR registers.
Table 18.PWR register map and reset values
OffsetRegister
0x000
313029282726252423222120191817161514131211
PWR_CR
Reset value000000000
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
987654321
10
Res.
Res.
PLS[2:0]
Res.
DBP
CSBF
PVDE
PDDS
CWUF
0
LPDS
0x004
PWR_CSR
Reset value00000
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
Res.
EWUP2
EWUP1
Res.
Res.
Res.
Res.
SBF
Res.
WUF
PVDO
Refer to Section 2.2.2 on page 37 for the register boundary addresses.
There are three types of reset, defined as system reset, power reset and backup domain
reset.
7.1.1 System reset
A system reset sets all registers to their reset values except the reset flags in the clock
controller CSR register and the registers in the Backup domain (see Figure 6 on page 74).
A system reset is generated when one of the following events occurs:
1.A low level on the NRST pin (external reset)
2. Window watchdog event (WWDG reset)
3. Independent watchdog event (IWWDG reset)
4. A software reset (SW reset) (see Software reset)
5. Low-power management reset (see Low-power management reset)
6. Option byte loader reset (see Option byte loader reset)
The reset source can be identified by checking the reset flags in the Control/Status register,
RCC_CSR (see Section 7.4.10: Control/status register (RCC_CSR)).
These sources act on the NRST pin and it is always kept low during the delay phase. The
RESET service routine vector is fixed at address 0x0000_0004 in the memory map.
The system reset signal provided to the device is output on the NRST pin. The pulse
generator guarantees a minimum reset pulse duration of 20 µs for each reset source
(external or internal reset). In case of an external reset, the reset pulse is generated while
the NRST pin is asserted low.
Figure 9.Simplified diagram of the reset circuit
82/742Doc ID 018940 Rev 1
RM0091Reset and clock control (RCC)
Software reset
The SYSRESETREQ bit in Cortex-M0 Application Interrupt and Reset Control Register
must be set to force a software reset on the device. Refer to the Cortex™-M0 technical reference manual for more details.
Low-power management reset
There are two ways to generate a low-power management reset:
1.Reset generated when entering Standby mode:
This type of reset is enabled by resetting nRST_STDBY bit in User Option Bytes. In this
case, whenever a Standby mode entry sequence is successfully executed, the device
is reset instead of entering Standby mode.
2. Reset when entering Stop mode:
This type of reset is enabled by resetting nRST_STOP bit in User Option Bytes. In this
case, whenever a Stop mode entry sequence is successfully executed, the device is
reset instead of entering Stop mode.
For further information on the User Option Bytes, refer to Section 4 on page 64.
Option byte loader reset
The option byte loader reset is generated when the FORCE_OBL bit (bit 13) is set in the
FLASH_CR register. This bit is used to launch the option byte loading by software.
7.1.2 Power reset
A power reset is generated when one of the following events occurs:
1.Power-on/power-down reset (POR/PDR reset)
2. When exiting Standby mode
A power reset sets all registers to their reset values except the Backup domain (Figure 6 on
page 74)
7.1.3 Backup domain reset
The backup domain has two specific resets that affect only the backup domain (Figure 6 on
page 74).
A backup domain reset is generated when one of the following events occurs:
1.Software reset, triggered by setting the BDRST bit in the Backup domain control
register (RCC_BDCR).
2. V
DD
or V
power on, if both supplies have previously been powered off.
BAT
7.2 Clocks
Three different clock sources can be used to drive the system clock (SYSCLK):
●HSI 8 MHZ RC oscillator clock
●HSE oscillator clock
●PLL clock
Doc ID 018940 Rev 183/742
Reset and clock control (RCC)RM0091
The devices have the following additional clock sources:
●40 kHz low speed internal RC (LSI RC) which drives the independent watchdog and
optionally the RTC used for Auto-wakeup from Stop/Standby mode.
●32.768 kHz low speed external crystal (LSE crystal) which optionally drives the real-
time clock (RTCCLK)
●14 MHz high speed internal RC (HSI14) dedicated for ADC.
Each clock source can be switched on or off independently when it is not used, to optimize
power consumption.
Several prescalers can be used to configure the frequency of the AHB and the APB
domains. The AHB and the APB domains maximum frequency is 48 MHz.
The Cortex system timer is always clocked by the AHB clock divided by 8 or directly by the
AHB clock (through Cortex Systick configuration bits).
All the peripheral clocks are derived from their bus clock (HCLK or PCLK) except:
●The Flash memory programming interface clock (FLITFCLK) which is always the HSI
clock.
●The option byte loader clock which is always the HSI clock
●The ADC clock which is derived (selected by software) from one of the two following
sources:
–dedicated HSI14 clock, to run always at the maximum sampling rate
–APB clock (PCLK) divided by 2 or 4
●The USART1 clock which is derived (selected by software) from one of the four
●The I2C1 clock which is derived (selected by software) from one of the two following
sources:
–system clock
–HSI clock
●The CEC clock which is derived from the HSI clock divided by 244 or from the LSE
clock.
●The I2S1 clock which is always the system clock.
●The RTC clock which is derived from the LSE, LSI or from the HSE clock divided by 32.
●The IWWDG clock which is always the LSI clock.
The RCC feeds the Cortex System Timer (SysTick) external clock with the AHB clock
(HCLK) divided by 8. The SysTick can work either with this clock or directly with the Cortex
clock (HCLK), configurable in the SysTick Control and Status Register.
84/742Doc ID 018940 Rev 1
RM0091Reset and clock control (RCC)
Figure 10. Clock tree
FLITFCLK
to Flash programming interface
HSI
SYSCLK
to I2C1
to I2S1
OSC_OUT
OSC_IN
OSC32_IN
OSC32_OUT
MCO
8 MHz
HSI RC
PLLSRC
/2,/3,...
/16
4-32 MHz
HSE OSC
LSE OSC
32.768kHz
LSI RC
40kHz
Main clock
output
MCO
HSI
PLLMUL
PLL
x2,x3,..
x16
/32
LSE
RTCSEL[1:0]
LSI
/2
/2
PLLCLK
PLLCLK
HSI
HSI14
HSE
SYSCLK
HSI
HSE
CSS
RTCCLK
SW
SYSCLK
14 MHz
HSI14 RC
AHB
AHB
prescaler
/1,2,..512
HSI14
to RTC
to IWWDG
IWWDGCLK
LSE
/256
HCLK
/8
APB
prescaler
/1,2,4,8,16
If (APB1 prescaler
=1) x1 else x2
ADC
Prescaler
/2,4
PCLK
SYSCLK
HSI
LSE
to CEC
to AHB bus, core,
memory and DMA
to cortex System timer
FHCLK Cortex free running clock
PCLK
to APB peripherals
to TIM1,2,3,6,
14,15,16,17
to ADC
14 MHz max
to USART1
MS19935V1
1. For full details about the internal and external clock source characteristics, please refer to the “Electrical characteristics”
section in your device datasheet.
Doc ID 018940 Rev 185/742
Reset and clock control (RCC)RM0091
OSC_OUT
External
source
GPIO
OSC_IN
OSC_IN OSC_OUT
Load
capacitors
C
L2
C
L1
The timer clock frequencies are automatically fixed by hardware. There are two cases:
1.if the APB prescaler is 1, the timer clock frequencies are set to the same frequency as
that of the APB domain.
2. otherwise, they are set to twice (×2) the frequency of the APB domain.
FCLK acts as Cortex-M0’s free-running clock. For more details refer to the ARM Cortex™-
M0 r0p0 technical reference manual(TRM).
7.2.1 HSE clock
The high speed external clock signal (HSE) can be generated from two possible clock
sources:
●HSE external crystal/ceramic resonator
●HSE user external clock
The resonator and the load capacitors have to be placed as close as possible to the
oscillator pins in order to minimize output distortion and startup stabilization time. The
loading capacitance values must be adjusted according to the selected oscillator.
Figure 11. HSE/ LSE clock sources
Clock sourceHardware configuration
External clock
Crystal/Ceramic
resonators
86/742Doc ID 018940 Rev 1
RM0091Reset and clock control (RCC)
External crystal/ceramic resonator (HSE crystal)
The 4 to 32 MHz external oscillator has the advantage of producing a very accurate rate on
the main clock.
The associated hardware configuration is shown in Figure 11. Refer to the electrical
characteristics section of the datasheet for more details.
The HSERDY flag in the Clock control register (RCC_CR) indicates if the HSE oscillator is
stable or not. At startup, the clock is not released until this bit is set by hardware. An
interrupt can be generated if enabled in the Clock interrupt register (RCC_CIR).
The HSE Crystal can be switched on and off using the HSEON bit in the Clock control
register (RCC_CR).
External source (HSE bypass)
In this mode, an external clock source must be provided. It can have a frequency of up to
32 MHz. You select this mode by setting the HSEBYP and HSEON
register (RCC_CR). The external clock signal (square, sinus or triangle) with ~40-60% duty
cycle depending on the frequency (refer to the datasheet) has to drive the OSC_IN pin while
the OSC_OUT pin can be used a GPIO. See Figure 11.
bits in the Clock control
7.2.2 HSI clock
The HSI clock signal is generated from an internal 8 MHz RC Oscillator and can be used
directly as a system clock or divided by 2 to be used as PLL input.
The HSI RC oscillator has the advantage of providing a clock source at low cost (no external
components). It also has a faster startup time than the HSE crystal oscillator however, even
with calibration the frequency is less accurate than an external crystal oscillator or ceramic
resonator.
Calibration
RC oscillator frequencies can vary from one chip to another due to manufacturing process
variations, this is why each device is factory calibrated by ST for 1% accuracy at T
After reset, the factory calibration value is loaded in the HSICAL[7:0] bits in the Clock control
register (RCC_CR).
If the application is subject to voltage or temperature variations this may affect the RC
oscillator speed. You can trim the HSI frequency in the application using the HSITRIM[4:0]
bits in the Clock control register (RCC_CR).
The HSIRDY flag in the Clock control register (RCC_CR) indicates if the HSI RC is stable or
not. At startup, the HSI RC output clock is not released until this bit is set by hardware.
The HSI RC can be switched on and off using the HSION bit in the Clock control register
(RCC_CR).
The HSI signal can also be used as a backup source (Auxiliary clock) if the HSE crystal
oscillator fails. Refer to Section 7.2.7: Clock security system (CSS) on page 89.
=25°C.
A
Doc ID 018940 Rev 187/742
Reset and clock control (RCC)RM0091
7.2.3 PLL
The internal PLL can be used to multiply the HSI or HSE output clock frequency. Refer to
Figure 10 and Clock control register (RCC_CR).
The PLL configuration (selection of the input clock, and multiplication factor) must be done
before enabling the PLL. Once the PLL is enabled, these parameters cannot be changed.
To modify the PLL configuration, proceed as follows:
1.Disable the PLL by setting PLLON to 0.
2. Wait until PLLRDY is cleared. The PLL is now fully stopped.
3. Change the desired parameter.
4. Enable the PLL again by setting PLLON to 1.
An interrupt can be generated when the PLL is ready, if enabled in the Clock interrupt
register (RCC_CIR).
The PLL output frequency must be set in the range 16-48 MHz.
7.2.4 LSE clock
The LSE crystal is a 32.768 kHz Low Speed External crystal or ceramic resonator. It has the
advantage of providing a low-power but highly accurate clock source to the real-time clock
peripheral (RTC) for clock/calendar or other timing functions.
The LSE crystal is switched on and off using the LSEON bit in Backup domain control
register (RCC_BDCR). The crystal oscillator driving strength can be changed at runtime
using the LSEDRV[1:0] bits in the Backup domain control register (RCC_BDCR) to obtain
the best compromise between robustness and short start-up time on one side and low
power-consumption on the other.
The LSERDY flag in the Backup domain control register (RCC_BDCR) indicates whether
the LSE crystal is stable or not. At startup, the LSE crystal output clock signal is not
released until this bit is set by hardware. An interrupt can be generated if enabled in the
Clock interrupt register (RCC_CIR).
External source (LSE bypass)
In this mode, an external clock source must be provided. It can have a frequency of up to
1 MHz. You select this mode by setting the LSEBYP and LSEON bits in the Backup domain
control register (RCC_BDCR). The external clock signal (square, sinus or triangle) with
~50% duty cycle has to drive the OSC32_IN pin while the OSC32_OUT pin can be used as
GPIO. See Figure 11.
7.2.5 LSI clock
The LSI RC acts as an low-power clock source that can be kept running in Stop and
Standby mode for the independent window watchdog (IWWDG) and RTC. The clock
frequency is around 40 kHz (between 30 kHz and 60 kHz). For more details, refer to the
electrical characteristics section of the datasheets.
The LSI RC can be switched on and off using the LSION bit in the Control/status register
(RCC_CSR).
88/742Doc ID 018940 Rev 1
RM0091Reset and clock control (RCC)
The LSIRDY flag in the Control/status register (RCC_CSR) indicates if the LSI oscillator is
stable or not. At startup, the clock is not released until this bit is set by hardware. An
interrupt can be generated if enabled in the Clock interrupt register (RCC_CIR).
7.2.6 System clock (SYSCLK) selection
Three different clock sources can be used to drive the system clock (SYSCLK):
●HSI oscillator
●HSE oscillator
●PLL
After a system reset, the HSI oscillator is selected as system clock. When a clock source is
used directly or through the PLL as a system clock, it is not possible to stop it.
A switch from one clock source to another occurs only if the target clock source is ready
(clock stable after startup delay or PLL locked). If a clock source which is not yet ready is
selected, the switch will occur when the clock source becomes ready. Status bits in the
Clock control register (RCC_CR) indicate which clock(s) is (are) ready and which clock is
currently used as a system clock.
7.2.7 Clock security system (CSS)
Clock Security System can be activated by software. In this case, the clock detector is
enabled after the HSE oscillator startup delay, and disabled when this oscillator is stopped.
If a failure is detected on the HSE clock, the HSE oscillator is automatically disabled, a clock
failure event is sent to the break input of the advanced-control timers (TIM1) and generalpurpose timers (TIM15, TIM16 and TIM17) and an interrupt is generated to inform the
software about the failure (Clock Security System Interrupt CSSI), allowing the MCU to
perform rescue operations. The CSSI is linked to the Cortex-M0 NMI (Non-Maskable
Interrupt) exception vector.
Note:Once the CSS is enabled and if the HSE clock fails, the CSS interrupt occurs and an NMI is
automatically generated. The NMI will be executed indefinitely unless the CSS interrupt
pending bit is cleared. As a consequence, in the NMI ISR user must clear the CSS interrupt
by setting the CSSC bit in the Clock interrupt register (RCC_CIR).
If the HSE oscillator is used directly or indirectly as the system clock (indirectly means: it is
used as PLL input clock, and the PLL clock is used as system clock), a detected failure
causes a switch of the system clock to the HSI oscillator and the disabling of the HSE
oscillator. If the HSE clock (divided or not) is the clock entry of the PLL used as system clock
when the failure occurs, the PLL is disabled too.
7.2.8 ADC clock
The ADC clock is either the dedicated 14 MHz RC oscillator (HSI14) or PCLK divided by 2
or 4. When the ADC clock is derived from PCLK, it is in an opposite phase with PCLK. The
14 MHz RC oscillator can be configured by software either to be turned on/off (“auto-off
mode”) by the ADC interface or to be always enabled. The HSI 14 MHz RC oscillator cannot
be turned on by ADC interface when the APB clock is selected as kernel clock.
Doc ID 018940 Rev 189/742
Reset and clock control (RCC)RM0091
7.2.9 RTC clock
The RTCCLK clock source can be either the HSE/32, LSE or LSI clocks. This is selected by
programming the RTCSEL[1:0] bits in the Backup domain control register (RCC_BDCR).
This selection cannot be modified without resetting the Backup domain. The system must be
always configured in a way that the PCLK frequency is greater then or equal to the RTCCLK
frequency for proper operation of the RTC.
The LSE clock is in the Backup domain, whereas the HSE and LSI clocks are not.
Consequently:
●If LSE is selected as RTC clock:
–The RTC continues to work even if the V
V
supply is maintained.
BAT
●If LSI is selected as the RTC clock:
–The RTC state is not guaranteed if the V
●If the HSE clock divided by 32 is used as the RTC clock:
–The RTC state is not guaranteed if the V
supply is switched off, provided the
DD
supply is powered off.
DD
supply is powered off or if the internal
DD
voltage regulator is powered off (removing power from the 1.8 V domain).
7.2.10 Watchdog clock
If the Independent watchdog (IWWDG) is started by either hardware option or software
access, the LSI oscillator is forced ON and cannot be disabled. After the LSI oscillator
temporization, the clock is provided to the IWWDG.
7.2.11 Clock-out capability
The microcontroller clock output (MCO) capability allows the clock to be output onto the
external MCO pin. The configuration registers of the corresponding GPIO port must be
programmed in alternate function mode. One of 5 clock signals can be selected as the MCO
clock.
●HSI14
●SYSCLK
●HSI
●HSE
●PLL clock divided by 2
The selection is controlled by the MCO[2:0] bits of the Clock configuration register
(RCC_CFGR).
7.3 Low power modes
APB peripheral clocks and DMA clock can be disabled by software.
Sleep mode stops the CPU clock. The memory interface clocks (Flash and RAM interfaces)
can be stopped by software during sleep mode. The AHB to APB bridge clocks are disabled
by hardware during Sleep mode when all the clocks of the peripherals connected to them
are disabled.
Stop mode stops all the clocks in the core supply domain and disables the PLL and the HSI,
HSI14 and HSE oscillators.
90/742Doc ID 018940 Rev 1
RM0091Reset and clock control (RCC)
HDMI CEC, USART1 and I2C1 have the capability to enable the HSI oscillator even when
the MCU is in Stop mode (if HSI is selected as the clock source for that peripheral).
HDMI CEC and USART1 can also be driven by the LSE oscillator when the system is in
Stop mode (if LSE is selected as clock source for that peripheral) and the LSE oscillator is
enabled (LSEON) but they do not have the capability to turn on the LSE oscillator.
Standby mode stops all the clocks in the core supply domain and disables the PLL and the
HSI, HSI14 and HSE oscillators.
The CPU’s deepsleep mode can be overridden for debugging by setting the DBG_STOP or
DBG_STANDBY bits in the DBGMCU_CR register.
When waking up from deepsleep after an interrupt (Stop mode) or reset (Standby mode),
the HSI oscillator is selected as system clock.
If a Flash programming operation is on going, deepsleep mode entry is delayed until the
Flash interface access is finished. If an access to the APB domain is ongoing, deepsleep
mode entry is delayed until the APB access is finished.
Doc ID 018940 Rev 191/742
Reset and clock control (RCC)RM0091
7.4 RCC registers
Refer to Section 1.1 on page 34 for a list of abbreviations used in register descriptions.
7.4.1 Clock control register (RCC_CR)
Address offset: 0x00
Reset value: 0x0000 XX83 where X is undefined.
Access: no wait state, word, half-?word and byte access
31302928272625242322212019181716
ResResResResResRes
1514131211109876543210
HSICAL[7:0]HSITRIM[4:0]Res
rrrrrrr rrwrwrwrwrwrrw
PLL
PLLONResResResRes
RDY
rrwrwrwrrw
Bits 31:26Reserved, must be kept at reset value.
Bit 25 PLLRDY: PLL clock ready flag
Set by hardware to indicate that the PLL is locked.
0: PLL unlocked
1: PLL locked
Bit 24 PLLON: PLL enable
Set and cleared by software to enable PLL.
Cleared by hardware when entering Stop or Standby mode. This bit can not be reset if the
PLL clock is used as system clock or is selected to become the system clock.
0: PLL OFF
1: PLL ON
CSS ONHSE
BYP
HSE
RDY
HSI
RDY
HSE
ON
HSION
Bits 23:20 Reserved, must be kept at reset value.
Bit 19 CSSON: Clock security system enable
Set and cleared by software to enable the clock security system. When CSSON is set, the
clock detector is enabled by hardware when the HSE oscillator is ready, and disabled by
hardware if a HSE clock failure is detected.
0: Clock detector OFF
1: Clock detector ON (Clock detector ON if the HSE oscillator is ready , OFF if not).
Bit 18 HSEBYP: HSE crystal oscillator bypass
Set and cleared by software to bypass the oscillator with an external clock. The external
clock must be enabled with the HSEON bit set, to be used by the device. The HSEBYP bit
can be written only if the HSE oscillator is disabled.
0: HSE crystal oscillator not bypassed
1: HSE crystal oscillator bypassed with external clock
92/742Doc ID 018940 Rev 1
RM0091Reset and clock control (RCC)
Bit 17 HSERDY: HSE clock ready flag
Set by hardware to indicate that the HSE oscillator is stable. This bit needs 6 cycles of the
HSE oscillator clock to fall down after HSEON reset.
0: HSE oscillator not ready
1: HSE oscillator ready
Bit 16 HSEON: HSE clock enable
Set and cleared by software.
Cleared by hardware to stop the HSE oscillator when entering Stop or Standby mode. This
bit cannot be reset if the HSE oscillator is used directly or indirectly as the system clock.
0: HSE oscillator OFF
1: HSE oscillator ON
Bits 15:8 HSICAL[7:0]: HSI clock calibration
These bits are initialized automatically at startup.
Bits 7:3 HSITRIM[4:0]: HSI clock trimming
These bits provide an additional user-programmable trimming value that is added to the
HSICAL[7:0] bits. It can be programmed to adjust to variations in voltage and temperature
that influence the frequency of the HSI.
The default value is 16, which, when added to the HSICAL value, should trim the HSI to 8
MHz ± 1%. The trimming step (F
steps.
Bit 2 Reserved, must be kept at reset value.
Bit 1 HSIRDY: HSI clock ready flag
Set by hardware to indicate that HSI oscillator is stable. After the HSION bit is cleared,
HSIRDY goes low after 6 HSI oscillator clock cycles.
0: HSI oscillator not ready
1: HSI oscillator ready
) is around 40 kHz between two consecutive HSICAL
hsitrim
Bit 0 HSION: HSI clock enable
Set and cleared by software.
Set by hardware to force the HSI oscillator ON when leaving Stop or Standby mode or in
case of failure of the HSE crystal oscillator used directly or indirectly as system clock. This
bit cannot be reset if the HSI is used directly or indirectly as system clock or is selected to
become the system clock.
0: HSI oscillator OFF
1: HSI oscillator ON
Doc ID 018940 Rev 193/742
Reset and clock control (RCC)RM0091
7.4.2 Clock configuration register (RCC_CFGR)
Address offset: 0x04
Reset value: 0x0000 0000
Access: 0 ≤ wait state ≤ 2, word, half-word and byte access
1 or 2 wait states inserted only if the access occurs during clock source switch.
31302928272625242322212019181716
ResResResResResMCO[2:0]ResResPLLMUL[3:0]
rwrwrwrwrwrwrwrwrw
1514131211109876543210
Res
ADCP
ResResResPPRE[2:0]HPRE[3:0]SWS[1:0]SW[1:0]
RE
rwrwrwrwrwrwrwrwrrrwrw
PLL
XTPRE
Bits 31:27 Reserved, must be kept at reset value.
Bits 26:24 MCO: Microcontroller clock output
Set and cleared by software.
000: MCO output disabled, no clock on MCO
001: Reserved
010: Reserved
011: HSI14 clock selected
100: System clock (SYSCLK) selected
101: HSI clock selected
110: HSE clock selected
111: PLL clock divided by 2 selected
Note: This clock output may have some truncated cycles at startup or during MCO clock
source switching.
Bits 23:22Reserved, must be kept at reset value.
PLL
SRC
94/742Doc ID 018940 Rev 1
RM0091Reset and clock control (RCC)
Bits 21:18 PLLMUL: PLL multiplication factor
These bits are written by software to define the PLL multiplication factor. These bits can be
written only when PLL is disabled.
Caution: The PLL output frequency must not exceed 48 MHz.
0000: PLL input clock x 2
0001: PLL input clock x 3
0010: PLL input clock x 4
0011: PLL input clock x 5
0100: PLL input clock x 6
0101: PLL input clock x 7
0110: PLL input clock x 8
0111: PLL input clock x 9
1000: PLL input clock x 10
1001: PLL input clock x 11
1010: PLL input clock x 12
1011: PLL input clock x 13
1100: PLL input clock x 14
1101: PLL input clock x 15
1110: PLL input clock x 16
1111: PLL input clock x 16
Bit 17PLLXTPRE: HSE divider for PLL input clock
This bits is set and cleared by software to select the HSE division factor for the PLL. It can
be written only when the PLL is disabled.
Note: This bit is the same as the LSB of PREDIV in Clock configuration register 2
(RCC_CFGR2) (for compatibility with other STM32 products)
0000: HSE input to PLL not divided
0001: HSE input to PLL divided by 2
Bit 16 PLLSRC: PLL entry clock source
Set and cleared by software to select PLL clock source. This bit can be written only when
PLL is disabled.
0: HSI/2 selected as PLL input clock
1: HSE/PREDIV selected as PLL input clock (refer to Section 7.4.12: Clock configuration
register 2 (RCC_CFGR2) on page 113
Bit 15 Reserved, must be kept at reset value.
Bit 14 ADCPRE: ADC prescaler
Set and cleared by software to select the frequency of the clock to the ADC.
0: PCLK divided by 2
1: PCLK divided by 4
Bits 13:11 Reserved, must be kept at reset value.
Bits 10:8 PPRE: PCLK prescaler
Set and cleared by software to control the division factor of the APB clock (PCLK).
0xx: HCLK not divided
100: HCLK divided by 2
101: HCLK divided by 4
110: HCLK divided by 8
111: HCLK divided by 16
Doc ID 018940 Rev 195/742
Reset and clock control (RCC)RM0091
Bits 7:4 HPRE: HLCK prescaler
Set and cleared by software to control the division factor of the AHB clock.
0xxx: SYSCLK not divided
1000: SYSCLK divided by 2
1001: SYSCLK divided by 4
1010: SYSCLK divided by 8
1011: SYSCLK divided by 16
1100: SYSCLK divided by 64
1101: SYSCLK divided by 128
1110: SYSCLK divided by 256
1111: SYSCLK divided by 512
Bits 3:2 SWS: System clock switch status
Set and cleared by hardware to indicate which clock source is used as system clock.
00: HSI oscillator used as system clock
01: HSE oscillator used as system clock
10: PLL used as system clock
11: not applicable
Bits 1:0 SW: System clock switch
Set and cleared by software to select SYSCLK source.
Cleared by hardware to force HSI selection when leaving Stop and Standby mode or in case
of failure of the HSE oscillator used directly or indirectly as system clock (if the Clock
Security System is enabled).
00: HSI selected as system clock
01: HSE selected as system clock
10: PLL selected as system clock
11: not allowed
96/742Doc ID 018940 Rev 1
RM0091Reset and clock control (RCC)
7.4.3 Clock interrupt register (RCC_CIR)
Address offset: 0x08
Reset value: 0x0000 0000
Access: no wait state, word, half-word and byte access
31302928272625242322212019181716
ResResResResResResResResCSSCRes
wwwwwww
1514131211109876543210
ResRes
HSI14
RDYIE
PLL
HSE
HSI
RDYIE
RDYIE
RDYIE
rwrwrwrwrwrwrrrrrrr
LSE
RDYIE
LSI
RDYIE
CSSFRes
HSI14
RDYC
HSI14
RDYF
Bits 31:24 Reserved, must be kept at reset value.
Bit 23 CSSC: Clock security system interrupt clear
This bit is set by software to clear the CSSF flag.
0: No effect
1: Clear CSSF flag
PLL
RDYC
PLL
RDYF
HSE
RDYC
HSE
RDYF
HSI
RDYC
HSI
RDYF
LSE
RDYC
LSE
RDYF
LSI
RDYC
LSI
RDYF
Bit 22Reserved, must be kept at reset value.
Bit 21 HSI14RDYC: HSI 14 MHz Ready Interrupt Clear
This bit is set by software to clear the HSI14RDYF flag.
0: No effect
1: Clear HSI14RDYF flag
Bit 20 PLLRDYC: PLL ready interrupt clear
This bit is set by software to clear the PLLRDYF flag.
0: No effect
1: Clear PLLRDYF flag
Bit 19 HSERDYC: HSE ready interrupt clear
This bit is set by software to clear the HSERDYF flag.
0: No effect
1: Clear HSERDYF flag
Bit 18 HSIRDYC: HSI ready interrupt clear
This bit is set software to clear the HSIRDYF flag.
0: No effect
1: Clear HSIRDYF flag
Bit 17 LSERDYC: LSE ready interrupt clear
This bit is set by software to clear the LSERDYF flag.
0: No effect
1: LSERDYF cleared
Bit 16 LSIRDYC: LSI ready interrupt clear
This bit is set by software to clear the LSIRDYF flag.
0: No effect
1: LSIRDYF cleared
Doc ID 018940 Rev 197/742
Reset and clock control (RCC)RM0091
Bits 15:14Reserved, must be kept at reset value.
Bit 13 HSI14RDYIE: HSI14 ready interrupt enable
Set and cleared by software to enable/disable interrupt caused by the HSI14 oscillator
stabilization.
Set and cleared by software to enable/disable interrupt caused by the LSI oscillator
stabilization.
0: LSI ready interrupt disabled
1: LSI ready interrupt enabled
Bit 7 CSSF: Clock security system interrupt flag
Set by hardware when a failure is detected in the HSE oscillator.
Cleared by software setting the CSSC bit.
0: No clock security interrupt caused by HSE clock failure
1: Clock security interrupt caused by HSE clock failure
Bit 6Reserved, must be kept at reset value.
Bit 5HSI14RDYF: HSI14 ready interrupt flag
Set by hardware when the HSI14 becomes stable and HSI14RDYDIE is set in a response
to setting the HSI14ON bit (refer to Clock configuration register 2 (RCC_CFGR2). When
HSI14ON is not set but the HSI14 oscillator is enabled by the peripheral through a clock
request, this bit is not set and no interrupt is generated.
Cleared by software setting the HSI14RDYC bit.
0: No clock ready interrupt caused by the HSI14 oscillator
1: Clock ready interrupt caused by the HSI14 oscillator
98/742Doc ID 018940 Rev 1
RM0091Reset and clock control (RCC)
Bit 4 PLLRDYF: PLL ready interrupt flag
Set by hardware when the PLL locks and PLLRDYDIE is set.
Cleared by software setting the PLLRDYC bit.
0: No clock ready interrupt caused by PLL lock
1: Clock ready interrupt caused by PLL lock
Bit 3 HSERDYF: HSE ready interrupt flag
Set by hardware when the HSE clock becomes stable and HSERDYDIE is set.
Cleared by software setting the HSERDYC bit.
0: No clock ready interrupt caused by the HSE oscillator
1: Clock ready interrupt caused by the HSE oscillator
Bit 2 HSIRDYF: HSI ready interrupt flag
Set by hardware when the HSI clock becomes stable and HSIRDYDIE is set in a response
to setting the HSION (refer to Clock control register (RCC_CR)). When HSION is not set
but the HSI oscillator is enabled by the peripheral through a clock request, this bit is not set
and no interrupt is generated.
Cleared by software setting the HSIRDYC bit.
0: No clock ready interrupt caused by the HSI oscillator
1: Clock ready interrupt caused by the HSI oscillator
Bit 1 LSERDYF: LSE ready interrupt flag
Set by hardware when the LSE clock becomes stable and LSERDYDIE is set.
Cleared by software setting the LSERDYC bit.
0: No clock ready interrupt caused by the LSE oscillator
1: Clock ready interrupt caused by the LSE oscillator
Bit 0 LSIRDYF: LSI ready interrupt flag
Set by hardware when the LSI clock becomes stable and LSIRDYDIE is set.
Cleared by software setting the LSIRDYC bit.
0: No clock ready interrupt caused by the LSI oscillator
1: Clock ready interrupt caused by the LSI oscillator