STM32F031x4 STM32F031x6
ARM
®
-based 32-bit MCU with up to 32 Kbyte Flash, 9 timers,
ADC and communication interfaces, 2.0 - 3.6 V
Datasheet
-
production data
Features
•
Core: ARM
®
32-bit Cortex
®
-M0 CPU,
frequency up to 48 MHz
•
Memories
– 16 to 32 Kbytes of Flash memory
– 4 Kbytes of SRAM with HW parity
•
CRC calculation unit
•
Reset and power management
– Digital and I/Os supply: 2.0 to 3.6 V
– Analog supply: V
DDA
= from V
DD
to 3.6 V
– Power-on/Power-down reset (POR/PDR)
– Programmable voltage detector (PVD)
– Low power modes: Sleep, Stop and
Standby
– V
BAT
supply for RTC and backup registers
•
Clock management
– 4 to 32 MHz crystal oscillator
– 32 kHz oscillator for RTC with calibration
– Internal 8 MHz RC with x6 PLL option
– Internal 40 kHz RC oscillator
•
Up to 39 fast I/Os
– All mappable on external interrupt vectors
– Up to 26 I/Os with 5 V tolerant capability
•
5-channel DMA controller
•
1 × 12-bit, 1.0 µs ADC (up to 10 channels)
– Conversion range: 0 to 3.6V
– Separate analog supply from 2.4 up to
3.6 V
•
Up to 9 timers
– 1 x 16-bit 7-channel advanced-control timer
for 6 channels PWM output, with deadtime
generation and emergency stop
– 1 x 32-bit and 1 x 16-bit timer, with up to 4
IC/OC, usable for IR control decoding
– 1 x 16-bit timer, with 2 IC/OC, 1 OCN,
deadtime generation and emergency stop
LQFP32 7x7 mm UFQFPN32 5x5 mm
LQFP48 7x7 mm UFQFPN28 4x4 mm
WLCSP25
2.1x2.1 mm
TSSOP20
6.5x4.4 mm
– 1 x 16-bit timer, with IC/OC and OCN,
deadtime generation, emergency stop and
modulator gate for IR control
– 1 x 16-bit timer with 1 IC/OC
– Independent and system watchdog timers
– SysTick timer: 24-bit downcounter
•
Calendar RTC with alarm and periodic wakeup
from Stop/Standby
•
Communication interfaces
– 1 x I
2
C interface, supporting Fast Mode
Plus (1 Mbit/s) with 20 mA current sink,
SMBus/PMBus, and wakeup from Stop
mode
– 1 x USART supporting master synchronous
SPI and modem control, ISO7816
interface, LIN, IrDA capability, auto baud
rate detection and wakeup feature
– 1 x SPI (18 Mbit/s) with 4 to 16
programmable bit frames, with I
2
S interface
multiplexed
•
Serial wire debug (SWD)
•
96-bit unique ID
•
Extended temperature range: -40 to +105°C
•
All packages ECOPACK
®
2
Table 1. Device summary
Reference
Part number
STM32F031C6, STM32F031E6,
STM32F031x6 STM32F031F6, STM32F031G6,
STM32F031K6
STM32F031x4
STM32F031C4, STM32F031F4,
STM32F031G4, STM32F031K4
May 2017
This is information on a product in full production.
DocID025743 Rev 6
1/106
www.st.com
Contents
STM32F031x4 STM32F031x6
Contents
1
2
3
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Functional overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.1
3.2
3.3
3.4
3.5
ARM
®
-Cortex
®
-M0 core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
Memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
Boot modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
Cyclic redundancy check calculation unit (CRC) . . . . . . . . . . . . . . . . . . . 12
Power management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.5.1
3.5.2
3.5.3
3.5.4
Power supply schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Power supply supervisors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.6
3.7
3.8
3.9
Clocks and startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
General-purpose inputs/outputs (GPIOs) . . . . . . . . . . . . . . . . . . . . . . . . . 14
Direct memory access controller (DMA) . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Interrupts and events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.9.1
3.9.2
Nested vectored interrupt controller (NVIC) . . . . . . . . . . . . . . . . . . . . . . 15
Extended interrupt/event controller (EXTI) . . . . . . . . . . . . . . . . . . . . . . 15
Temperature sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Internal voltage reference (V
REFINT
) . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
V
BAT
battery voltage monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Advanced-control timer (TIM1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
General-purpose timers (TIM2, 3, 14, 16, 17) . . . . . . . . . . . . . . . . . . . . 17
Independent watchdog (IWDG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
System window watchdog (WWDG) . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
SysTick timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.10
Analog-to-digital converter (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.10.1
3.10.2
3.10.3
3.11
Timers and watchdogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.11.1
3.11.2
3.11.3
3.11.4
3.11.5
3.12
3.13
3.14
2/106
Real-time clock (RTC) and backup registers . . . . . . . . . . . . . . . . . . . . . . 19
Inter-integrated circuit interface (I
2
C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Universal synchronous/asynchronous receiver/transmitter (USART) . . . 20
DocID025743 Rev 6
STM32F031x4 STM32F031x6
Contents
3.15
3.16
Serial peripheral interface (SPI) / Inter-integrated sound interface (I
2
S) . 21
Serial wire debug port (SW-DP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4
5
6
Pinouts and pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Memory mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.1
Parameter conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.1.1
6.1.2
6.1.3
6.1.4
6.1.5
6.1.6
6.1.7
Minimum and maximum values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Typical values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Typical curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Loading capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Power supply scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Current consumption measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.2
6.3
Absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.3.1
6.3.2
6.3.3
6.3.4
6.3.5
6.3.6
6.3.7
6.3.8
6.3.9
6.3.10
6.3.11
6.3.12
6.3.13
6.3.14
6.3.15
6.3.16
6.3.17
6.3.18
6.3.19
General operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Operating conditions at power-up / power-down . . . . . . . . . . . . . . . . . . 41
Embedded reset and power control block characteristics . . . . . . . . . . . 42
Embedded reference voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Supply current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Wakeup time from low-power mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
External clock source characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Internal clock source characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
PLL characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
EMC characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Electrical sensitivity characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
I/O current injection characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
I/O port characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
NRST pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
12-bit ADC characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Temperature sensor characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
V
BAT
monitoring characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Timer characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
DocID025743 Rev 6
3/106
4
Contents
6.3.20
STM32F031x4 STM32F031x6
Communication interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
7
Package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
7.1
7.2
7.3
7.4
7.5
7.6
7.7
LQFP48 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
LQFP32 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
UFQFPN32 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
UFQFPN28 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
WLCSP25 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
TSSOP20 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
7.7.1
7.7.2
Reference document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Selecting the product temperature range . . . . . . . . . . . . . . . . . . . . . . 100
8
9
Ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
4/106
DocID025743 Rev 6
STM32F031x4 STM32F031x6
List of tables
List of tables
Table 1.
Table 2.
Table 3.
Table 4.
Table 5.
Table 6.
Table 7.
Table 8.
Table 9.
Table 10.
Table 11.
Table 12.
Table 13.
Table 14.
Table 15.
Table 16.
Table 17.
Table 18.
Table 19.
Table 20.
Table 21.
Table 22.
Table 23.
Table 24.
Table 25.
Table 26.
Table 27.
Table 28.
Table 29.
Table 30.
Table 31.
Table 32.
Table 33.
Table 34.
Table 35.
Table 36.
Table 37.
Table 38.
Table 39.
Table 40.
Table 41.
Table 42.
Table 43.
Table 44.
Table 45.
Table 46.
Table 47.
Device summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
STM32F031x4/x6 family device features and peripheral counts . . . . . . . . . . . . . . . . . . . . . 9
Temperature sensor calibration values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Internal voltage reference calibration values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Timer feature comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Comparison of I
2
C analog and digital filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
STM32F031x4/x6 I
2
C implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
STM32F031x4/x6 USART implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
STM32F031x4/x6 SPI/I2S implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Legend/abbreviations used in the pinout table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Pin definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Alternate functions selected through GPIOA_AFR registers for port A . . . . . . . . . . . . . . . 31
Alternate functions selected through GPIOB_AFR registers for port B . . . . . . . . . . . . . . . 32
Peripheral register boundary addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Voltage characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
General operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Operating conditions at power-up / power-down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Embedded reset and power control block characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . 42
Programmable voltage detector characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Embedded internal reference voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Typical and maximum current consumption from V
DD
at 3.6 V . . . . . . . . . . . . . . . . . . . . . 44
Typical and maximum current consumption from the V
DDA
supply . . . . . . . . . . . . . . . . . 45
Typical and maximum current consumption in Stop and Standby modes . . . . . . . . . . . . 46
Typical and maximum current consumption from the V
BAT
supply. . . . . . . . . . . . . . . . . . . 47
Typical current consumption, code executing from Flash memory,
running from HSE 8 MHz crystal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Switching output I/O current consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Peripheral current consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Low-power mode wakeup timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
High-speed external user clock characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Low-speed external user clock characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
HSE oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
LSE oscillator characteristics (f
LSE
= 32.768 kHz) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
HSI oscillator characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
HSI14 oscillator characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
LSI oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
PLL characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Flash memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Flash memory endurance and data retention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
EMS characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
EMI characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
ESD absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Electrical sensitivities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
I/O current injection susceptibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
I/O static characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Output voltage characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
DocID025743 Rev 6
5/106
6