ST STM8L101F1, STM8L101F2, STM8L101F3, STM8L101G2, STM8L101G3, STM8L101K3 User Manual
8-bit ultralow power microcontroller with up to 8 Kbytes Flash,
UFQFPN28
UFQFPN32
LQFP32
TSSOP20
UFQFPN20
Features
■ Main microcontroller features
– Supply voltage range 1.65 V to 3.6 V
– Low power consumption (Halt: 0.3 µA,
Active-halt: 0.8 µA, Dynamic Run:
150 µA/MHz)
– STM8 Core with up to 16 CISC MIPS
throughput
– Temp. range: -40 to 85 °C and 125 °C
■ Memories
– Up to 8 Kbytes of Flash program including
up to 2 Kbytes of data EEPROM
– Error correction code (ECC)
– Flexible write and read protection modes
– In-application and in-circuit programming
– Data EEPROM capability
– 1.5 Kbytes of static RAM
■ Clock management
– Internal 16 MHz RC with fast wakeup time
(typ. 4 µs)
– Internal low consumption 38 kHz RC
driving both the IWDG and the AWU
■ Reset and supply management
– Ultralow power, ultrasafe power-on-reset
/power down reset
– Three low power modes: Wait, Active-halt,
Halt
■ Interrupt management
– Nested interrupt controller with software
priority control
– Up to 29 external interrupt sources
■ I/Os
– Up to 30 I/Os, all mappable on external
interrupt vectors
– I/Os with prog. input pull-ups, high
channels (used as IC, OC, PWM)
– One 8-bit timer (TIM4) with 7-bit prescaler
– Infrared remote control (IR)
– Independent watchdog
– Auto-wakeup unit
– Beeper timer with 1, 2 or 4 kHz frequencies
– SPI synchronous serial interface
– Fast I2C Multimaster/slave 400 kHz
– USART with fractional baud rate generator
– 2 comparators with 4 inputs each
■ Development support
– Hardware single wire interface module
(SWIM) for fast on-chip programming and
non intrusive debugging
– In-circuit emulation (ICE)
AWU: Auto-wakeup unit
Int. RC: internal RC oscillator
I²C: Inter-integrated circuit multimaster interface
POR/PDR: Power on reset / power down reset
SPI: Serial peripheral interface
SWIM: Single wire interface module
USART: Universal synchronous / asynchronous receiver / transmitter
IWDG: Independent watchdog
Doc ID 15275 Rev 119/81
Product overviewSTM8L101xx
3.1 Central processing unit STM8
The 8-bit STM8 core is designed for code efficiency and performance.
It features 21 internal registers, 20 addressing modes including indexed, indirect and relative
addressing, and 80 instructions.
3.2 Development tools
Development tools for the STM8 microcontrollers include:
●The STice emulation system offering tracing and code profiling
●The STVD high-level language debugger including C compiler, assembler and
integrated development environment
●The STVP Flash programming software
The STM8 also comes with starter kits, evaluation boards and low-cost in-circuit
debugging/programming tools.
3.3 Single wire data interface (SWIM) and debug module
The debug module with its single wire data interface (SWIM) permits non-intrusive real-time
in-circuit debugging and fast memory programming.
The Single wire interface is used for direct access to the debugging module and memory
programming. The interface can be activated in all device operation modes.
The non-intrusive debugging module features a performance close to a full-featured
emulator. Beside memory and peripherals, also CPU operation can be monitored in realtime by means of shadow registers.
3.4 Interrupt controller
The STM8L101xx features a nested vectored interrupt controller:
●Nested interrupts with 3 software priority levels
●26 interrupt vectors with hardware priority
●Up to 29 external interrupt sources on 10 vectors
●Trap and reset interrupts
10/81 Doc ID 15275 Rev 11
STM8L101xxProduct overview
3.5 Memory
The STM8L101xx devices have the following main features:
●1.5 Kbytes of RAM
●The EEPROM is divided into two memory arrays (see the STM8L reference manual for
details on the memory mapping):
–Up to 8 Kbytes of low-density embedded Flash program including up to 2 Kbytes
of data EEPROM. Data EEPROM and Flash program areas can be write protected
independently by using the memory access security mechanism (MASS).
–64 option bytes (one block) of which 5 bytes are already used for the device.
Error correction code is implemented on the EEPROM.
3.6 Low power modes
To minimize power consumption, the product features three low power modes:
●Wait mode: CPU clock stopped, selected peripherals at full clock speed.
●Active-halt mode: CPU and peripheral clocks are stopped. The programmable wakeup
time is controlled by the AWU unit.
●Halt mode: CPU and peripheral clocks are stopped, the device remains powered on.
Wakeup is triggered by an external interrupt.
3.7 Voltage regulators
The STM8L101xx embeds an internal voltage regulator for generating the 1.8 V power
supply for the core and peripherals.
This regulator has two different modes: main voltage regulator mode (MVR) and low power
voltage regulator mode (LPVR). When entering Halt or Active-halt modes, the system
automatically switches from the MVR to the LPVR in order to reduce current consumption.
3.8 Clock control
The STM8L101xx embeds a robust clock controller. It is used to distribute the system clock
to the core and the peripherals and to manage clock gating for low power modes. This
system clock is a 16-MHz High Speed Internal RC oscillator (HSI RC), followed by a
programmable prescaler.
In addition, a 38 kHz low speed internal RC oscillator is used by the independent watchdog
(IWDG) and Auto-wakeup unit (AWU).
3.9 Independent watchdog
The independent watchdog (IWDG) peripheral can be used to resolve processor
malfunctions due to hardware or software failures.
It is clocked by the 38 kHZ LSI internal RC clock source, and thus stays active even in case
of a CPU clock failure.
Doc ID 15275 Rev 1111/81
Product overviewSTM8L101xx
3.10 Auto-wakeup counter
The auto-wakeup (AWU) counter is used to wakeup the device from Active-halt mode.
3.11 General purpose and basic timers
STM8L101xx devices contain two 16-bit general purpose timers (TIM2 and TIM3) and one
8-bit basic timer (TIM4).
16-bit general purpose timers
The 16-bit timers consist of 16-bit up/down auto-reload counters driven by a programmable
prescaler. They perform a wide range of functions, including:
●Time base generation
●Measuring the pulse lengths of input signals (input capture)
●Generating output waveforms (output compare, PWM and One pulse mode)
●Interrupt capability on various events (capture, compare, overflow, break, trigger)
●Synchronization with other timers or external signals (external clock, reset, trigger and
enable)
8-bit basic timer
The 8-bit timer consists of an 8-bit up auto-reload counter driven by a programmable
prescaler. It can be used for timebase generation with interrupt generation on timer overflow.
3.12 Beeper
The STM8L101xx devices include a beeper function used to generate a beep signal in the
range of 1, 2 or 4 kHz when the LSI clock is operating at a frequency of 38 kHz.
3.13 Infrared (IR) interface
The STM8L101xx devices contain an infrared interface which can be used with an IR LED
for remote control functions. Two timer output compare channels are used to generate the
infrared remote control signals.
3.14 Comparators
The STM8L101xx features two zero-crossing comparators (COMP1 and COMP2) sharing
the same current bias and voltage reference. The voltage reference can be internal
(comparison with ground) or external (comparison to a reference pin voltage).
Each comparator is connected to 4 channels, which can be used to generate interrupt, timer
input capture or timer break. Their polarity can be inverted.
12/81 Doc ID 15275 Rev 11
STM8L101xxProduct overview
3.15 USART
The USART interface (USART) allows full duplex, asynchronous communications with
external devices requiring an industry standard NRZ asynchronous serial data format. It
offers a very wide range of baud rates.
3.16 SPI
The serial peripheral interface (SPI) provides half/ full duplex synchronous serial
communication with external devices. It can be configured as the master and in this case it
provides the communication clock (SCK) to the external slave device. The interface can also
operate in multi-master configuration.
3.17 I²C
The inter-integrated circuit (I2C) bus interface is designed to serve as an interface between
the microcontroller and the serial I
2
C bus. It provides multi-master capability, and controls all
I²C bus-specific sequencing, protocol, arbitration and timing. It manages standard and fast
speed modes.
Doc ID 15275 Rev 1113/81
Pin descriptionSTM8L101xx
2
1
3
4
5
67 8
9
11
12
13
14
15
16171819
PD0 (HS) / TIM3_CH2 / COMP1_CH3
V
DD
V
SS
PA3 (HS)
PA2 (HS)
PB0 (HS) / TIM2_CH1 / COMP1_CH1
NRST / PA1 (HS)
PC3 (HS) / USART_TX
PC4 (HS) / USART_CK / CCO
PC2 (HS) / USART_RX
PC1 / I²C_SCL
PB4 (HS) / SPI_NSS
PB5 (HS) / SPI_SCK
PB6 (HS) / SPI_MOSI
PB7 (HS) / SPI_MISO
PC0 / I²C_SDA
PB1 (HS) / TIM3_CH1 /COMP1_CH2
PB2 (HS) / TIM2_CH2 / COMP2_CH1
10
PB3 (HS) / TIM2_TRIG / COMP2_CH2
PA0 (HS) / SWIM / BEEP / IR_TIM
20
4 Pin description
Figure 2.Standard 20-pin UFQFPN package pinout
1. HS corresponds to 20 mA high sink/source capability.
2. High sink LED driver capability available on PA0. Refer to the description of the IR_CR register in the
STM8L reference manual (RM0013).
Note:The COMP_REF pin is not available in this standard 20-pin UFQFPN package. It is available
on Port A6 in the 20-pin UFQFPN package pinout for STM8L101F1U6ATR,
STM8L101F2U6ATR and STM8L101F3U6ATR part numbers (Figure 3 on page 15).
14/81 Doc ID 15275 Rev 11
STM8L101xxPin description
2
1
3
4
5
67 8
9
11
12
13
14
15
16171819
PD0 (HS) / TIM3_CH2 / COMP1_CH3
V
DD
V
SS
PA6 (HS) / COMP_REF
PA2 (HS)
PB0 (HS) / TIM2_CH1 / COMP1_CH1
NRST / PA1 (HS)
PC3 (HS) / USART_TX
PC4 (HS) / USART_CK / CCO
PC2 (HS) / USART_RX
PC1 / I²C_SCL
PB4 (HS) / SPI_NSS
PB5 (HS) / SPI_SCK
PB6 (HS) / SPI_MOSI
PB7 (HS) / SPI_MISO
PC0 / I²C_SDA
PB1 (HS) / TIM3_CH1 /COMP1_CH2
PB2 (HS) / TIM2_CH2 / COMP2_CH1
10
PB3 (HS) / TIM2_TRIG / COMP2_CH2
PA0 (HS) / SWIM / BEEP / IR_TIM
20
Figure 3.20-pin UFQFPN package pinout for STM8L101F1U6ATR,
STM8L101F2U6ATR and STM8L101F3U6ATR part numbers
1. Please refer to the warning below.
2. HS corresponds to 20 mA high sink/source capability.
3. High sink LED driver capability available on PA0. Refer to the description of the IR_CR register in the
STM8L reference manual (RM0013).
Warning:For the STM8L101F1U6ATR, STM8L101F2U6ATR and
STM8L101F3U6ATR part numbers (devices with COMP_REF
pin), all ports available on 32-pin packages must be
considered as active ports. To avoid spurious effects, you
have to configure them as input pull-up. A small increase in
consumption (typ. < 300 µA) may occur during the power up
and reset phase until these ports are properly configured.
Doc ID 15275 Rev 1115/81
Pin descriptionSTM8L101xx
PA 3 ( H S )
PA 2 ( HS )
NRST / PA1 (HS)
PA0 (HS) / SWIM / BEEP / IR_TIM
PC4 (HS) / USART_CK/ CCO
V
SS
PC3 (HS) / USART_TX
PC0 / I²C_SDA
PC1 / I²C_SCL
PB7 (HS) / SPI_MISO
PB6 (HS) / SPI_MOSI
PB1 (HS) / TIM3_CH1 / COMP1_CH2
PB2 (HS) / TIM2_CH2 / COMP2_CH1
PB3 (HS) /TIM2_TRIG /COMP2_CH2
PB4 (HS) / SPI_NSS
PB5 (HS) / SPI_SCK
V
DD
PD0 (HS) / TIM3_CH2 / COMP1_CH3
PB0 (HS) / TIM2_CH1 / COMP1_CH1
PC2 (HS) / USART_RX
1
2
3
4
5
6
7
10
9
8
20
19
18
17
16
15
14
11
12
13
Figure 4.20-pin TSSOP package pinout
1. HS corresponds to 20 mA high sink/source capability.
2. High sink LED driver capability available on PA0. Refer to the description of the IR_CR register in the
STM8L reference manual (RM0013).
16/81 Doc ID 15275 Rev 11
STM8L101xxPin description
PD3
(HS) / COMP2_CH4
PB0 (HS) / TIM2_CH1 / COMP1_CH1
PB1 (HS) / TIM3_CH1 / COMP1_CH2
PB2 (HS) / TIM2_CH2 / COMP2_CH1
PD0 (HS) / TIM3_CH2 / COMP1_CH3
PD1 (HS) / TIM3_TRIG / COMP1_CH4
PD2(HS) / COMP2_CH3
PA5 (HS) / TIM3_BKIN
V
SS
V
DD
NRST / PA1 (HS)
PA2 ( H S )
PA3 (HS)
PA4 (HS) / TIM2_BKIN
PB6 (HS) / SPI_MOSI
PB5 (HS) / SPI_SCK
PB4 (HS) / SPI_NSS
PB3 (HS) / TIM2_TRIG / COMP2_CH2
PC0 / I²C_SDA
PD4 (HS)
PB7 (HS) / SPI_MISO
PC4 (HS) / USART_CK / CCO
PC3 (HS) / USART_TX
PC2 (HS) / USART_RX
PC1 / I²C_SCL
PA0 (HS) / SWIM / BEEP / IR_TIM
PC6 (HS)
PC5 (HS)
2
1
3
4
5
6
7
9810 11 12 13 14
20
21
19
18
17
16
15
272826 25 24 23 22
Figure 5.Standard 28-pin UFQFPN package pinout
1. HS corresponds to 20 mA high sink/source capability.
2. High sink LED driver capability available on PA0. Refer to the description of the IR_CR register in the
STM8L reference manual (RM0013).
Note:The COMP_REF pin is not available in this standard 28-pin UFQFPN package. It is available
on Port A6 in the 28-pin UFQFPN package pinout for STM8L101G3U6ATR and
STM8L101G2U6ATR part numbers (Figure 6 on page 18).
Doc ID 15275 Rev 1117/81
Pin descriptionSTM8L101xx
PD3(HS) / COMP2_CH4
PB0 (HS) / TIM2_CH1 / COMP1_CH1
PB1 (HS) / TIM3_CH1 / COMP1_CH2
PB2 (HS) / TIM2_CH2 / COMP2_CH1
PD0 (HS) / TIM3_CH2 / COMP1_CH3
PD1 (HS) / TIM3_TRIG / COMP1_CH4
PD2(HS) / COMP2_CH3
PA6 (HS) / COMP_REF
V
SS
V
DD
NRST / PA1 (HS)
PA2 ( H S )
PA3 (HS)
PA4 (HS) / TIM2_BKIN
PB6 (HS) / SPI_MOSI
PB5 (HS) / SPI_SCK
PB4 (HS) / SPI_NSS
PB3 (HS) / TIM2_TRIG / COMP2_CH2
PC0 / I²C_SDA
PD4 (HS)
PB7 (HS) / SPI_MISO
PC4 (HS) / USART_CK / CCO
PC3 (HS) / USART_TX
PC2 (HS) / USART_RX
PC1 / I²C_SCL
PA0 (HS) / SWIM / BEEP / IR_TIM
PC6 (HS)
PC5 (HS)
2
1
3
4
5
6
7
9810 11 12 13 14
20
21
19
18
17
16
15
272826 25 24 23 22
Figure 6.28-pin UFQFPN package pinout for STM8L101G3U6ATR and
STM8L101G2U6ATR part numbers
1. HS corresponds to 20 mA high sink/source capability.
2. High sink LED driver capability available on PA0. Refer to the description of the IR_CR register in the
STM8L reference manual (RM0013).
Warning:For the STM8L101G3U6ATR and STM8L101G2U6ATR part
numbers (devices with COMP_REF pin), all ports available on
32-pin packages must be considered as active ports. To avoid
spurious effects, you have to configure them as input pull-up.
A small increase in consumption (typ. < 300 µA) may occur
during the power up and reset phase until these ports are
properly configured.
18/81 Doc ID 15275 Rev 11
STM8L101xxPin description
1
2
3
4
PA5 (HS) / TIM3_BKIN
PA6 (HS) / COMP_REF
V
SS
V
DD
NRST / PA1 (HS)
PA2 (HS)
PA3 (HS)
PA4 (HS) / TIM2_BKIN
PD1 (HS) / TIM3_TRIG / COMP1_CH4
PD2 (HS) / / COMP2_CH3
PD3 (HS) / COMP2_CH4
PB0 (HS) / TIM2_CH1 / COMP1_CH1
PB1 (HS) / TIM3_CH1 / COMP1_CH2
PB2 (HS) / TIM2_CH2 / COMP2_CH1
PB3 (HS) / TIM2_TRIG / COMP2_CH2
PD0 (HS) / TIM3_CH2 / COMP1_CH3
PD7 (HS)
PD6 (HS)
PB4 (HS) / SPI_NSS
PB5 (HS) / SPI_SCK
PB7 (HS) / SPI_MISO
PD5 (HS)
PD4 (HS)
PB6 (HS) / SPI_MOSI
PC3 (HS) / USART_TX
PC2 (HS) / USART_RX
PC1 / I²C_SCL
PC0 / I²C_SDA
PA0 (HS) / SWIM / BEEP / IR_TIM
PC6 (HS)
PC5 (HS)
PC4 (HS) / USART_CK / CCO
5
6
7
8
910111213 14 15 16
17
18
19
20
21
22
23
24
32 31 30 29
28 27 26 25
Figure 7.32-pin package pinout
1. Example given for the UFQFPN32 package. The pinout is the same for the LQFP32 package.
2. HS corresponds to 20 mA high sink/source capability.
3. High sink LED driver capability available on PA0. Refer to the description of the IR_CR register in the
STM8L reference manual (RM0013).
Doc ID 15275 Rev 1119/81
Pin descriptionSTM8L101xx
Table 3.Legend/abbreviation for table 4
Typ eI= input, O = output, S = power supply
Level
InputCM = CMOS
OutputHS = high sink/source (20 mA)
Port and control
configuration
Inputfloat = floating, wpu = weak pull-up
OutputT = true open drain, OD = open drain, PP = push pull
Bold X (pin state after reset release).
Reset state
Unless otherwise specified, the pin state is the same during the reset phase (i.e.
“under reset”) and after internal reset release (i.e. at reset state).
SWIM input and output /Beep output/Timer Infrared
20 20 328 28 32
(5)
/SWIM/
PA 0
BEEP/IR_TIM
(6)
I/O XX
(5)
XHS
(6)
XXPort A0
output
1. Please refer to the warning below.
2. At power-up, the PA1/NRST pin is a reset input pin with pull-up. To be used as a general purpose pin (PA1), it can be
configured only as output open-drain or push-pull, not as a general purpose input. Refer to Section Configuring NRST/PA1 pin as general purpose output in the STM8L101xx reference manual (RM0013).
3. A pull-up is applied to PB0 and PB4 during the reset phase. These two pins are input floating after reset release.
4. In the open-drain output column, ‘T’ defines a true open-drain I/O (P-buffer and protection diode to V
implemented).
5. The PA0 pin is in input pull-up during the reset phase and after reset release.
6. High sink LED driver capability available on PA0.
are not
DD
Warning:For the STM8L101F1U6ATR, STM8L101F2U6ATR,
STM8L101F3U6ATR, STM8L101G2U6ATR and
STM8L101G3U6ATR part numbers (devices with COMP_REF
pin), all ports available on 32-pin packages must be
considered as active ports. To avoid spurious effects, you
have to configure them as input pull-up. A small increase in
consumption (typ. < 300 µA) may occur during the power up
and reset phase until these ports are properly configured.
22/81 Doc ID 15275 Rev 11
STM8L101xxMemory and register map
GPIO and peripheral registers
(2)
0x00 0000
Reserved
Flash program memory
(up to 8 Kbytes)
(1)
Interrupt vectors
0x00 4800
0x00 48FF
RAM
0x00 05FF
(1.5 Kbytes)
(1)
(up to 513 bytes)
(1)
0x 004900
Option bytes
0x00 5000
0x00 57FF
0x00 5800
0x00 7FFF
0x00 8000
0x00 9FFF
0x00 0600
0x00 47FF
0x00 49FF
0x00 7EFF
0x00 8080
0x00 807F
CPU/SWIM/Debug/ITC
Registers
0x00 7F00
Reserved
Reserved
including
Stack
including
Data EEPROM
(up to 2 Kbytes)
0x 004925
0x 004931
0x 004924
0x 004930
Unique ID
Reserved
Low-density
5 Memory and register map
Figure 8.Memory map
1. Table 5 lists the boundary addresses for each memory size. The top of the stack is at the RAM end
address.
2. Refer to Table 7 for an overview of hardware register mapping, to Table 6 for details on I/O port hardware
registers, and to Ta b le 8 for information on CPU/SWIM/debug module controller registers.
Doc ID 15275 Rev 1123/81
Memory and register mapSTM8L101xx
Table 5.Flash and RAM boundary addresses
Memory areaSizeStart addressEnd address
RAM1.5 Kbytes0x00 00000x00 05FF
2 Kbytes0x00 80000x00 87FF
Flash program memory
Table 6.I/O Port hardware register map
4 Kbytes0x00 80000x00 8FFF
8 Kbytes0x00 80000x00 9FFF
AddressBlockRegister labelRegister name
0x00 5000
PA_ODRPort A data output latch register 0x00
Reset
status
0x00 5001PA_IDRPort A input pin value register 0xxx
0x00 5002PA_DDRPort A data direction register 0x00
Por t A
0x00 5003PA_CR1Port A control register 1 0x00
0x00 5004PA_CR2Port A control register 2 0x00
0x00 5005
PB_ODRPort B data output latch register 0x00
0x00 5006PB_IDRPort B input pin value register 0xxx
0x00 5007PB_DDRPort B data direction register 0x00
Por t B
0x00 5008PB_CR1Port B control register 1 0x00
0x00 5009PB_CR2Port B control register 2 0x00
0x00 500A
PC_ODRPort C data output latch register 0x00
0x00 500BPC_IDRPort C input pin value register 0xxx
0x00 500CPC_DDRPort C data direction register 0x00
Por t C
0x00 500DPC_CR1Port C control register 1 0x00
0x00 500EPC_CR2Port C control register 2 0x00
0x00 500F
PD_ODRPort D data output latch register 0x00
0x00 5010PD_IDRPort D input pin value register 0xxx
0x00 5011PD_DDRPort D data direction register 0x00