For designers of STM8L microcontroller applications, it is important to be able to replace
easily one microcontroller type by another one in the same product family. Migrating an
application to a different microcontroller is often needed when product requirements grow,
putting extra demands on the memory size and on the number of I/Os.
However, to achieve cost reduction objectives, the user may need to switch to smaller
components and to shrink the PCB area. This application note aims at analyzing the steps
required to migrate from an existing STM8L-based design to any one of the other
microcontroller types in the fast-growing STM8L family.
This application note groups all the most important information and provides a list of the
fundamental aspects.
The information included in this document can also be extremely useful in a first STM8
design. Studying the issues in this phase can allow the user to adapt from the beginning his
design to any future requirement.
To benefit fully from the information in this application note, the user should be familiar with
the STM8L microcontroller family. The STM8L family reference manuals (RM0013 and
RM0031), the STM8L datasheets, and the STM8L Flash program memory / data EEPROM
programming manual (PM0054) are available from www.st.com.
This application note is divided into four main sections:
■ Section 1: STM8L family compatibility: This section presents a first-level view of the
different aspects of the STM8L family architecture that must be taken into account for a
new design or migration. The microcontroller blocks and peripherals are grouped and
identified either as “compatible” or “compatible with minor limitations”.
■ Section 2: Planning for migration: This section gives an overview of common migration
cases. It provides a checklist of items which are potentially impacted by each case to allow
the user to quickly analyze which subjects have to be anticipated.
■ Section 3: Block-by-block compatibility: This section focuses on the migration
between different packages and details the pin-to-pin compatibility between all STM8L
sub-families.
■ Section 4: Peripheral pinout through all STM8L sub-families. This section shows the
The STM8L family is one of a growing number of different STM8 microcontroller families.
All these STM8 microcontroller families are based on a common robust and low-cost 8-bit
high performance core with a rich set of enhanced peripherals. This ensures a high level of
compatibility within the STM8L ‘world’, especially in terms of software development,
compilers, debugging environment, programming tools and driver libraries.
The STM8L product family offers a wide choice of memory sizes and package types to fit
different application requirements as closely as possible. Consequently, when there are new
requirements on the application side, it can make sense to switch to another STM8L type
with different memory capacity or package size.
The STM8L family includes a product line divided into two main sub-families:
●STM8L15x/STM8L16x sub-family of microcontrollers with different memory densities,
packages and peripherals.
–The low density STM8L15x devices are the STM8L151C2/K2/G2/F2,
STM8L151C3/K3/G3/F3 microcontrollers with a 4-Kbyte or 8-Kbyte Flash memory
density.
–The medium density STM8L15x devices are the STM8L151C4/K4/G4,
STM8L151C6/K6/G6, STM8L152C4/K4/G4 and STM8L152C6/K6/G6
microcontrollers with a 16-Kbyte or 32-Kbyte Flash memory density.
–The medium+ density STM8L15x devices are the STM8L151R6 and
STM8L152R6 microcontrollers with a 32-Kbyte Flash memory density. They offer
a wider range of peripherals than the medium density devices.
–The high density STM8L15x devices are the STM8L151x8 and STM8L152x8
microcontrollers with a Flash memory density equal to 64 Kbytes. They offer the
same peripheral set as medium+ density devices.
–The high density STM8L162x devices are the STM8L162x8 microcontrollers
where the Flash memory density is equal to 64 Kbytes. They offer the same
peripheral set as high density STM8L152 devices plus the AES hardware
accelerator.
●STM8L10x low density sub-family where the Flash memory density ranges between 4
and 8 Kbytes. The STM8L10x MCUs are ideal for cost-sensitive applications with low
code density.
Both sub-families provide a complete set of essential peripherals. STM8L10x devices target
applications requiring reduced cost, lower memory capacity, fewer GPIOs and less
advanced features.
The wide range of available pin-counts and package sizes is discussed in Chapter 3.1:
Package pinout.
6/63Doc ID 16993 Rev 3
AN3139STM8L family compatibility
All STM8L family microcontrollers use the same application development tools:
●Embedded single wire interface module (SWIM)
●Software integrated development environment (IDE) tools including assembler,
simulator, debugger, programmer:
–ST Visual Develop (ST)
–Ride (Raisonance)
–IAR
●In-circuit debugging and programming tools
–STIce from ST (full hardware emulator)
–ST-Link from ST
–RLink from Raisonance (low cost debug/programming tool)
●Starter kits and evaluation boards
●C compiler and assembler tool chains (Cosmic, Raisonance, IAR)
●Firmware libraries (peripheral control examples, MISRA or class B compliance, touch
sensing)
●Application notes
By using a common development environment, you significantly reduce code maintenance
effort and shorten the time-to-market, especially in cases when an application has to be
migrated from one STM8 microcontroller to another.
By using the drivers provided in the STM8L firmware library to interface with the hardware, it
becomes reasonably straightforward to move the application firmware from one STM8L
product to another. The principle job is analyzing the details on the hardware side, taking
care of the placement and availability of the peripheral I/O functions in the pinout. More
details can be obtained in the STM8L datasheet and further in this document in Section 3.1:
Package pinout.
Figure 1: STM8L family block diagram gives an overview of the STM8L blocks and their
compatibility level, as discussed in the next sections.
Table 1.Overview of STM8L family peripherals
Peripheral
RAMUp to 1.5 KbytesUp to 2 KbytesUp to 2 KbytesUp to 4 Kbytes
Flash
Program
memory
STM8L10xSTM8L15x/STM8L16x
Low density
STM8L10x
Up to 8 Kbytes From 4 to 8 Kbytes
Low density
STM8L15x
Medium
density
STM8L15x
From 16 to
32 Kbytes
Medium+/High density STM8L15x/
High density STM8L16x
32 Kbytes in medium+ density devices
64 Kbytes in high density devices
(STM8L15x/16x)
Doc ID 16993 Rev 37/63
STM8L family compatibilityAN3139
Table 1.Overview of STM8L family peripherals (continued)
STM8L10xSTM8L15x/STM8L16x
Peripheral
Data
EEPROM
Interrupt
C L K Ye sYe sYe sYe s
AWUYes
RTC
B e e pYe sYe sYe sYe s
I W D G Ye sYe sYe sYe s
WWDGNot availableYesYesYes
C O M PYe sYe sYesYe s
RI &
SYSCFG
Low density
STM8L10x
Up to 2 Kbytes in
Flash program
memory
Size configurable
by option byte
Up to 26 Peripheral
interrupt vectors
Not availableYesYesYes
Not availableYesYesYes
Low density
STM8L15x
Up to 1 Kbytes in
separate memory
array;
Fixed size
Up to 32 Peripheral
interrupt vectors
Not availableNot availableNot available
Medium
density
STM8L15x
Up to 1 Kbytes
in separate
memory array;
Fixed size
Up to 32
Peripheral
interrupt vectors
Medium+/High density STM8L15x/
High density STM8L16x
Up to 2 Kbytes in separate memory
Fixed size
Up to 32 Peripheral interrupt vectors
array;
GPIO
EXTI
DMA
ADCNot availableADC1ADC1ADC1
DAC
TIM
Infrared
Interface
IRTIM
I2CI2CI2C1I2C1I2C1
Up to 30I/Os
(GPIOA..D)
Up to 29 external
interrupt lines
Not available
Not availableDAC1 channelDAC 1 channelsDAC 2channels
Basic TIM4
General-purpose
TIM2/3
Ye sYe sYe sYe s
Up to 41 I/Os
(GPIOA..F)
Up to 40 external
interrupt lines
DMA1 with 4
channels
Basic TIM4
General-purpose
TIM2/3
Up to 41 I/Os
(GPIOA..F)
Up to 40
external
interrupt lines
DMA1 with 4
channels
Basic TIM4
General-
purpose TIM2/3
Advanced-
control TIM1
Up to 68 I/Os (GPIOA..F) in high
density devices
Up to 67 external interrupt lines
DMA1 with 4 channels
Basic TIM4
General-purpose TIM2/3/5
Advanced-control TIM1
8/63Doc ID 16993 Rev 3
AN3139STM8L family compatibility
Table 1.Overview of STM8L family peripherals (continued)
STM8L10xSTM8L15x/STM8L16x
Peripheral
SPISPISPI1SPI1SPI1/SPI2
USARTUSARTUSART1USART1USART1/USART2/USART3
LCDNot availableYesYesYes
AES
1. Available on high-density STM8L16x devices only.
Low density
STM8L10x
Not availableNot availableNot availableYes
Low density
STM8L15x
Medium
density
STM8L15x
Medium+/High density STM8L15x/
High density STM8L16x
(1)
1.2 Fully compatible blocks
The STM8L family embeds a set of system blocks which are by definition common to all
products. Those blocks are identical, so they have the same structure, registers and control
bits. There is no need to perform any software change to keep the same functionality at the
application level after migration. When external components are needed (e.g. Vcap
capacitor) no change is required from one product to another. All the features and behaviors
remain the same. These blocks are shown in Figure 1: STM8L family block diagram.
Fully compatible parts and peripherals are:
●STM8 core
●Debug / SWIM module
●Power-on reset (POR)
●Voltage regulator
●Low speed internal RC (LSI)
●High speed internal RC (HSI)
●Independent watchdog
●Timers (TIM2, TIM3 and TIM4)
●IR (infrared interface)
1.3 Blocks that are compatible with minor exceptions
Some of the peripherals or functional blocks can have differences in their electrical
parameters, structure, registers, control bits or other minor aspects but not in their main
functionality.
peripherals are not available in STM8L10x devices.
SPI2, USART2 and USART3 are not available in low and medium density STM8L15x
devices.
The AES peripheral is available only in high density STM8L16x devices.
The AWU peripheral is not available in STM8L15x devices and is replaced by the RTC, so
this aspect can also be considered as an incompatibility.
The following functional blocks can be considered as compatible with only a few negligible
differences:
●GPIO (I/O capabilities)
●Interrupt management (interrupt vectors)
●Power control (wakeup from low power mode)
●I2C1 (true open drain)
●SPI1
●USART1
●Internal memories (Flash, SRAM, EEPROM)
You can find more details about these blocks in Chapter 3: Block-by-block compatibility
analysis. You can also refer to Figure 1: STM8L family block diagram.
1.4 Blocks that are compatible with significant exceptions
A few peripherals have additional features or less important functionalities compared to the
same peripheral in another STM8L sub-family. For these particular peripherals you have to
adapt the software drivers and check all possible hardware dependencies.
The peripheral and functional blocks in the following list are compatible with significant
exceptions. The package pinout is high on the list as this aspect requires special attention:
●Package pinout
●CLK
●COMP
●ADC
●DAC
●LCD
●RTC
You can find more details in Section 3: Block-by-block compatibility analysis. You can also
refer to Figure 1: STM8L family block diagram.
10/63Doc ID 16993 Rev 3
AN3139STM8L family compatibility
)NTERNAL2#OSCILLATOR
-(Z
)NTERNAL2#OSCILLATOR
K(Z
%XTERNAL2#OSCILLATOR
-(Z
#/-0
34-#ORE
)/S
)NFRAREDINTERFACE
)NTERRUPTCONTROLLER
37)-DEBUGMODULE
%XTERNAL2#OSCILLATOR
K(Z
#LOCK
CONTROLLER
AND#33
2ESETBLOCK
6OLTAGEREGULATOR
0/2 0$2 "/2 06$
!DDRESSANDDATABUS
!DDRESSANDDATABUS
&LASH
MEMORY
2!-
MEMORY
4)-
%%02/-
MEMORY
"OOT2/-
MEMORY
)7$'
!75
$!#
!$#
,#$
24#
77$'
30)
30)
)#
$-!
&ULLYCOMPATIBLE
#OMPATIBLEWITHMINOREXCEPTIONS
#OMPATIBLEWITHSIGNIFICANTEXCEPTIONS
,EGEND
-36
53!24
53!24
53!24
4)-
4)-
!%3
Figure 1.STM8L family block diagram
1. LCD, ADC1, WWDG, RTC, DAC, DMA, Boot ROM and AWU are fully compatible but not present in all
STM8L devices.
1.5 Firmware library
The peripheral compatibility throughout STM8L MCU families promotes platform design and
eases significantly the migration from one product line to the other. The software support is
Doc ID 16993 Rev 311/63
STM8L family compatibilityAN3139
however essential during development time. Extensive software libraries are available for
both STM8L10x, STM8L15x and STM8L16x devices, providing the user with a hardware
abstraction layer (HAL) for all MCU resources. Moreover, there is not a single control/status
bit that is not covered by a C function or an API.
The software library covers three abstraction levels, and it includes:
1.A complete register address map with all bits, bit fields and registers declared in C. By
providing this map, the software library makes the designers’ task much lighter and,
even more importantly so, it gives all the benefits of a bug-free reference mapping file,
thus speeding up the early project phase.
2. A collection of routines and data structures in API form, that covers all peripheral
functions. This collection can directly be used as a reference framework, since it also
includes macros for supporting core-related intrinsic features and common constant
and data type definition. Moreover, it is compiler agnostic and can therefore be used
with any existing or future toolchain. It was developed using the MISRA C automotive
standard.
3. A set of examples covering all available peripherals (35 examples so far for the
STM8L10x sub-family, 35 for the STM8L15x sub-family), with template projects for the
most common development toolchains. With the appropriate hardware evaluation
board, only a few hours are needed to get started with a brand new microcontroller. It is
then up to you to choose how to use the library. You can either pick up the files useful
for the design, use examples to get trained or quickly evaluate the product. You can
also use the API to save development time.
Let us now have a look at the few key files and concepts. Two separate libraries support the
STM8L10x and STM8L15x devices. In the file names below, you simply need to replace the
“stm8l1xx_” prefix by “stm8l10x” or “stm8l15x” depending on the chosen product.
●stm8l1xx_.h
This file is the only header file that must be included in the C source code, usually in main.c.
This file contains:
–data structures and address mapping for all peripherals
–macros to access peripheral register hardware (for bit manipulation for instance),
plus STM8 core intrinsics
–a configuration section used to select the device implemented in the target
application. You also have the choice to use or not the peripheral drivers in the
application code (that is code based on direct access to registers rather than
through API drivers)
●stm8l1xx_conf.h
This is the peripheral driver configuration file, where you specify the peripherals you want to
use in your application, plus a few application-specific parameters such as the crystal frequency.
●stm8l1xxx_it.c
This file contains the template IRQ handler to be filled, but this is already the first
development step.
Once you have understood the above operating principle and file organization, for simple
applications, you could virtually switch from one product to the other without referring to the
reference manual. Figure 2: STM8L10x code example and Figure 3: STM8L15x code exam-
ple show the initialization code (using the firmware library) for STM8L10x and STM8L15x
products, respectively.
12/63Doc ID 16993 Rev 3
AN3139STM8L family compatibility
Figure 2.STM8L10x code example
Figure 3.STM8L15x code example
All parameters are identical, and the procedure is similar with two function calls for both configuration and startup.
The main difference is the additional peripherals of the same type that are added in the
STM8L15x sub-family:
●when migrating from STM8L10x sub-family to STM8L15x sub-family, the additional
peripheral must be added in every firmware library function as the first parameter (refer
to Figure 3)
●when migrating from STM8L15x sub-family to STM8L10x sub-family, the additional
peripheral given as the first parameter in every firmware library function must be
removed (refer to Figure 2)
Another difference in the SPI peripheral is the CRC capability which is supported only in the
STM8L15x devices. In the above example (Figure 3.), the CRC polynomial “0x07” is explicitly defined. This CRC polynomial parameter must be removed from the “init” function in the
case of a migration from the STM8L15x sub-family to the STM8L10x sub-family.
The following table shows an overview of the firmware library compatibility between the two
sub-families STM8L10x and STM8L15x/STM8L16x and between the different peripherals of
the STM8L15x/STM8L16x sub-family. It describes the differences in terms of:
1.New features like the IrDA, Smartcard, Halfduplex and DAC dual channel features
2. Common features but with different implementations, like the comparator and CLK
initialization.
Doc ID 16993 Rev 313/63
STM8L family compatibilityAN3139
To migrate from the STM8L10x sub-family to the STM8L15x/STM8L16x sub-family when
using the communication peripherals (SPI, I2C or USART), you have to add the additional
peripheral of the same type as the first parameter in every function used from the firmware
library. A full compatibility, in terms of function parameter names, is guaranteed for all
common features.
14/63Doc ID 16993 Rev 3
Table 2.STM8L firmware library compatibility
STM8L10xSTM8L15x/STM8L16x
AN3139STM8L family compatibility
Doc ID 16993 Rev 315/63
Peripheral
Flash
Low density STM8L10x Low density STM8L15xMedium density STM8L15x
Low density STM8L10x Low density STM8L15xMedium density STM8L15x
WWDGNot availableSame APISame APISame API
IWDG Same APISame APISame APISame API
SYSCFG
AES
Not availableSame APISame APISame API
Not availableNot availableNot availableNew Peripheral
Medium+/High density
STM8L15x/ High density
STM8L16x
Planning for migrationAN3139
2 Planning for migration
To migrate your application from one sub-family to another, you have to analyze the hardware migration as well as the application resources and firmware migration.
2.1 Hardware migration
If you use the same package and the same pin numbers, you can use the same PCB without any modification. All sub-families are pin-to-pin compatible.
2.2 Application resources and firmware migration
You have to analyze the compatibility level of your peripherals between the initial sub-family
and the new sub-family in the following cases:
●If you use the same resources and peripherals of the same type
–you do not have to modify anything in your code except the clock configuration
(Example: TIMx)
●If you use the same resources and different peripherals of the same type
–If one peripheral of the same type is not present any more, you can change the
reference to this peripheral and all related features (pin, clock and interrupt
configuration).
●If you use new resources and/or new peripherals of the same type
–If you need to migrate the application from STM8L10x devices to STM815x
devices without using the new peripherals, the user software can be kept as is
without any modification except the clock configuration. Using the standard
Peripherals library has several advantages: it saves coding time while
simultaneously reducing application development and integration costs.
The following table explains how to migrate from one sub-family to another and from one
package to another.
The table is intended to be used as follows:
●Sub-families or devices within the family are listed in rows. Moving between the rows
means changing the sub-family or changing the device.
●Available package sizes are listed in columns. Moving between columns means
changing the pin-count.
●The gray fields represent the migration between each column or row and give the
impacted features.
The impact of moves between two subfamilies is common for all available package pairs.
Therefore all gray cells in rows are merged into common fields. The text in these common
fields is as follows:
●When migrating downwards: the row between both sub-families lists the features that
are lost due to the migration.
●When migrating upwards, the row between both sub-families lists the features that are
added due to the migration.
26/63Doc ID 16993 Rev 3
AN3139Planning for migration
A move to the right towards smaller packages mainly leads to a loss of I/O pins. So the
content of these cells is a simple list of impacted items only.
This section mainly discusses cases of migration between neighboring pairs. However, your
project may be a migration over several rows or columns in Ta bl e 3 or even in a diagonal
direction. In this case, you should check the differences indicated in each step passed by
the vertical and horizontal moves through the following table.
The following table gives an overview of the available packages in each STM8L family
Table 4.Overview of STM8L family packages
STM8L10xSTM8L15x/STM8L16x
Medium+/High
Package
Low density STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
density
STM8L15x/ High
density
STM8L16x
LQFP80
LQFP64
UFQFPN48Not availableNot availableNot availablex
LQFP48Not availablexxx
LQFP32x
VFQFPN48
WFQFPN32Not availableNot availablexNot available
WFQFPN28
UFQFPN28Not availablexxNot available
UFQFPN32xx
UFQFPN28xx
UFQFPN28xxNot availableNot available
Not availableNot availableNot availablex
Not availableNot availableNot availablex
Not availablexNot available
Not availableNot availablexNot available
Not availableNot availablexNot available
Not availableNot available
Not availableNot available
UFQFPN20xxNot availableNot available
UFQFPN20Not availablexNot availableNot available
3.1.1 Digital power supply
The digital power supply design includes two supply sources. The purpose is to distribute
the current flowing through the I/O logic separately from the rest of the digital microcontroller
Doc ID 16993 Rev 329/63
Block-by-block compatibility analysisAN3139
circuits. Up to two V
DDIO
/ V
pin pairs are used as well as the main VDD / VSS digital
SSIO
supply pair, depending on the pin-count:
●Both V
pairs are present in the 48-pin package in the STM8L15x/STM8L16x sub-
DDIO
family.
●Only one V
pin is available to supply power to the I/Os in the STM8L10x and
DDIO
STM8L15x/STM8L16x sub-families from 32-pin packages to 20-pin packages.
The total output current is limited by the number of supply pins. The total output current
capability declines for smaller packages, regardless of the number of I/Os with high-sink
capability.
In the medium, medium+ and high density STM8L15x/STM8L16x devices,, the V
connecting the external voltage source for the LCD is present on the 48-pin and 32-pin
packages when the LCD is available.
3.1.2 ADC power supply and voltage reference
The analog power supply design includes an extra power supply for the analog parts of the
microcontroller and an external reference voltage connected via an extra pin pair.
●The V
DDA/VSSA
and 48-pin packages in the STM8L15x/STM8L16x sub-family. Without these pins, it is
not possible to use the ADC zooming function feature (see Section 3.4: ADC modes for
more details).
●For the rest of the STM8L15x/STM8L16x sub-family (32-pin package) the ADC
reference is taken from the main analog supply V
Note:As the ADC is not present in the STM8L10x family, V
supply pins are not available on packages for this family.
and the V
REF+/VREF-
analog supply pin pair are present on the 28-pin
.
DDA
DDA/VSSA
and V
REF+/VREF
pin for
LCD
analog
3.1.3 Alternate functions
The main purpose of the alternate feature concept is to keep the microcontroller
configurable for different user and application needs. This is especially important and useful
in low pin-count packages.
Default alternate functions can be enabled on dedicated pins by settings in the peripheral
registers.
In the STM8L15x/STM8L16x sub-family, a large number of alternate functions can be
remapped to other pins by programming the system configuration controller registers.
Consequently, many functions that would otherwise be lost by migrating to a smaller
package size are preserved by remapping alternate functions to the remaining pins. For
more details on pinout and packages, please refer to the related datasheet.
3.2 GPIO and peripheral registers
3.2.1 Mapping overview
The space for the GPIO and peripheral registers is mapped in the memory area between
addresses 0x5000 and 0x57FF. The register blocks for each peripheral available in the subfamily have the same start addresses and the same register names.
30/63Doc ID 16993 Rev 3
AN3139Block-by-block compatibility analysis
The STM8L15x/STM8L16x sub-family, family has some peripherals that are not supported
in the STM8L10x sub-family. In addition, some peripherals are not fully compatible between
the two families, which explains why two firmware libraries are developed: one for the
STM8L10x sub-family and the other for the STM8L15x/STM8L16x sub-family. To avoid any
confusion for the user, when a peripheral feature is available in more than one sub-family,
this feature has the same function name.
The following tables Table 5: Overview of STM8L family memory addresses and Tab l e 6:
Overview of STM8L family peripheral addresses give an overview of the mapping in the
Note:The gray cells show that the peripheral is not present.
3.2.2 GPIO
0x00 53E0 - 0x00
53EA
0x00 53EB - 0x00
53EF
0x00 53F0 - 0x00 53FA
All STM8L sub-families share the same GPIO architecture with a different number of ports
used in each sub-family and package. All products are pin-to-pin compatible.
34/63Doc ID 16993 Rev 3
AN3139Block-by-block compatibility analysis
The following table presents the number of ports and pins used in each superset of each
sub-family. For more details on pinout and packages, please refer to the related datasheet.
Table 7.STM8L family GPIOs overview
STM8L10xSTM8L15x/STM8L16x
Ports
Port APA0 - PA6PA0 - PA7PA0 - PA7PA0 - PA7
Port BPB0 - PB7PB0 - PB7PB0 - PB7PB0 - PB7
Port CPC0 - PC6PC0 - PC7PC0 - PC7PC0 - PC7
Port DPD0 - PD7PD0 - PD7PD0 - PD7PD0 - PD7
Por t E
Por t F
Por t G
Por t H
Low density
STM8L10x
Low density
STM8L15x
PE0 - PE7PE0 - PE7PE0 - PE7
PF0PF0PF0 - PF7
Medium density
STM8L15x
density STM8L15x/
Note:All I/Os available in the package are mapped on external interrupt vectors.
Medium+/High
High density
STM8L16x
PG0 - PG7
PH0 - PH7
Doc ID 16993 Rev 335/63
Block-by-block compatibility analysisAN3139
3.3 Advanced, general purpose and basic timers
All STM8L sub-families are equipped with the following timers:
●TIM2 general purpose timer (3x16-bit Cap/Com channels)
●TIM3 general purpose timers (2x16-bit Cap/Com channels)
●TIM4 basic timer: (1x8bit, no Cap/Com channel, no output)
Note:In the STM815x/STM8L16x sub-family, the basic timer is especially used to trigger the DAC.
In addition to these timers, the medium+ and high density STM8L15x/STM8L16x devices
are also equipped with the following timers:
●TIM1 advanced control timer: 16-bit up/down auto-reload counter with 16-bit prescaler,
wide range of modes, 4x16-bit Cap/Com channels, 3 of them have a complementary
output.
●TIM5 general purpose timers (2x16-bit Cap/Com channels).
The TIM1 is available also in medium density STM8L15x/STM8L16x devices.
All these timers are identical in all products. They are based on the same architecture and
are pin-to-pin compatible. On the software side, in all products, they use the same fully
compatible driver. The difference lies in the DMA capability feature that is supported only on
the STM8L15x/STM8L16x sub-family. The differences are shown in the following table.
The only difference between all products is the number of peripherals of the same type. In
addition, if a timer is not present in a product, the related trigger is also absent.
Table 8.Features of advanced, general purpose and basic timers
Timer
TIM1
16-bit
advanced
control timer
TIM2/TIM3
&
TIM5
16-bit general
purpose
timers
Counter type
up/down
up/down
Prescaler
from
1 to 65536 (Any
integer)
from
1 to 128
(Any power of
2)
Channels
Cap. Comp.
3+1*3YesYes
2NoNoYes
Complem.
outputs
Repet. Counter
Ext. trigger /
break inputs
Capture/ Compare
Capture/ Compare
Interrupt sources
Break Trigger
Commutation
Update event
Break
Trigger
Update event
DMA requests
Commutation
Capture/
Compare I
Update event
Capture/
Compare I
Update event
TIM4
8-bit basic
timer
36/63Doc ID 16993 Rev 3
Up
from
1 to 32768 (Any
power of 2)
0NoNoNo
Trigger
Update event
Update event
AN3139Block-by-block compatibility analysis
The following table shows the availability of timers in all products.
Table 9.STM8L family timers overview
STM8L10xSTM8L15x/STM8L16x
Timer type
Low density STM8L10x
Advanced
General purpose
BasicTIM4TIM4TIM4TIM4
Not availableNot availableTIM1TIM1
TIM2
TIM3
Low density
STM8L15x
TIM2
TIM3
Medium density
STM8L15x
TIM2
TIM3
The following table shows the internal triggers available for timer synchronisation.
Table 10.Overview of STM8L family timer internal trigger
Timers Internal
Trigg er
STM8L10xSTM8L15x/STM8L16x
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
Medium+/High density
Medium+/High
density
STM8L15x/ High
density STM8L16x
TIM2
TIM3
TIM5
STM8L15x/ High
density STM8L16x
TIM1
TIM2
TIM3
ITR0
ITR1
ITR2
ITR3
ITR0TIM4TIM4TIM4TIM4
ITR1
ITR2TIM3TIM3TIM3TIM3
ITR3TIM5
ITR0TIM4TIM4TIM4TIM4
ITR1
ITR2
ITR3TIM2TIM2TIM2TIM2
Doc ID 16993 Rev 337/63
TIM4TIM4
TIM5
TIM3TIM3
TIM2TIM2
TIM1TIM1
TIM1TIM1
TIM5
Block-by-block compatibility analysisAN3139
Table 10.Overview of STM8L family timer internal trigger (continued)
Timers Internal
Trigg er
ITR0
ITR1
TIM4
ITR2TIM3TIM3TIM3TIM3
ITR3TIM2TIM2TIM2TIM2
ITR0
ITR1
TIM5
ITR2
ITR3
3.4 ADC modes
This peripheral is only available in the STM8L15x sub-family. The table below presents the
pinout of the ADC in this sub-family.
STM8L10xSTM8L15x/STM8L16x
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
TIM1TIM1
Medium+/High density
STM8L15x/ High
density STM8L16x
TIM5
TIM4
TIM1
TIM3
TIM2
Table 11.Overview of STM8L family ADC channels
STM8L10xSTM8L15x/STM8L16x
Channels
Low density
STM8L10x
AIN0PA6PA6PA6
AIN1PA5PA5PA5
AIN2PA4PA4PA4
AIN3PC7PC7PC7
AIN4PC4PC4PC4
AIN5PC3PC3PC3
AIN6PC2PC2PC2
AIN7PD7PD7PD7
AIN8PD6PD6PD6
AIN9PD5PD5PD5
AIN10PD4PD4PD4
Low density
STM8L15x
ADC1
(1)
Medium density
STM8L15x
Medium+/High
density STM8L15x/
High density
STM8L16x
38/63Doc ID 16993 Rev 3
AN3139Block-by-block compatibility analysis
Table 11.Overview of STM8L family ADC channels
(1)
Channels
ADC1
STM8L10xSTM8L15x/STM8L16x
Low density
STM8L10x
Low density
STM8L15x
(continued)
Medium density
STM8L15x
Medium+/High
density STM8L15x/
High density
STM8L16x
AIN11
AIN12
AIN13
AIN14
AIN15
AIN16
AIN17
AIN18
AIN19
AIN20
AIN21
AIN22
AIN23
AIN24
AIN25
AIN26
AIN27
1. No AIN channel available in the STM8L10x devices.
PB7PB7PB7
PB6PB6PB6
PB5PB5PB5
PB4PB4PB4
PB3PB3PB3
PB2PB2PB2
PB1PB1PB1
PB0PB0PB0
PD3PD3PD3
PD2PD2PD2
PD1PD1PD1
PD0PD0PD0
PE5PE5PE5
PF0PF0PF0
PE7PF1
PE3PF2
PE4PF3
Doc ID 16993 Rev 339/63
Block-by-block compatibility analysisAN3139
The table below lists all TIMx internal triggers that can be used with ADC for the
STM8L15x/STM8L16x sub-family:
Table 12.TIMx internal triggers
ADC1
TIMx trigger
TIM1
TIM2
TIM3
TIM4
TIM5
1. No ADC TIMx trigger available in the STM8L10x devices.
3.5 DAC peripheral
This peripheral is only available in the STM8L15x/STM8L16x sub-family.
(1)
STM8L10xSTM8L15x/STM8L16x
Low density
STM8L10x
Low density
STM8L15x
TIM2_TRGO
event
Medium density
STM8L15x
TIM1_TRGO
event
TIM2_TRGO
event
Medium+/High
density
STM8L15x/ High
density
STM8L16x
TIM1_TRGO
event
TIM2_TRGO
event
The DAC has one output channel in the medium density STM8L15x/STM8L16x devices and
two output channels in medium+ and high density STM8L15x/STM8L16x devices. The dual
DAC channel mode feature is available on medium+ and high density STM8L15x/STM8L16x
devices.
All TIMx internal triggers that can be used with DAC for this sub-family are given in the
following table:
Table 13.Overview of STM8L family DACTIMx triggers
STM8L10xSTM8L15x/STM8L16x
DAC TIMx
trigger
TIM1-TRGO
TIM2-TRGO
TIM3-TRGO
TIM4-TRGOxxx
TIM5-TRGO
1. No DAC TIMx trigger available in the STM8L10x devices.
Low density
STM8L10x
Low density
STM8L15x
(1)
Medium density
STM8L15x
Medium+/High
density
STM8L15x/ High
density
STM8L16x
x
40/63Doc ID 16993 Rev 3
AN3139Block-by-block compatibility analysis
3.6 COMP peripherals
The STM8L products feature two zero-crossing comparators COMP1 and COMP2 that
share the same current bias. For the STM8L10x sub-family, the COMP1 and COMP2 share
also the reference voltage.
Each comparator has two inputs: inverting and non inverting inputs. The
STM8L15x/STM8L16x sub-family offers more capabilities than the STM8L10x sub-family in
terms of number and configuration of these inputs.
The following table shows the availability of the COMPx inverting and non inverting inputs in
both sub-families.
Table 14.Overview of comparator inputs
STM8L10xSTM8L15x/STM8L16x
Medium+/High
Comparator
Input
Low density
STM8L10x
PB0PA6PA6PA6
Low density
STM8L15x
Medium density
STM8L15x
density
STM8L15x/ High
density
STM8L16x
COMP1
Non Inverting Input
PB1PA5PA5PA5
PD0PA4PA4PA4
PD1PC7PC7PC7
PC4PC4PC4
PC3PC3PC3
PC2PC2PC2
PD7PD7PD7
PD6PD6PD6
PD5PD5PD5
PD4PD4PD4
PB7PB7PB7
PB6PB6PB6
PB5PB5PB5
PB4PB4PB4
PB3PB3PB3
PB2PB2PB2
PB1PB1PB1
PB0PB0PB0
PD3PD3PD3
PD2PD2PD2
Doc ID 16993 Rev 341/63
Block-by-block compatibility analysisAN3139
Table 14.Overview of comparator inputs (continued)
STM8L10xSTM8L15x/STM8L16x
Medium+/High
density
STM8L15x/ High
density
STM8L16x
PF1
PF2
PF3
COMP1
Comparator
Input
Non Inverting Input
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
PD1PD1PD1
PD0PD0PD0
PE5PE5PE5
PF0PF0PF0
PA 7
PE7
PE3
PE4
COMP2
Inverting Input
Non Inverting Input
PA 6
VSSV
REFINT
V
REFINT
V
REFINT
PB2PD1PD1PD1
PB3PD0PD0PD0
PD2PE5PE5PE5
PD3PE4
42/63Doc ID 16993 Rev 3
AN3139Block-by-block compatibility analysis
Table 14.Overview of comparator inputs (continued)
STM8L10xSTM8L15x/STM8L16x
Medium+/High
density
STM8L15x/ High
density
STM8L16x
DAC2 Output
COMP2
Comparator
Input
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
PA6PC7PC7PC7
VSSPC4PC4PC4
PC3PC3PC3
PE7
DAC1 OutputDAC1 OutputDAC1 Output
Inverting Input
3.7 LCD peripheral
This peripheral is available in the medium, medium+ and high density
STM8L15x/STM8L16x devices.
●In medium+ and high density STM8L15x/STM8L16x devices, it can interface with 8
common terminals and up to 44 segment terminals to drive up to 320 picture elements
(pixels).
●In medium density STM8L15x/STM8L16x devices, it can interface with 4 common
terminals and up to 28 segment terminals to drive up to 112 picture elements (pixels).
The table below gives the pinout of the LCD in the STM8L15x/STM8L16x sub-family.
Table 15.Overview of STM8L family LCD pins
STM8L10xSTM8L15x/STM8L16x
Channels
Low density
STM8L10x
Low density
STM8L15x
V
3/4V
1/2V
1/4V
REFINT
REFINT
REFINT
REFINT
(1)
LCD
Medium density
V
REFINT
3/4V
1/2V
1/4V
STM8L15x
REFINT
REFINT
REFINT
V
REFINT
3/4V
REFINT
1/2V
REFINT
1/4V
REFINT
Medium+/High
density STM8L15x/
High density
STM8L16x
COM0
COM1
COM2
COM3
PA 4PA 4
PA 5PA 5
PA 6PA 6
PD1PD1
Doc ID 16993 Rev 343/63
Block-by-block compatibility analysisAN3139
Table 15.Overview of STM8L family LCD pins (continued) (continued)
(1)
LCD
STM8L10xSTM8L15x/STM8L16x
Channels
Low density
STM8L10x
COM4PF4
Low density
STM8L15x
Medium density
STM8L15x
Medium+/High
density STM8L15x/
High density
STM8L16x
COM5
COM6
COM7
SEG0
SEG1
SEG2
SEG3
SEG4
SEG5
SEG6
SEG7
SEG8
SEG9
SEG10
SEG11
SEG12
SEG13
SEG14
SEG15
SEG16
PF5
PF6
PF7
PA 7PA 7
PE0PE0
PE1PE1
PE2PE2
PE3PE3
PE4PE4
PE5PE5
PD0PD0
PD2PD2
PD3PD3
PB0PB0
PB1PB1
PB2PB2
PB3PB3
PB4PB4
PB5PB5
PB6PB6
SEG17
SEG18
SEG19
SEG20
SEG21
SEG22
SEG23
SEG24
SEG25
44/63Doc ID 16993 Rev 3
PB7PB7
PD4PD4
PD5PD5
PD6PD6
PD7PD7
PC2PC2
PC3PC3
PC4PC4
PC7PC7
AN3139Block-by-block compatibility analysis
Table 15.Overview of STM8L family LCD pins (continued) (continued)
(1)
LCD
STM8L10xSTM8L15x/STM8L16x
Channels
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
Medium+/High
density STM8L15x/
High density
STM8L16x
SEG26
SEG27
SEG28
SEG29
SEG30
SEG31
SEG32
SEG33
SEG34
SEG35
SEG36
SEG37
SEG38
SEG39
SEG40
SEG41
SEG42
SEG43
PE6PE6
PE7PE7
PG0
PG1
PG2
PG3
PG4
PG5
PG6
PG7
PH0
PH1
PH2
PH3
PF4
PF5
PF6
PF7
1. LCD COMx and SEGx not available in the STM8L10x devices.
Doc ID 16993 Rev 345/63
Block-by-block compatibility analysisAN3139
3.8 Communication peripherals
3.8.1 SPI
This peripheral is available in all STM8L sub-families. The differences are the supported
features:
●DMA capability not supported in the STM8L10x sub-family
●Hardware CRC feature for reliable communication not supported in the STM8L10x sub-
family.
When migrating from the STM8L10x sub-family to the STM8L15x sub-family, you have to
add the additional peripheral of the same type as first parameter in every function used from
the firmware library. You also have to add the CRC polynomial parameter in the SPI_Init()
function. A full compatibility, in terms of function parameter names, is guaranteed for all
common features.
Additional peripheral instances are available in the high/medium+ density
STM8L15x/STM8L16x devices (refer to Section 4.2: SPI on page 59).
3.8.2 I2C
This peripheral is available in all STM8L sub-families.
Note:If true open drain lines are required, make sure that the default mapping is kept for SDA &
SCL functions as these functions are generally mapped to pins with true open drain
capabilities (which is not the case when SDA & SCL are remapped to other pins).
The differences are in the supported features:
●DMA capability not supported in the STM8L10x sub-family
●SMBUS 2.0/ PMBus not supported in the STM8L10x sub-family.
●Dual addressing mode not supported in the STM8L10x sub-family
When migrating from the STM8L10x sub-family to the STM8L15x sub-family, you have to
add the additional peripheral of the same type as first parameter in every function used from
the firmware library. For the common features, a full compatibility, in terms of function
parameter names, is guaranteed.
Note:I/Os with true open drain capabilities are available for I2C in all STM8L sub-families.
3.8.3 USART
This peripheral is present in the whole STM8L family. The differences lie in the supported
features. The following table gives an overview of the supported features for each family.
When migrating from the STM8L10x sub-family to the STM8L15x/STMP8L16x sub-family,
you have to add the additional peripheral of the same type as first parameter in every
function used from the firmware library. For the common features, a full compatibility, in
terms of function parameter names, is guaranteed.
Additional peripheral instances are available in the high/medium+ density
STM8L15x/STM8L16x devices (refer to Section 4.4: USART on page 60).
Refer to the STM8L10x microcontroller family reference manual (RM0013), STM8L15x
microcontroller family reference manual (RM0031), STM8L101x datasheet and STM8L15x
datasheet for more detailed information.
46/63Doc ID 16993 Rev 3
AN3139Block-by-block compatibility analysis
Table 16.USART special features
USART features
Asynchronous modexx
Hardware Flow Control
Multibuffer communication (DMA)x
Multiprocessor communicationxx
Synchronousxx
Smartcard
Half-duplex (single-wire mode)
IrDA
3.9 Clock controller
The clock controller in the STM8L15x sub-family is a superset of the clock controller used in
the STM8L10x sub-family:
●The common features are:
–HSI/8 is the default system clock after startup
–CCO feature, with more options for the STM8L15x sub-family
–HSI and LSI features (low power, low cost but not accurate)
–Peripheral clocks are disabled after reset. The user should enable a peripheral
clock before using it.
●The additional features in the STM8L15x/STM8L16x sub-family are:
1.System clock switching: the clock switching feature provides an easy to use, fast and
secure way for the application to switch from one system clock source to another: HSE,
HSI, LSE and LSI (with configurable divider). The only system clock available in the
STM8L10x sub-family is the HSI (with configurable divider).
2. The clock security system (CSS): if the HSE clock fails due to a broken or disconnected
resonator or any other reason, the clock controller activates a stall-safe recovery
mechanism by automatically switching to the HSI with the same division factor as that
used before the HSE clock failure.
3. More HSE and LSE oscillators (higher cost but better accuracy)
4. More clock settings for new peripherals (LCD, RTC, DAC, DMA...)
5. The Clock Security System (CSS) to monitor LSE crystal clock source failures when
the LSE is used as RTC clock. This feature is implemented on low, medium+ and high
density devices.
STM8L10x
sub-family
STM8L15x/STM8L16x
sub-family
x
x
x
The following table gives an overview of clocks and oscillators supported in the STM8L
family.
Doc ID 16993 Rev 347/63
Block-by-block compatibility analysisAN3139
Table 17.Overview of the clocks in the STM8L family
In the whole STM8L family, the low-speed internal clock (LSI) is an ultralow internal power
source (a few µA), that can be permanently enabled to be used as the clock source for the
application during the Active-halt mode. It is not accurate (error of a few 10%), but it can be
periodically measured using the precise HSI clock to compensate for chip manufacturing
variations or for the drift due to temperature changes for instance.
3.9.2 HSI clock frequency
In the whole STM8L family, the HSI internal oscillator is factory calibrated in intervals of
+/-2% of the temperature range “5 to 25°C”. This value can be trimmed by the user within an
interval of +3/-4% of the range in eight steps using three trimming register bits. This enables
calibration in steps of about 1% of the range.
3.10 BEEP
In the STM8L15x/STM8L16x sub-family, the BEEP clock sources can be either the LSE or
LSI clocks. However this feature is not available in the STM8L10x sub-family and the BEEP
operates by default using the LSI clock source.
3.11 RTC
The RTC is available only in the STM8L15x/STM8L16x sub-family, with some additional
features in the low, medium+ and high density STM8L15x/STM8L16x devices. Please refer
to the AN3133 application note (“Using the STM8L15x/STM8L16x real time clock”).
48/63Doc ID 16993 Rev 3
AN3139Block-by-block compatibility analysis
3.12 DMA
The STM8L15x/STM8L16x sub-family is equipped with one DMA with 4 channels. The
following table presents all peripheral DMA requests present in the sub-family.
Table 18.Overview of STM8L family DMA requests
STM8L15x/STM8L16x
(1)
DMA1
Channels
Channel 0
Channel 1
Low density
STM8L15x
ADC
I2C_Rx
TIM2_CC1
TIM3_U
TIM4_U
ADC
DAC_CH2TRIG
SPI1_Rx
USART_Tx
TIM2_U
TIM3_CC1
TIM4_U
Medium density STM8L15x
ADC
I2C_Rx
TIM1_CC3
TIM2_CC1
TIM3_U
TIM4_U
ADC
DAC_CH2TRIG
SPI1_Rx
USART_Tx
TIM1_CC4
TIM2_U
TIM3_CC1
TIM4_U
Medium+/High density
STM8L15x/ High density
STM8L16x
ADC
I2C_Rx
TIM1_CC3
TIM2_CC1
TIM3_U
TIM4_U
AES_IN
USART2_Tx
SPI2_Rx
TIM5_U
ADC
SPI1_Rx
DAC_CH2TRIG
USART_Tx
TIM1_CC4
TIM2_U
TIM
TIM2_CC1
TIM4_U
USART3_Tx
Doc ID 16993 Rev 349/63
Block-by-block compatibility analysisAN3139
Table 18.Overview of STM8L family DMA requests
STM8L15x/STM8L16x
(1)
(continued)
Channels
Channel 2
DMA1
Channel 3
1. No DMA channel available in STM8L10x devices.
Low density
STM8L15x
ADC
SPI1_Tx
USART_Rx
TIM3_CC2
TIM4_U
ADC
I2C_Tx
DAC_CH1TRIG
TIM2_CC2
TIM4_U
Medium density STM8L15x
ADC
SPI1_Tx
USART_Rx
TIM1_U
TIM1_CC1
TIM1_COM
TIM3_CC2
TIM4_U
ADC
I2C_Tx
DAC_CH1TRIG
TIM1_CC2
TIM2_CC2
TIM4_U
Medium+/High density
STM8L15x/ High density
STM8L16x
ADC
SPI1_Tx
USART_Rx
TIM1_U
TIM1_CC1
TIM1_COM
TIM3_CC2
TIM4_U
TIM5_CC1
USART3_Rx
ADC
AES_OUT
I2C_Tx
DAC_CH1TRIG
TIM1_CC2
TIM2_CC2
TIM4_U
USART2_Rx
SPI2_Tx
TIM5_CC2
50/63Doc ID 16993 Rev 3
AN3139Block-by-block compatibility analysis
3.13 Memory
3.13.1 Flash program memory
The Flash program memory organization differs slightly in each sub-family.
The memory is organized in pages:
●STM8L15x/STM8L16x sub-family:
–In low density STM8L15x devices, the Flash memory is organized in up to 128
pages of 64 bytes each. Each page is equal to a block of 64 bytes.
–In medium density STM8L15x devices, the Flash memory is organized in up to
256 pages of 128 bytes each. Each page is equal to a block of 128 bytes.
–In medium+ density STM8L15x devices, the Flash memory is organized in up to
128 pages of 256 bytes each. Each page is equal to two blocks of 128 bytes.
–In high density STM8L15x and high density STM8L16x devices, the Flash memory
is organized in up to 256 pages of 256 bytes each. Each page is equal to two
blocks of 128 bytes.
A block is the maximum amount of memory that can be programmed in a single
programming cycle.
●STM8L10x sub-family
–In low density STM8L10x devices, the Flash memory is organized in up to 128
pages of 64 bytes. A page consists of a single block of 64 bytes.
Table 19.Overview of the STM8L family Flash interface
STM8L10xSTM8L15x/STM8L16x
Flash
features
InterfaceCommon read/write/protection interface
Size rangeUp to 8 KbytesUp to 8 KbytesUp to 32 KbytesUp to 32 Kbytes
Not supportedNot supportedSupported Supported Supported
Low density
STM8L15x
0x1000 - 0x10FF
0x8000 - 0x9FFF
Up to 64 option
bytes
From 3 pages up
to 127pages
Medium density
STM8L15x
0x1000 - 0x13FF
0x8000 - 0xFFFF
Up to 128 option
bytes
From 2 pages up
to 255pages
Medium+
density
STM8L15x
0x1000 - 0x13FF
0x8000 - 0xFFFF
Up to 128 option
bytes
From 2 pages up
to 255pages
High density
STM8L15x/
STM8L16x
From 32 Kbytes to
64 Kbytes
0x1000 - 0x17FF
0x8000 - 0x17FFF
Up to 128 option bytes
From 2 pages up to
510 pages
Doc ID 16993 Rev 351/63
Block-by-block compatibility analysisAN3139
Table 19.Overview of the STM8L family Flash interface (continued)
STM8L10xSTM8L15x/STM8L16x
Flash
features
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
Medium+
density
STM8L15x
High density
STM8L15x/
STM8L16x
Low power
wait mode
Low power
run mode
Not supportedSupported Supported Supported Supported
Not supportedSupported Supported Supported Supported
3.13.2 Data EEPROM memory
The data EEPROM memory organization differs slightly in each sub-family. The data
EEPROM is organized in pages:
●STM8L15x/STM8L16x sub-family:
–In low density STM8L15x devices, the data EEPROM is organized in up to 4
pages of 64 bytes each.
–In medium density STM8L15x devices, the data EEPROM is organized in up to 8
pages of 128 bytes each.
–In medium+ density STM8L15x devices, the data EEPROM is organized in up to 4
pages of 256 bytes each.
–In high density STM8L15x and high density STM8L16x devices, the data
EEPROM is organized to 8 pages of 256 bytes each.
●STM8L10x sub-family
–In low density STM8L10x devices, the data EEPROM is organized in up to 32
pages of 64 bytes.
The start address of the data EEPROM is configured through the DATASIZE option byte in
the STM8L10x sub-family.
The start address of the data EEPROM is always 0x1000 in all the STM8L10x and
STM8L15x/STM8L16x sub-families.
Refer to the STM8L datasheets for more details.
3.13.3 Boot ROM memory
The Boot ROM memory containing the bootloader code is present in the devices for the
STM8L15x/STM8L16x sub-family. It is not present in the STM8L10x sub-family. The Boot
ROM size is 2 Kbytes and its start address is always 0x6000.
3.13.4 RAM memory
The RAM memory always starts from address 0. The first 256 bytes make up the zero page.
52/63Doc ID 16993 Rev 3
AN3139Block-by-block compatibility analysis
3.13.5 Stack
The space for the stack is always located at the end of the RAM memory. So its position in
the address space varies depending on the RAM memory size. The stack pointer value is
initialized to the upper address at reset and it is decremented each time a byte is pushed
onto the stack. The stack size is 513 bytes in all STM8L devices.
3.14 Interrupt mapping
The interrupt vector mapping is compatible for STM8L10x and STM8L15x/STM8L16x subfamilies except:
●The new added vectors to support the new peripherals in the STM8L15x/STM8L16x
devices
●The TIM1, TIM5, SPI1, SPI2, DAC, SPI2, USART2, USART3 and AES interrupts which
are not supported in the STM8L10x sub-family.
●The timer 4 trigger interrupt which is not supported in the STM8L10x sub-family.
●The auto-wakeup interrupt in the STM8L10x sub-family that is replaced by the RTC
interrupt in the STM8L15x/STM8L16x sub-family.
The following table lists these differences between all sub-families.
Table 20.STM8L interrupt vector differences
STM8L10xSTM8L15x/STM8L16x
N
2
3
4AWU interrupt RTCRTCRTC
5
6
7
.
.
.
16
17
18
Low density
STM8L10x
.
.
.
Low density
STM8L15x
DMA1_CHANNEL0_1DMA1_CHANNEL0_1DMA1_CHANNEL0_1
DMA1_CHANNEL2_3DMA1_CHANNEL2_3DMA1_CHANNEL2_3
External interrupt port E?
PVD interrupt
.
.
.
System clock switch/?
CSS interrupt
ADC1ADC1ADC1
Medium density
STM8L15x
EXTI port E/F PVDEXTI port E/F PVD
External interrupt port GExternal interrupt port G
External interrupt port HExternal interrupt port H
Table 21.Overview of the STM8L family interrupt vectors (continued)
STM8L10xSTM8L15x/STM8L16x
N
28USART1 Rx interruptUSART1 Rx interrupt
29I2C1 interruptI2C1 interruptI2C1 interrupt
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
USART1 Rx interrupt
TIM5 capture/compare
3.15 Option bytes
The basic structure of the option byte area is compatible across the family. There are some
differences detailed in the following table:
1.OPT4 and OPT5 (number of stabilization clock cycles for HSE and LSE oscillators and
brownout reset respectively) are available only in the STM8L15x/STM8L16x sub-family
and can be modified on the fly by the application in IAP mode.
2. The OPTBL option byte is available only for the STM8L15x/STM8L16x sub-family.
3. The independent watchdog option is the OPT4 in the STM8L10x and OPT3 in the
STM8L15x/STM8L16x sub-family.
4. The user boot code size is the OPT2 in the STM8L10x and OPT1 in the
STM8L15x/STM8L16x sub-family.
5. The DATASIZE option byte is available only for the STM8L10x sub-family.
Peripheral pinout through all STM8L sub-familiesAN3139
4 Peripheral pinout through all STM8L sub-families
4.1 Timer pinout
The following table describes the timer pinout for both STM8L sub-families.
Table 23.Timer pinout
TIM
pinout
TIM1
pinout
TIM2
pinout
STM8L10x
STM8L15x/
STM8L16x
STM8L10x
STM8L15x/
STM8L16x
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
Medium+/high
density STM8L15x/
high density
STM8L16x
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
Medium+/high
density STM8L15x/
high density
STM8L16x
Channels
CH1 CH1N CH2 CH2N CH3 CH3N ETR BKIN
Reset
Remap
Reset
Remap
Reset PD2 PD7PD4 PE1PD5 PE2PD3 PD6
Remap
Reset PD2 PD7PD4 PE1PD5 PE2PD3 PD6
Remap
Reset PB0
Remap
Reset PB0PB2PB3 PA4
Remap
Reset PB0
Remap
Reset PB0PB2PB3 PA4
Remap
PB2PB3 PA4
PA 4
PB2PB3 PA4
PA 4
PA 4 PG 0
STM8L10x
TIM3
pinout
58/63Doc ID 16993 Rev 3
STM8L15x/
STM8L16x
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
Medium+/high
density STM8L15x/
high density
STM8L16x
Reset PB1PD0PD1 PA5
Remap
Reset PB1PD0PD1 PA5
Remap
Reset PB1
Remap
Reset PB1
Remap PI0PI3
PA 5
PD0PD1 PA5
PA 5
PD0PD1 PA5
PA 5
PG1
PG3
AN3139Peripheral pinout through all STM8L sub-families
Table 23.Timer pinout
TIM
pinout
STM8L10x
TIM5
pinout
STM8L15x/
STM8L16x
4.2 SPI
The following table describes the SPI pinout for both STM8L families.
Table 24.SPI pinout
Channels
CH1 CH1N CH2 CH2N CH3 CH3N ETR BKIN
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
Medium+/high
density STM8L15x/
high density
STM8L16x
STM8L10xSTM8L15x/STM8L16x
Reset
Remap
Reset
Remap
Reset
Remap
Reset PH6PH7PE7 PE6
Remap
SPI1 pinout
SPI2 pinout
Channels
NSSPB4
SCKPB5
MOSIPB6
MISOPB7
NSS
SCK
MOSI
MISO
Low density
STM8L10x
ResetRemapResetRemapResetRemapResetRemap
Low density
STM8L15x
PB4PC5PB4PC5PB4
PB5PC6PB5PC6PB5
PB6PA3PB6PA3PB6
PB7PA2PB7PA2PB7
Medium density
STM8L15x
Medium+/
High density
STM8L15x/ High
density STM8L16x
PC5
PF0
PC6
PF1
PA 3
PF2
PA 2
PF3
PG4PI0
PG5PI1
PG6PI2
PG7PI3
Doc ID 16993 Rev 359/63
Peripheral pinout through all STM8L sub-familiesAN3139
4.3 I2C
The following table describes the I2C pinout for both STM8L sub-families.
Table 25.I2C pinout
I2C1
STM8L10xSTM8L15x/STM8L16x
Channels
SCLPC1
SDAPC0PC0PC0PC0
SMBALPC4PC4PC4
4.4 USART
The following table describes the USART pinout for both STM8L sub-families.
Table 26.USART pinout
USART pinout Channels
Low density
STM8L10x
ResetRemap Reset RemapResetRemapResetRemap
STM8L10xSTM8L15x/STM8L16x
Low density
STM8L10x
DefaultRemapDefaultRemapDefaultRemapDefaultRemap
Low density
STM8L15x
PC1PC1PC1
Low density
STM8L15x
Medium density
STM8L15x
Medium density
STM8L15x
Medium+/high density
STM8L15x/
high density STM8L16x
Medium+/high
density STM8L15x/
high density
STM8L16x
TXPC3
USART1 pinout
USART2 pinout
60/63Doc ID 16993 Rev 3
RXPC2
CKPC4
TX
RXPH4
CKPH6
PC3
PC2
PC4PA0PC4PA0
PA 2
PC5
PA 3
PC6
PC3
PC2
PH5
PA 2
PC5
PA 3
PC6
AN3139Peripheral pinout through all STM8L sub-families
Table 26.USART pinout
STM8L10xSTM8L15x/STM8L16x
Medium+/high
USART pinout Channels
Low density
STM8L10x
DefaultRemapDefaultRemapDefaultRemapDefaultRemap
Low density
STM8L15x
Medium density
STM8L15x
density STM8L15x/
high density
STM8L16x
TX
USART3 pinout
RX
CK
4.5 DAC
The following table describes the DAC pinout for the STM8L15x/STM8L16x sub-family.
Table 27.DAC pinout
Channels
DAC_OUT1PF0PF0PF0
DAC_OUT2PF1
STM8L10xSTM8L15x/STM8L16x
Low density
STM8L10x
Low density
STM8L15x
Medium density
STM8L15x
PG1PF0
PG0PF1
PG3PF2
Medium+/
High density
STM8L15x/ High
density STM8L16x
Doc ID 16993 Rev 361/63
Revision historyAN3139
5 Revision history
Table 28.Document revision history
DateRevisionChanges
07-Jun-20101Initial release
05-Aug-20112Document modified to add new STM8L15x devices.
08-Sep-20113Updated document classification.
62/63Doc ID 16993 Rev 3
AN3139
Please Read Carefully:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the
right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any
time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no
liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this
document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products
or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such
third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS EXPRESSLY APPROVED IN WRITING BY TWO AUTHORIZED ST REPRESENTATIVES, ST PRODUCTS ARE NOT
RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING
APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY,
DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE
GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void
any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any
liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.