Value Line, 8-bit ultralow power MCU, 32-KB Flash,
256-byte data EEPROM, RTC, LCD, timers, USART, I2C, SPI, ADC
Datasheet − production data
Features
■ Operating conditions
– Operating power supply: 1.8 V to 3.6 V
– Temperature range: -40 °C to 85 °C
■ Low power features
– 5 low power modes: Wait, Low power run
(5.1 µA), Low power wait (3 µA), Active-halt
with full RTC (1.3 µA), Halt (350 nA)
– Consumption: 195 µA/MHz + 440 µA
– Ultra-low leakage per I/0: 50 nA
– Fast wakeup from Halt: 4.7 µs
■ Advanced STM8 core
– Harvard architecture and 3-stage pipeline
– Max freq. 16 MHz, 16 CISC MIPS peak
– Up to 40 external interrupt sources
■ Reset and supply management
– Low power, ultra-safe BOR reset with 5
selectable thresholds
– Ultra low power POR/PDR
– Programmable voltage detector (PVD)
■ Clock management
– 32 kHz and 1 to 16 MHz crystal oscillator
– Internal 16 MHz factory-trimmed RC
– Internal 38 kHz low consumption RC
– Clock security system
■ Low power RTC
– BCD calendar with alarm interrupt
– Auto-wakeup from Halt w/ periodic interrupt
■ LCD: up to 4x28 segments w/ step-up
converter
■ Memories
– 32 KB Flash program memory and
256 bytes data EEPROM with ECC, RWW
– Flexible write and read protection modes
– 2 Kbytes of RAM
■ DMA
– 4 channels supporting ADC, SPI, I2C,
USART, timers
– 1 channel for memory-to-memory
■ 12-bit ADC up to 1 Msps/25 channels
– Internal reference voltage
■ Timers
– Two 16-bit timers with 2 channels (used as
IC, OC, PWM), quadrature encoder
– One 16-bit advanced control timer with 3
channels, supporting motor control
– One 8-bit timer with 7-bit prescaler
– 2 watchdogs: 1 Window, 1 Independent
– Beeper timer with 1, 2 or 4 kHz frequencies
■ Communication interfaces
– Synchronous serial interface (SPI)
2
–Fast I
C 400 kHz SMBus and PMBus
– USART (ISO 7816 interface and IrDA)
■ Up to 41 I/Os, all mappable on interrupt vectors
■ Development support
– Fast on-chip programming and non-
intrusive debugging with SWIM
– Bootloader using USART
June 2012Doc ID 023331 Rev 11/102
This is information on a product in full production.
This document describes the features, pinout, mechanical data and ordering information of
the medium density value line STM8L052C6 microcontroller with 32-Kbyte Flash memory
density. For further details on the whole STMicroelectronics medium density family please
refer to Section 2.2: Ultra low power continuum.
For detailed information on device operation and registers, refer to the reference manual
(RM0031).
For information on to the Flash program memory and data EEPROM, refer to the
programming manual (PM0054).
For information on the debug module and SWIM (single wire interface module), refer to the
STM8 SWIM communication protocol and debug module user manual (UM0470).
For information on the STM8 core, refer to the STM8 CPU programming manual (PM0044).
Medium density value line devices provide the following benefits:
●Integrated system
–32 Kbytes of medium density embedded Flash program memory
–256 bytes of data EEPROM
–2 Kbytes of RAM
–Internal high speed and low-power low speed RC
–Embedded reset
●Ultra low power consumption
–195 µA/MHZ + 440 µA (consumption)
–0.9 µA with LSI in Active-halt mode
–Clock gated system and optimized power management
–Capability to execute from RAM for Low power wait mode and low power run mode
●Advanced features
–Up to 16 MIPS at 16 MHz CPU clock frequency
–Direct memory access (DMA) for memory-to-memory or peripheral-to-memory
access
●Short development cycles
–Application scalability across a common family product architecture with
compatible pinout, memory map and modular peripherals
–Wide choice of development tools
Refer to Table 1: Medium density value line STM8L05xxx low power device features and
peripheral counts and Section 3: Functional overview for an overview of the complete range
of peripherals proposed in this family.
Figure 1 shows the block diagram of the medium density value line STM8L05xxx family.
8/102Doc ID 023331 Rev 1
STM8L052C6Description
2 Description
The medium density value line STM8L05xxx devices are members of the STM8L ultra low
power 8-bit family.
The value line STM8L05xxx ultra low power family features the enhanced STM8 CPU core
providing increased processing power (up to 16 MIPS at 16 MHz) while maintaining the
advantages of a CISC architecture with improved code density, a 24-bit linear addressing
space and an optimized architecture for low power operations.
The family includes an integrated debug module with a hardware interface (SWIM) which
allows non-intrusive In-application debugging and ultra-fast Flash programming.
Medium density value line STM8L05xxx microcontrollers feature embedded data EEPROM
and low-power, low-voltage, single-supply program Flash memory.
All devices offer 12-bit ADC, real-time clock, 16-bit timers, one 8-bit timer as well as
standard communication interface such as SPI, I2C, USART and 4x28-segment LCD. The
4x 28-segment LCD is available on the medium density value line STM8L05xxx.
The STM8L05xxx family operates from 1.8 V to 3.6 V and is available in the
temperature range.
The modular design of the peripheral set allows the same peripherals to be found in different
ST microcontroller families including 32-bit families. This makes any transition to a different
family very easy, and simplified even more by the use of a common set of development
tools.
All value line STM8L ultra low power products are based on the same architecture with the
same memory mapping and a coherent pinout.
-40 to +85 °C
Doc ID 023331 Rev 19/102
DescriptionSTM8L052C6
2.1 Device overview
Table 1.Medium density value line STM8L05xxx low power device features and
peripheral counts
FeaturesSTM8L052C6
Flash (Kbytes)32
Data EEPROM (bytes)256
RAM (Kbytes)2
LCD4x28
Basic
1
(8-bit)
Timers
General purpose
Advanced control
2
(16-bit)
1
(16-bit)
SPI1
Communication
interfaces
I2C1
USART1
GPIOs41
12-bit synchronized ADC
(number of channels)
(1)
1
(25)
RTC, window watchdog, independent watchdog,
Others
16-MHz and 38-kHz internal RC,
1- to 16-MHz and 32-kHz external oscillator
CPU frequency16 MHz
Operating voltage1.8 V to 3.6 V
Operating temperature-40 to +85 °C
PackageLQFP48
1. The number of GPIOs given in this table includes the NRST/PA1 pin but the application can use the
NRST/PA1 pin as general purpose output only (PA1).
10/102Doc ID 023331 Rev 1
STM8L052C6Description
2.2 Ultra low power continuum
The ultra low power value line STM8L05xxx and STM8L15xxx are fully pin-to-pin, software
and feature compatible. Besides the full compatibility within the STM8L family, the devices
are part of STMicroelectronics microcontrollers ultra low power strategy which also includes
STM8L101xx and STM32L15xxx. The STM8L and STM32L families allow a continuum of
performance, peripherals, system architecture, and features.
They are all based on STMicroelectronics 0.13 µm ultra-low leakage process.
Note:1The STM8L05xxx is pin-to-pin compatible with STM8L101xx devices.
2The STM32L family is pin-to-pin compatible with the general purpose STM32F family.
Please refer to STM32L15x documentation for more information on these devices.
Performance
All families incorporate highly energy-efficient cores with both Harvard architecture and
pipelined execution: advanced STM8 core for STM8L families and ARM Cortex™-M3 core
for STM32L family. In addition specific care for the design architecture has been taken to
optimize the mA/DMIPS and mA/MHz ratios.
This allows the ultra low power performance to range from 5 up to 33.3 DMIPs.
Shared peripherals
STM8L05x, STM8L15x and STM32L15xx share identical peripherals which ensure a very
easy migration from one family to another:
●Analog peripheral: ADC1
●Digital peripherals: RTC and some communication interfaces
Common system strategy
To offer flexibility and optimize performance, the STM8L and STM32L devices use a
common architecture:
●Same power supply range from 1.8 to 3.6 V
●Architecture optimized to reach ultra-low consumption both in low power modes and
Run mode
●Fast startup strategy from low power modes
●Flexible system clock
●Ultra-safe reset: same reset strategy for both STM8L and STM32L including power-on
reset, power-down reset, brownout reset and programmable voltage detector
Features
ST ultra low power continuum also lies in feature compatibility:
●More than 10 packages with pin count from 20 to 100 pins and size down to 3 x 3 mm
●Memory density ranging from 4 to 128 Kbytes
Doc ID 023331 Rev 111/102
Functional overviewSTM8L052C6
16 MHz internal RC
Clock
Clocks
Address, control and data buses
Debug module
SPI1
32 Kbytes
Interrupt controller
2 Kbytes RAM
to core and
peripherals
IWDG
(38 kHz clock)
(SWIM)
Port A
Port B
Port C
I²C1
USART1
Power
VOLT. REG.
Port F
1-16 MHz oscillator
32 kHz oscillator
38 kHz internal RC
LCD driver
4x28
WWDG
STM8 Core
controller
and
CSS
256 bytes
Port D
Port E
Beeper
RTC
memoryprogram
data EEPROM
@V
DD
V
DD18
V
DD1
=1.8 V
V
SS1
SWIM
SCL, SDA,
MOSI, MISO,
SCK, NSS
RX, TX, CK
ADC1_INx
V
DDA
V
SSA
SMB
@V
DDA/VSSA
12-bit ADC1
V
REF+
V
REF-
3.6 V
NRST
PA[7:0]
PB[7:0]
PC[7:0]
PD[7:0]
PE[7:0]
PF0
BEEP
ALARM, CALIB
SEGx, COMx
POR/PDR
OSC_IN,
OSC_OUT
OSC32_IN,
OSC32_OUT
to
BOR
PVD
PVD_IN
RESET
DMA1
8-bit Timer 4
16-bit Timer 3
16-bit Timer 2
16-bit Timer 1
(4 channels)
2 channels
2 channels
3 channels
V
LCD
= 2.5 V
3.6 V
to
LCD booster
Internal reference
voltage
VREFINT out
Infrared interface
IR_TIM
3 Functional overview
Figure 1.Medium density value line STM8L05xxx device block diagram
1. Legend:
12/102Doc ID 023331 Rev 1
ADC: Analog-to-digital converter
BOR: Brownout reset
DMA: Direct memory access
I²C: Inter-integrated circuit multimaster interface
LCD: Liquid crystal display
POR/PDR: Power on reset / power down reset
RTC: Real-time clock
SPI: Serial peripheral interface
SWIM: Single wire interface module
USART: Universal synchronous asynchronous receiver transmitter
WWDG: Window watchdog
IWDG: independent watchdog
STM8L052C6Functional overview
3.1 Low power modes
The medium density value line STM8L05xxx devices support five low power modes to
achieve the best compromise between low power consumption, short startup time and
available wakeup sources:
●Wait mode: The CPU clock is stopped, but selected peripherals keep running. An
internal or external interrupt, event or a Reset can be used to exit the microcontroller
from Wait mode (WFE or WFI mode).
●Low power run mode: The CPU and the selected peripherals are running. Execution
is done from RAM with a low speed oscillator (LSI or LSE). Flash memory and data
EEPROM are stopped and the voltage regulator is configured in ultra low power mode.
The microcontroller enters Low power run mode by software and can exit from this
mode by software or by a reset.
All interrupts must be masked. They cannot be used to exit the microcontroller from this
mode.
●Low power wait mode: This mode is entered when executing a Wait for event in Low
power run mode. It is similar to Low power run mode except that the CPU clock is
stopped. The wakeup from this mode is triggered by a Reset or by an internal or
external event (peripheral event generated by the timers, serial interfaces, DMA
controller (DMA1) and I/O ports). When the wakeup is triggered by an event, the
system goes back to Low power run mode.
All interrupts must be masked. They cannot be used to exit the microcontroller from this
mode.
●Active-halt mode: CPU and peripheral clocks are stopped, except RTC. The wakeup
can be triggered by RTC interrupts, external interrupts or reset.
●Halt mode: CPU and peripheral clocks are stopped, the device remains powered on.
The RAM content is preserved. The wakeup is triggered by an external interrupt or
reset. A few peripherals have also a wakeup from Halt capability. Switching off the
internal reference voltage reduces power consumption. Through software configuration
it is also possible to wake up the device without waiting for the internal reference
voltage wakeup time to have a fast wakeup time of 5 µs.
Doc ID 023331 Rev 113/102
Functional overviewSTM8L052C6
3.2 Central processing unit STM8
3.2.1 Advanced STM8 Core
The 8-bit STM8 core is designed for code efficiency and performance with an Harvard
architecture and a 3-stage pipeline.
It contains 6 internal registers which are directly addressable in each execution context, 20
addressing modes including indexed indirect and relative addressing, and 80 instructions.
Architecture and registers
●Harvard architecture
●3-stage pipeline
●32-bit wide program memory bus - single cycle fetching most instructions
●X and Y 16-bit index registers - enabling indexed addressing modes with or without
offset and read-modify-write type data manipulations
●8-bit accumulator
●24-bit program counter - 16-Mbyte linear memory space
●16-bit stack pointer - access to a 64-Kbyte level stack
●8-bit condition code register - 7 condition flags for the result of the last instruction
Addressing
●20 addressing modes
●Indexed indirect addressing mode for lookup tables located anywhere in the address
space
●Stack pointer relative addressing mode for local variables and parameter passing
Instruction set
●80 instructions with 2-byte average instruction size
●Standard data movement and logic/arithmetic functions
●8-bit by 8-bit multiplication
●16-bit by 8-bit and 16-bit by 16-bit division
●Bit manipulation
●Data transfer between stack and accumulator (push/pop) with direct stack access
●Data transfer using the X and Y registers or direct memory-to-memory transfers
3.2.2 Interrupt controller
The medium density value line STM8L05xxx devices feature a nested vectored interrupt
controller:
●Nested interrupts with 3 software priority levels
●32 interrupt vectors with hardware priority
●Up to 40 external interrupt sources on 11 vectors
●Trap and reset interrupts
14/102Doc ID 023331 Rev 1
STM8L052C6Functional overview
3.3 Reset and supply management
3.3.1 Power supply scheme
The device requires a 1.8 V to 3.6 V operating supply voltage (VDD). The external power
supply pins must be connected as follows:
●V
●V
●V
●V
3.3.2 Power supply supervisor
The device has an integrated ZEROPOWER power-on reset (POR)/power-down reset
(PDR), coupled with a brownout reset (BOR) circuitry . At power-on, BOR is always active,
and ensures proper operation starting from 1.8 V. After the 1.8 V BOR threshold is reached,
the option byte loading process starts, either to confirm or modify default thresholds, or to
disable BOR permanently.
SS1
; V
= 1.8 to 3.6 V: external power supply for I/Os and for the internal regulator.
DD1
Provided externally through V
SSA ; VDDA
V
SSA
SS2
connected to V
REF+
externally through V
= 1.8 to 3.6 V: external power supplies for analog peripherals. V
must be connected to V
; V
= 1.8 to 3.6 V: external power supplies for I/Os. V
; V
DD2
REF-
and V
DD1
SS1
(for ADC1): external reference voltage for ADC1. Must be provided
and V
REF+
pins, the corresponding ground pin is V
DD1
DD1
and V
, respectively.
SS1
DD2
, respectively.
pin.
REF-
and V
SS1
must be
SS2
.
DDA
and
Five BOR thresholds are available through option bytes, starting from 1.8 V to 3 V. To
reduce the power consumption in Halt mode, it is possible to automatically switch off the
internal reference voltage (and consequently the BOR) in Halt mode. The device remains
under reset when V
DD
for any external reset circuit.
The device features an embedded programmable voltage detector (PVD) that monitors the
V
DD/VDDA
power supply and compares it to the V
levels between 1.85 V and 3.05 V, chosen by software, with a step around 200 mV. An
interrupt can be generated when V
V
DD/VDDA
is higher than the V
a warning message and/or put the MCU into a safe state. The PVD is enabled by software.
3.3.3 Voltage regulator
The medium density value line STM8L05xxx 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) for Run, Wait for interrupt (WFI) and Wait for event
(WFE) modes
●Low power voltage regulator mode (LPVR) for Halt, Active-halt, Low power run and Low
power wait modes
When entering Halt or Active-halt modes, the system automatically switches from the MVR
to the LPVR in order to reduce current consumption.
is below a specified threshold, V
threshold. This PVD offers 7 different
PVD
DD/VDDA
threshold. The interrupt service routine can then generate
PVD
drops below the V
POR/PDR
PVD
or V
, without the need
BOR
threshold and/or when
Doc ID 023331 Rev 115/102
Functional overviewSTM8L052C6
3.4 Clock management
The clock controller distributes the system clock (SYSCLK) coming from different oscillators
to the core and the peripherals. It also manages clock gating for low power modes and
ensures clock robustness.
Features
●Clock prescaler: To get the best compromise between speed and current
consumption the clock frequency to the CPU and peripherals can be adjusted by a
programmable prescaler.
●Safe clock switching: Clock sources can be changed safely on the fly in run mode
through a configuration register.
●Clock management: To reduce power consumption, the clock controller can stop the
clock to the core, individual peripherals or memory.
●System clock sources: 4 different clock sources can be used to drive the system
clock:
–1-16 MHz High speed external crystal (HSE)
–16 MHz High speed internal RC oscillator (HSI)
–32.768 kHz Low speed external crystal (LSE)
–38 kHz Low speed internal RC (LSI)
●RTC and LCD clock sources: The above four sources can be chosen to clock the
RTC and the LCD, whatever the system clock.
●Startup clock: After reset, the microcontroller restarts by default with an internal
2 MHz clock (HSI/8). The prescaler ratio and clock source can be changed by the
application program as soon as the code execution starts.
●Clock security system (CSS): This feature can be enabled by software. If a HSE clock
failure occurs, the system clock is automatically switched to HSI.
●Configurable main clock output (CCO): This outputs an external clock for use by the
application.
16/102Doc ID 023331 Rev 1
STM8L052C6Functional overview
HSE OSC
1-16 MHz
HSI RC
16 MHz
LSI RC
38 kH z
LSE OSC
32 768 k
H
z
HSI
LSI
RTC
prescaler
/1;2;4;8;16;32;64
PCLK
to peripherals
RTCCLK/2
to LCD
to IWDG
SYSCLK
HSE
(1)
(2)
LSI
LSE
OSC_OUT
OSC32_OUT
OSC_IN
OSC32_IN
clock output
CCO
prescaler
/1;2;4;8;16;32;64
HSI
LSI
HSE
LSE
CCO
to core and
memory
SYSCLK
Presc aler
/1;2;4;8;16;32;64;128
IWDGCLK
RTCSEL[3:0]
LSE
(2)
CLKBEEPSEL[1:0]
to BEEP
BEEPCLK
CSS
configurable
.
/ 2
Peripheral
Clock enable (15 bits)
to RTC
RTCCLK
clock enable (1 bit)
LCDCLK
to LCD
SYSCLK
Halt
clock enable (1 bit)
LCD peripheral
RTCCLK
LCD peripheral
(1)
(2)
Figure 2.Medium density value line STM8L05xxx clock tree diagram
1. The HSE clock source can be either an external crystal/ceramic resonator or an external source (HSE
bypass). Refer to Section HSE clock in the STM8L15x and STM8L16x reference manual (RM0031).
2. The LSE clock source can be either an external crystal/ceramic resonator or a external source (LSE
bypass). Refer to Section LSE clock in the STM8L15x and STM8L16x reference manual (RM0031).
3.5 Low power real-time clock
The real-time clock (RTC) is an independent binary coded decimal (BCD) timer/counter.
Six byte locations contain the second, minute, hour (12/24 hour), week day, date, month,
year, in BCD (binary coded decimal) format. Correction for 28, 29 (leap year), 30, and 31
day months are made automatically.
It provides a programmable alarm and programmable periodic interrupts with wakeup from
Halt capability.
●Periodic wakeup time using the 32.768 kHz LSE with the lowest resolution (of 61 µs) is
from min. 122 µs to max. 3.9 s. With a different resolution, the wakeup time can reach
36 hours.
●Periodic alarms based on the calendar can also be generated from every second to
every year.
Doc ID 023331 Rev 117/102
Functional overviewSTM8L052C6
3.6 LCD (Liquid crystal display)
The LCD is only available on STM8L052xx devices.
●The liquid crystal display drives up to 4 common terminals and up to 28 segment
terminals to drive up to 112 pixels. Internal step-up converter to guarantee contrast
control whatever V
●Static 1/2, 1/3, 1/4 duty supported.
●Static 1/2, 1/3, bias supported.
●Phase inversion to reduce power consumption and EMI.
●Up to 4 pixels which can be programmed to blink.
●The LCD controller can operate in Halt mode.
DD
.
Note:Unnecessary segments and common pins can be used as general I/O pins.
3.7 Memories
The medium density value line STM8L05xxx devices have the following main features:
●2 Kbytes of RAM
●The non-volatile memory is divided into three arrays:
–32 Kbytes of medium density embedded Flash program memory
–256 bytes of data EEPROM
–Option bytes
The EEPROM embeds the error correction code (ECC) feature. It supports the read-whilewrite (RWW): it is possible to execute the code from the program matrix while
programming/erasing the data matrix.
The option byte protects part of the Flash program memory from write and readout piracy.
3.8 DMA
A 4-channel direct memory access controller (DMA1) offers a memory-to-memory and
peripherals-from/to-memory transfer capability. The 4 channels are shared between the
following IPs with DMA capability: ADC1, I2C1, SPI1, USART1and the four timers.
18/102Doc ID 023331 Rev 1
STM8L052C6Functional overview
3.9 Analog-to-digital converter
●12-bit analog-to-digital converter (ADC1) with 25 channels (including 1 fast channel)
and internal reference voltage
●Conversion time down to 1 µs with f
●Programmable resolution
●Programmable sampling time
●Single and continuous mode of conversion
●Scan capability: automatic conversion performed on a selected group of analog inputs
●Analog watchdog
●Triggered by timer
SYSCLK
= 16 MHz
Note:ADC1 can be served by DMA1.
3.10 System configuration controller and routing interface
The system configuration controller provides the capability to remap some alternate
functions on different I/O ports. TIM4 and ADC1 DMA channels can also be remapped.
The highly flexible routing interface allows application software to control the routing of
different I/Os to the TIM1 timer input captures. It also controls the routing of internal analog
signals to ADC1 and the internal reference voltage V
REFINT
.
3.11 Timers
The medium density value line STM8L05xxx devices contain one advanced control timer
(TIM1), two 16-bit general purpose timers (TIM2 and TIM3) and one 8-bit basic timer
(TIM4).
All the timers can be served by DMA1.
Ta bl e 2 compares the features of the advanced control, general-purpose and basic timers.
Table 2.Timer feature comparison
Timer
TIM1
TIM2
TIM3
TIM48-bitup
Counter
resolution
16-bitup/down
Counter
type
Prescaler factor
Any integer
from 1 to 65536
Any power of 2
from 1 to 128
Any power of 2
from 1 to 32768
DMA1
request
generation
Ye s
Capture/compare
channels
3 + 13
2
0
Complementary
outputs
None
Doc ID 023331 Rev 119/102
Functional overviewSTM8L052C6
3.11.1 TIM1 - 16-bit advanced control timer
This is a high-end timer designed for a wide range of control applications. With its
complementary outputs, dead-time control and center-aligned PWM capability, the field of
applications is extended to motor control, lighting and half-bridge driver.
●16-bit up, down and up/down autoreload counter with 16-bit prescaler
●3 independent capture/compare channels (CAPCOM) configurable as input capture,
output compare, PWM generation (edge and center aligned mode) and single pulse
mode output
●1 additional capture/compare channel which is not connected to an external I/O
●Synchronization module to control the timer with external signals
●Break input to force timer outputs into a defined state
●3 complementary outputs with adjustable dead time
●Encoder mode
●Interrupt capability on various events (capture, compare, overflow, break, trigger)
3.11.2 16-bit general purpose timers
●16-bit autoreload (AR) up/down-counter
●7-bit prescaler adjustable to fixed power of 2 ratios (1…128)
●Interrupt capability on various events (capture, compare, overflow, break, trigger)
●Synchronization with other timers or external signals (external clock, reset, trigger and
enable)
3.11.3 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 Watchdog timers
The watchdog system is based on two independent timers providing maximum security to
the applications.
3.12.1 Window watchdog timer
The window watchdog (WWDG) is used to detect the occurrence of a software fault, usually
generated by external interferences or by unexpected logical conditions, which cause the
application program to abandon its normal sequence.
3.12.2 Independent watchdog timer
The independent watchdog peripheral (IWDG) can be used to resolve processor
malfunctions due to hardware or software failures.
It is clocked by the internal LSI RC clock source, and thus stays active even in case of a
CPU clock failure.
20/102Doc ID 023331 Rev 1
STM8L052C6Functional overview
3.13 Beeper
The beeper function outputs a signal on the BEEP pin for sound generation. The signal is in
the range of 1, 2 or 4 kHz.
3.14 Communication interfaces
3.14.1 SPI
The serial peripheral interface (SPI1) provides half/ full duplex synchronous serial
communication with external devices.
●Maximum speed: 8 Mbit/s (f
●Full duplex synchronous transfers
●Simplex synchronous transfers on 2 lines with a possible bidirectional data line
●Master or slave operation - selectable by hardware or software
●Hardware CRC calculation
●Slave/master selection input pin
SYSCLK
Note:SPI1 can be served by the DMA1 Controller.
/2) both for master and slave
3.14.2 I²C
The I2C bus interface (I2C1) provides multi-master capability, and controls all I²C busspecific sequencing, protocol, arbitration and timing.
●Master, slave and multi-master capability
●Standard mode up to 100 kHz and fast speed modes up to 400 kHz
●7-bit and 10-bit addressing modes
●SMBus 2.0 and PMBus support
●Hardware CRC calculation
Note:I
2
C1 can be served by the DMA1 Controller.
3.14.3 USART
The USART interface (USART1) 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.
●1 Mbit/s full duplex SCI
●SPI1 emulation
●High precision baud rate generator
●Smartcard emulation
●IrDA SIR encoder decoder
●Single wire half duplex mode
Note:USART1 can be served by the DMA1 Controller.
Doc ID 023331 Rev 121/102
Functional overviewSTM8L052C6
3.15 Infrared (IR) interface
The medium density value line STM8L05xxx 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.16 Development support
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.
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, CPU operation can also be monitored in realtime by means of shadow registers.
Bootloader
A bootloader is available to reprogram the Flash memory using the USART1 interface. The
reference document for the bootloader is UM0560: STM8 bootloader user manual.
The bootloader is used to download application software into the device memories,
including RAM, program and data memory, using standard serial interfaces. It is a
complementary solution to programming via the SWIM debugging interface.
Table 4.Medium density value line STM8L05xxx pin description
TT3.6 V tolerant
OutputHS = high sink/source (20 mA)
Inputfloat = floating, wpu = weak pull-up
OutputT = true open drain, OD = open drain, PP = push pull
Bold X (pin state after reset release).
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).
Pin
number
LQFP48
2NRST/PA1
PA2/OSC_IN/
3
[USART1_TX]
[SPI1_MISO]
PA3/OSC_OUT/[USART1_
4
RX]
(8)
/[SPI1_MOSI]
PA4/TIM2_BKIN/
5
LCD_COM0/ADC1_IN2
PA5/TIM3_BKIN/
6
LCD_COM1/ADC1_IN1
PA 6/ [ADC1_TRIG]/
7
LCD_COM2/ADC1_IN0
8PA7/LCD_SEG0
(4)
PB0
24
/TIM2_CH1/
LCD_SEG10/ADC1_IN18
PB1/TIM3_CH1/
25
LCD_SEG11/
ADC1_IN17
PB2/ TIM2_CH2/
26
LCD_SEG12/
ADC1_IN16
Pin name
(1)
(8)
/
(8)
(3)
(8)
InputOutput
Type
I/O level
wpu
floating
OD
PP
Default alternate function
(after reset)
Main function
Ext. interrupt
High sink/source
I/OXHSX ResetPA 1
HSE oscillator input /
I/OXXXHS XX Port A2
[USART1 transmit] / [SPI1
master in- slave out]
HSE oscillator output /
I/OXXXHS XX Port A3
[USART1 receive]/ [SPI1
master out/slave in]/
I/O TT
I/O TT
(2)
XXXHSXXPort A4
(2)
XXXHSXXPort A5
Timer 2 - break input /
LCD COM 0 / ADC1 input 2
Timer 3 - break input /
LCD_COM 1 / ADC1 input
1
[ADC1 - trigger] /
LCD_COM2 /
I/O TT
(2)
XXXHSXXPort A6
ADC1 input 0
I/O FTXXXHS XX Port A7 LCD segment 0
I/O TT
I/O TT
I/O TT
(2)X(4)X(4)
(2)
XXXHSXXPort B1
(2)
XXXHSXXPort B2
XHSX XPort B0
Timer 2 - channel 1 / LCD
segment 10 / ADC1_IN18
Timer 3 - channel 1 / LCD
segment 11 / ADC1_IN17
Timer 2 - channel 2 / LCD
segment 12 / ADC1_IN16
24/102Doc ID 023331 Rev 1
STM8L052C6Pin description
Table 4.Medium density value line STM8L05xxx pin description (continued)
Table 4.Medium density value line STM8L05xxx pin description (continued)
Pin
number
LQFP48
Pin name
Typ e
InputOutput
I/O level
wpu
floating
OD
PP
Main function
Default alternate function
(after reset)
Ext. interrupt
High sink/source
PE7/LCD_SEG27
48
32PF0/ADC1_IN24I/OXXXHS XX Por t F0
I/O TT
(2)
XXXHSXXPort E7 LCD segment 27
ADC1_IN24
13VLCDSLCD booster external capacitor
13ReservedReserved. Must be tied to V
10V
11V
12V
39V
40V
DD
DDA
REF+
9V
SS1/VSSA/VREF-
DD2
SS2
(6)
PA 0
1
/[USART1_CK]
SWIM/BEEP/IR_TIM
(8)
(7)
SDigital power supply
SAnalog supply voltage
SADC1 positive voltage reference
S
I/O ground / Analog ground voltage /
ADC1 negative voltage reference
SIOs supply voltage
SIOs ground voltage
[USART1 synchronous
/
I/OX X
(6)
HS
X
XXPort A0
(7)
(8)
clock]
output /Beep output
/ SWIM input and
/ Infrared Timer output
DD
1. 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 STM8L15x and STM8L16x reference manual (RM0031).
2. In the 3.6 V tolerant I/Os, protection diode to V
3. In the 5 V tolerant I/Os, protection diode to V
4. A pull-up is applied to PB0 and PB4 during the reset phase. These two pins are input floating after reset release.
5. In the open-drain output column, ‘T’ defines a true open-drain I/O (P-buffer, weak pull-up and protection diode to V
not implemented).
6. The PA0 pin is in input pull-up during the reset phase and after reset release.
7. High Sink LED driver capability available on PA0.
8. [ ] Alternate function remapping option (if the same alternate function is shown twice, it indicates an exclusive choice not
aduplication of the function).
is not implemented.
DD
is not implemented.
DD
DD
are
Note:The slope control of all GPIO pins, except true open drain pins, can be programmed. By
default, the slope control is limited to 2 MHz.
Doc ID 023331 Rev 127/102
Pin descriptionSTM8L052C6
4.1 System configuration options
As shown in Table 4: Medium density value line STM8L05xxx pin description, some
alternate functions can be remapped on different I/O ports by programming one of the two
remapping registers described in the “ Routing interface (RI) and system configuration
controller” section in the STM8L15x and STM8L16x reference manual (RM0031).
28/102Doc ID 023331 Rev 1
STM8L052C6Memory and register map
GPIO and peripheral registers
0x00 0000
Reserved
Medium density
(32 Kbytes)
Reset and interrupt vectors
0x00 1000
0x00 10FF
RAM
0x00 07FF
(2 Kbytes)
(1)
(513 bytes)
(1)
0x00 1100
Data EEPROM
0x00 4800
0x00 48FF
0x00 4900
0x00 7FFF
0x00 8000
0x00 FFFF
0x00 0800
0x00 0FFF
0x00 47FF
0x00 7EFF
0x00 8080
0x00 807F
0x00 7F00
Reserved
including
Stack
(256 bytes)
Option bytes
0x00 4FFF
0x00 5000
0x00 57FF
0x00 5800
Reserved
0x00 5FFF
Boot ROM
0x00 6000
0x00 67FF
(2 Kbytes)
0x00 6800
Reserved
CPU/SWIM/Debug/ITC
Registers
0x00 5000
GPIO Ports
0x00 5050
Flash
0x00 50C0
ITC-EXTI
0x00 50D3
RST
0x00 50E0
CLK
0x00 50F3
WWDG
0x00 5210
IWDG
0x00 5230
BEEP
0x00 5250
RTC
0x00 5280
SPI1
0x00 52B0
I2C1
0x00 52E0
USART1
TIM2
TIM3
TIM1
TIM4
IRTIM
ADC1
0x00 5070
DMA1
SYSCFG
LCD
RI
0x00 509E
0x00 50A0
0x00 50B0
0x00 5140
0x00 5200
0x00 52FF
0x00 5340
0x00 5380
0x00 5400
0x00 5430
0x00 5440
Flash program memory
WFE
0x00 50A6
0x00 50B2
PWR
Reserved
Reserved
Reserved
5 Memory and register map
5.1 Memory mapping
The memory map is shown in Figure 4.
Figure 4.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 Table 8 for information on CPU/SWIM/debug module controller registers.
Doc ID 023331 Rev 129/102
Memory and register mapSTM8L052C6
Table 5.Flash and RAM boundary addresses
Memory areaSizeStart addressEnd address
RAM2 Kbytes0x00 00000x00 07FF
Flash program memory32 Kbytes0x00 80000x00 FFFF
5.2 Register map
Table 6.I/O port hardware register map
0x00 5000
0x00 5001PA_IDRPort A input pin value register0xXX
0x00 5002PA_DDRPort A data direction register0x00
0x00 5003PA_CR1Port A control register 10x01
0x00 5004PA_CR2Port A control register 20x00
0x00 5005
0x00 5006PB_IDRPort B input pin value register0xXX
0x00 5007PB_DDRPort B data direction register0x00
0x00 5008PB_CR1Port B control register 10x00
AddressBlockRegister labelRegister name
PA_ODRPort A data output latch register0x00
Por t A
PB_ODRPort B data output latch register0x00
Por t B
Reset
status
0x00 5009PB_CR2Port B control register 20x00
0x00 500A
PC_ODRPort C data output latch register0x00
0x00 500BPC_IDRPort C input pin value register0xXX
0x00 500CPC_DDRPort C data direction register0x00
Por t C
0x00 500DPC_CR1Port C control register 10x00
0x00 500EPC_CR2Port C control register 20x00
0x00 500F
PD_ODRPort D data output latch register0x00
0x00 5010PD_IDRPort D input pin value register0xXX
0x00 5011PD_DDRPort D data direction register0x00
Por t D
0x00 5012PD_CR1Port D control register 10x00
0x00 5013PD_CR2Port D control register 20x00
0x00 5014
PE_ODRPort E data output latch register0x00
0x00 5015PE_IDRPort E input pin value register0xXX
0x00 5016PE_DDRPort E data direction register0x00
Por t E
0x00 5017PE_CR1Port E control register 10x00
0x00 5018PE_CR2Port E control register 20x00
30/102Doc ID 023331 Rev 1
Loading...
+ 72 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.