STM8AF6213/13A
STM8AF6223/23A STM8AF6226
Automotive 8-bit MCU, with up to 8-Kbyte Flash memory, data
EEPROM, 10-bit ADC, timers, LIN, SPI, I²C, 3 to 5.5 V
Datasheet
-
production data
Features
•
AEC-Q100 qualified
•
Core
– Max f
CPU
: 16 MHz
– Advanced STM8A core with Harvard
architecture and 3-stage pipeline
– Extended instruction set
•
Memories
– Program memory: 4 to 8 Kbyte Flash
program; data retention 20 years at 55 °C
after 1 kcycle
– Data memory: 640 byte true data
EEPROM; endurance 300 kcycle
– RAM: 1 Kbyte
•
Clock management
– Low-power crystal resonator oscillator with
external clock input
– Internal, user-trimmable 16 MHz RC and
low-power 128 kHz RC oscillators
– Clock security system with clock monitor
•
Reset and supply management
– Wait/auto-wakeup/Halt low-power modes
with user definable clock gating
– Low-consumption power-on and power-
down reset
•
Interrupt management
– Nested interrupt controller with 32
interrupts
– Up to 28 external interrupts on 7 vectors
•
Timers
– Advanced control timer: 16-bit, 4 CAPCOM
channels, 3 complementary outputs, dead-
time insertion and flexible synchronization
– 16-bit general purpose timer with 3
CAPCOM channels each (IC, OC, PWM)
– 8-bit AR basic timer with 8-bit prescaler
– Auto-wakeup timer
– Window and independent watchdog timers
LQFP32 7x7 mm
VFQFPN32 (5x5 mm)
TSSOP20 (6.4x4.4 mm)
•
I/Os
– Up to 28 I/Os on a 32-pin package
including 21 high sink outputs
– Highly robust I/O design, immune against
current injection
•
Communication interfaces
– LINUART LIN 2.2 compliant, master/slave
modes with automatic resynchronization
– SPI interface up to 8 Mbit/s or f
MASTER
/2
– I
2
C interface up to 400 Kbit/s
•
Analog to digital converter (ADC)
– 10-bit, ± 1 LSB ADC with up to 7 muxed
channels + 1 internal channel, scan mode
and analog watchdog
– Internal reference voltage measurement
•
Operating temperature up to 150 °C
December 2017
This is information on a product in full production.
DocID025118 Rev 7
1/110
www.st.com
Contents
STM8AF6213/13A/23/23A/26
Contents
1
2
3
4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Product overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.1
Central processing unit (CPU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.1.1
4.1.2
4.1.3
Architecture and registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Instruction set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
SWIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Debug module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2
Single wire interface module (SWIM) and debug module (DM) . . . . . . . . 13
4.2.1
4.2.2
4.3
4.4
Interrupt controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Flash program and data EEPROM memory . . . . . . . . . . . . . . . . . . . . . . . 13
4.4.1
4.4.2
Write protection (WP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Read-out protection (ROP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.5
4.6
4.7
4.8
4.9
4.10
4.11
4.12
4.13
4.14
Clock controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.5.1
Power management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Watchdog timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Auto wakeup counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Beeper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
TIM1 - 16-bit advanced control timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
TIM5 - 16-bit general purpose timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
TIM6 - 8-bit basic timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Analog-to-digital converter (ADC1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Communication interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.14.1
4.14.2
4.14.3
LINUART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Serial peripheral interface (SPI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Inter integrated circuit (I
2
C) interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
2/110
DocID025118 Rev 7
STM8AF6213/13A/23/23A/26
Contents
5
Pinout and pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.1
5.2
5.3
TSSOP20 pinouts and pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . 22
LQFP32/VFQPN32 pinout and pin description . . . . . . . . . . . . . . . . . . . . . 28
Alternate function remapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6
Memory and register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.1
6.2
Memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.2.1
6.2.2
I/O port hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
CPU/SWIM/debug module/interrupt controller registers . . . . . . . . . . . . 42
7
8
Interrupt vector mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
8.1
8.2
Option byte description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
STM8AF6213/13A/23/23A/26 alternate function remapping bits . . . . . . . 48
9
Electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
9.1
Parameter conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
9.1.1
9.1.2
9.1.3
9.1.4
9.1.5
Minimum and maximum values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Typical values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Typical curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Loading capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
9.2
9.3
Absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
9.3.1
9.3.2
9.3.3
9.3.4
9.3.5
9.3.6
9.3.7
9.3.8
9.3.9
9.3.10
VCAP external capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Supply current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
External clock sources and timing characteristics . . . . . . . . . . . . . . . . . 66
Internal clock sources and timing characteristics . . . . . . . . . . . . . . . . . 68
Memory characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
I/O port pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Reset pin characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
SPI serial peripheral interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
I
2
C interface characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
10-bit ADC characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
DocID025118 Rev 7
3/110
4
Contents
9.3.11
STM8AF6213/13A/23/23A/26
EMC characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
10
Package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
10.1
10.2
10.3
10.4
LQFP32 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
TSSOP20 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
VFQFPN32 package information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Thermal characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
10.4.1
10.4.2
Reference document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Selecting the product temperature range . . . . . . . . . . . . . . . . . . . . . . 101
11
12
Ordering information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
STM8 development tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
12.1
12.2
Emulation and in-circuit debugging tools . . . . . . . . . . . . . . . . . . . . . . . . 104
12.1.1
12.2.1
12.2.2
STice key features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
STM8 toolset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
C and assembly toolchains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Software tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
12.3
Programming tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
13
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4/110
DocID025118 Rev 7
STM8AF6213/13A/23/23A/26
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.
STM8AF6213/13A/23/23A/26 features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Peripheral clock gating bit assignments in CLK_PCKENR1/2 registers . . . . . . . . . . . . . . . 15
TIM timer features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Communication peripheral naming correspondence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Legend/abbreviations for pinout tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
STM8AF6213/STM8AF6223 TSSOP20 pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
STM8AF6213A and STM8AF6223A TSSOP20 pin description . . . . . . . . . . . . . . . . . . . . . 25
STM8AF6226 LQFP32/VFQPN32 pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Memory model for the devices covered in this datasheet. . . . . . . . . . . . . . . . . . . . . . . . . . 34
I/O port hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
General hardware register map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
CPU/SWIM/debug module/interrupt controller registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Interrupt mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Option bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Option byte description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
STM8AF6226 alternate function remapping bits [7:2] for 32-pin packages . . . . . . . . . . . . 48
STM8AF6213 and STM8AF6223 alternate function remapping bits [7:2]
for 20-pin packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
STM8AF6213A and STM8AF6223A alternate function remapping bits [7:2]
for 20-pin packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
STM8AF6226 alternate function remapping bits [1:0] for 32-pin packages . . . . . . . . . . . . 50
STM8AF6213/STM8AF6223 alternate function remapping bits [1:0]
for 20-pin packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
STM8AF6223A alternate function remapping bits [1:0] for 20-pin packages . . . . . . . . . . . 51
Voltage characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Operating lifetime (OLF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
General operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Operating conditions at power-up/power-down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Total current consumption with code execution in run mode at V
DD
= 5 V. . . . . . . . . . . . . 57
Total current consumption with code execution in run mode at V
DD
= 3.3 V . . . . . . . . . . . 58
Total current consumption in wait mode at V
DD
= 5 V . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Total current consumption in wait mode at V
DD
= 3.3 V . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Total current consumption in active halt mode at V
DD
= 5 V . . . . . . . . . . . . . . . . . . . . . . . 60
Total current consumption in active halt mode at V
DD
= 3.3 V . . . . . . . . . . . . . . . . . . . . . . 60
Total current consumption in halt mode at V
DD
= 5 V. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Total current consumption in halt mode at V
DD
= 3.3 V . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Wakeup times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Total current consumption and timing in forced reset state . . . . . . . . . . . . . . . . . . . . . . . . 62
Peripheral current consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
HSE user external clock characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
HSE oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
HSI oscillator characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
LSI oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
RAM and hardware registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Flash program memory/data EEPROM memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Flash program memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
DocID025118 Rev 7
5/110
6