This application note complements the information in the STM8L datasheets by describing
the minimum hardware and software environment required to build an application around an
STM8L 8-bit microcontroller device.
It applies to low density STM8L101x, medium and medium+ density STM8L15x, and high
density STM8L15x/16x devices.
A brief description of the principal hardware components is given. The power supply,
analog-to-digital converter (ADC), clock management, and reset control are described in
some detail. In addition, some hardware recommendations are given. This application note
also contains detailed reference design schematics with descriptions of the main
components. The STM8L uses the same toolchainThe STM8 development tools and
software toolchain are common to STM8L, STM8S and STM8A and are presented in
Section 8, and9. Section 10 describes how to set up the STM8 development environment.
Finally, Section 11 provides a list of relevant documentation and online support resources.
To build an application around an STM8L device, the application board should provide the
following features:
●Power supply (mandatory)
●Clock management (optional)
●Reset management (optional)
●Debugging tool support: Single wire interface module (SWIM) connector (optional)
2 Power supply
2.1 Power supply overview
The STM8L can be supplied through a 1.65 V to 3.6 V external source. For medium density
STM8L15x and high density STM8L15x/STM8L16x with BOR, the power supply must be
above 1.8 V at power-on and can go below 1.65 V at power-down.
An on-chip power management system provides the constant digital supply to the core logic,
both in normal and low power modes. This garantees that the logic consumes a constant
current over the voltage range. It is also capable of detecting voltage drops and generate
reset to avoid heratic behaviour.
The STM8L device provides:
●Depending on packages, one pair of pads (V
(V
DDx/VSSx
All V
connected to V
for each V
) from 1.65 V or 1.8 V to 3.6 V.
DDx
and V
DDx
must be at the same potential respectively. The V
SSx
with external decoupling capacitors: one 100 nF Ceramic capacitor
DD
pin and one single 1 µF Tantalum or Ceramic capacitor.
DD/VSS
), or several pairs of pads
pins must be
DDx
The STM8L15x and STM8L16xdevices also provide in some packages:
●One pair of pads, V
DDA/VSSA
the same potential respectively as V
converter (ADC) for more details. The V
, dedicated to analog functions. V
and VSS. Refer to Section 3: Analog-to-digital
DD
pin must be connected to two external
DDA
DDA
and V
must be at
SSA
decoupling capacitors (one 100 nF Ceramic capacitor and one single 1 µF Tantalum or
Ceramic capacitor). Additional precautions can be taken to filter analog noise: V
can be connected to V
through a ferrite bead.
DD
DDA
The STM8L152/STM8L162 device manages the supply voltage needed by the LCD in three
different ways (see Figure 1):
1.If the LCD feature is not used, connect the VLCD pin to V
DD
.
2. Apply to VLCD the voltageto be applied to the LCD.
3. Leave the STM8L152/STM8L162 to provide the correct voltage, via its programmable
LCD booster, by connecting the VLCD pin to a 1µF capacitor.
6/42Doc ID 16139 Rev 3
AN3029Power supply
6
,#$
34-,
.§N&
6
$$
§&
N&&
N&&
NOTE
6
,#$
6
2%&
6
$$!
6
33!
6
$$.
6
33.
6
2%&
6
$$
AIE
&
OPTIONAL
NOTE
NOTE
Figure 1.Power supply
1. Optional: if a separate, external reference voltage is connected on V
µF) must be connected. V
2. N is the number of V
DD
is either connected to V
REF+
and VSS inputs.
DDA
or V
REF.
, the two capacitors (100 nF and 1
REF+
Note:The capacitors must be connected as close as possible to the device supplies.
Placing a crystal/resonator on OSCIN/OSCOUT is optional. The resonator must be
connected as close as possible to the OSCIN and OSCOUT pins. The loading capacitance
ground must be connected as close as possible to V
SS
.
2.2 Main operating voltages
STM8L devices are processed in 0.13 µm technology. The STM8L core and I/O peripherals
need different power supplies. In fact, STM8L devices have an internal regulator with a
nominal target output of 1.8 V.
Doc ID 16139 Rev 37/42
Power supplyAN3029
Via to V
SS
Via to V
DD
Cap.
VDDV
SS
STM8
2.3 Power-on/power-down reset (POR/PDR)
The input supply to the main and low power regulators is monitored by a power-on/powerdown reset circuit. The monitoring voltage begins at 0.7 V.
During power-on, the POR/PDR keeps the device under reset until the supply voltages (V
and V
) reach their specified working area. This internal reset is maintained during ~1ms
DDA
DD
in order to wait for supply stabilization.
At power-on, a defined reset should be maintained below 0.7 V. The upper threshold for a
reset release is defined in the electrical characteristics section of the product datasheets.
A hysteresis is implemented (POR > PDR) to ensure clean detection of voltage rise and fall.
The POR/PDR also generates a reset when the supply voltage drops below the V
POR/PDR
threshold (isolated and repetitive events).
For better power monitoring, the STM8L15x andSTM8L16x provide a programmable power
voltage detection (PVD) and a brown out reset (BOR) for an earlier detection of voltage
drop.
Recommendations
All pins need to be properly connected to the power supplies. These connections, including
pads, tracks and vias should have the lowest possible impedance. This is typically achieved
with thick track widths and preferably dedicated power supply planes in multi-layer printed
circuit boards (PCBs).
In addition, each power supply pair should be decoupled with filtering ceramic capacitors (C)
at 100 nF with one chemical C (1..2 µF) in parallel on the STM8L device. The ceramic
capacitors should be placed as close as possible to the appropriate pins, or below the
appropriate pins, on the opposite side of the PCB. Typical values are 10 nF to 100 nF, but
exact values depend on the application needs. Figure 2 shows the typical layout of such a
V
DD/VSS
pair.
Figure 2.Typical layout of V
8/42Doc ID 16139 Rev 3
DD/VSS
pair
AN3029Analog-to-digital converter (ADC)
STM8L15x/STM8L16x
3 Analog-to-digital converter (ADC)
This section is unique for the STM8L15x and STM8L16x.
3.1 Analog power
For some packages, the ADC unit has an independent, analog supply voltage, isolated on
input pin V
voltage, V
noise, a ferrite bead can be added between V
choosen according to the frequencies to be filtered.
Some packages also provide a separate external analog reference voltage input for the ADC
unit on the V
●The V
external reference voltage is applied on V
connected on this pin. To compensate for peak consumption on V
capacitor may be increased to 10 µF when the sampling speed is low. In all cases,
V
REF+
equal to V
internal V
●V
REF-
internally bonded to V
, which allows the ADC to accept a very clean voltage source. This analog
DDA
, should be identical to the digital voltage supply on pin VDD. To filter some
DDA
pin. This gives better accuracy on low voltage input as follows:
REF+
pin can be connected to the V
REF+
must be kept between 2.4 V and V
. This input is internally bonded to V
DDA
pin.
REF+
and V
DD
external power supply. If a separate,
DDA
, a 100 nF and a 1 µF capacitor must be
REF+
. If V
DDA
. This ferrite bead should be
DDA
, the 1 µF
REF
is below 2.4, V
DDA
in the devices that have no
DDA
REF+
must be
(input, analog reference negative): The lower/negative reference voltage is
.
SSA
3.2 Analog input
STM8L15x and STM8L16x devices have up to 28 analog input channels (including four fast
channels), each multiplexed with an I/O, which are converted by the ADC one at a time.
The external input impedance (R
at maximum speed (1 MHz) if R
Please refer to Figure 3.
Figure 3.Analog input interface
) max value is 50 kΩ.The four fast channels can convert
AIN
is less than 0.5 kΩ.
AIN
Doc ID 16139 Rev 39/42
Analog-to-digital converter (ADC)AN3029
Please refer to the STM8L15x and STM8L16xdatasheets and reference manuals for more
details.
10/42Doc ID 16139 Rev 3
AN3029Clock management
4 Clock management
The STM8L101 has no external clock so no precautionary measures are needed.
4.1 Clock management overview
STM8L15x and STM8L16x devices offer a flexible way of selecting the core and peripheral
clocks (ADC, memory, and digital peripherals). The devices have internal and external clock
source inputs, both of which have a high speed and a low speed version. Any of those four
clocks can be use for the CPU and most of the peripherals through a programable prescaler.
An I/O can be programmed as output clock (CCO) to reflect one of the four clocks (with or
without prescaling).
The signal which leaves the I/O represents an output clock (CCO) divided by a division
factor.
4.2 Internal clocks
STM8L devices have two kinds of internal clock: A high speed internal clock (HSI) running at
16 MHz and a low speed internal clock (LSI) running at 38 kHz.
After reset, the CPU starts with the internal RC (HSI clock signal) divided by 8, i.e. 2 MHz.
4.3 External clock
STM8L15x and STM8L16x devices have two kinds of external clock: A high speed external
clock (HSE) running at up to 16 MHz and a low speed external clock (LSE) running at
32.768 kHz.
4.3.1 HSE clock
STM8L15x and STM8L16x devices can connect to an external crystal or an external
oscillator.
Note:When no external clock is used, OSCIN and OSCOUT can be used as general purpose
I/Os.
Figure 4 describes the external clock connections.
External clock
●Frequency: 0 kHz … 16 MHz
●Input hysteresis: 100 mV
Caution:Without prescaler, a duty cycle of 45/55 % maximum must be respected at high speed
Doc ID 16139 Rev 311/42
Clock managementAN3029
OSC
IN
OSC
OUT
External source
STM8
(I/O available)
Load capacitors
STM8
C
L2
C
L1
Q1
OSC
IN
OSC
OUT
R
EXT
(1)
Crystal/ceramic resonator
●Frequency range: 1 to 16 MHz
●Stabilisation time: Programable from 1 to 4096 cycles
●Oscillation mode: Preferred fundamental
●Output duty cycle: Max 55/45%
●I/O’s: Standard I/O pins multiplexed with OSC
●
Cload: 10 to 20 pF
●Drive level maximum: at least 100 µW
Figure 4.HSE clock sources
Hardware configuration
External clock
and OSC
IN
OUT
(1)
Crystal/ceramic resonators
1. The value of R
but, it is not optimal. A typical value is in the range 5 to 6 RS (resonator series resistance). To fine-tune the
R
value, refer to AN2867 (Oscillator design guide for ST microcontrollers).
EXT
The values of the load capacitors C
depends on the crystal characteristics. A 0 resistor works well with most oscillators
EXT
and CL2 are heavily dependent on the crystal type and
L1
frequency. Refer to the datasheet of the crystal manufacturer to select the capacitances. For
best oscillation stability, C
and CL2 normally have the same value. Typical values are in the
L1
range from below 20 pF up to 40 pF (cload: 10 to 20 pF). The parasitic capacitance of the
board layout also needs to be considered and typically adds a few pF to the component
values (refer to AN2867).
A clock security system prevents any CPU fatal error from a HSE failure, as it safely
switches to HSI.
12/42Doc ID 16139 Rev 3
AN3029Clock management
OSC32_OUTOSC32_IN
External source
(Hi-Z)
ai15765
Microcontroller
Recommendations
In the PCB layout all connections should be as short as possible. Any additional signals,
especially those that could interfere with the oscillator, should be locally separated from the
PCB area around the oscillation circuit using suitable shielding.
4.3.2 LSE clock
The low-speed external clock signal (LSE) can be generated from two possible clock
sources:
●LSE external crystal/ceramic resonator (see Figure 6)
●LSE user external clock(see Figure 6)
External source (LSE bypass)
In this mode, an external clock source must be provided. It must have a frequency of
32.768 kHz. The external clock signal (square, sine or triangle) with a duty cycle of about
50% has to drive the OSC32_IN pin while the OSC32_OUT pin must be left high impedance
(see Figure 6 and Figure 6).
Figure 5.External clock
1. OSC32_IN and OSC32_OUT pins can be used also as GPIO but, it is recommended not to use them as
both RTC and GPIO pins in the same application.
External crystal/ceramic resonator (LSE crystal)
The LSE crystal is a 32.768 kHz low-speed external crystal or ceramic resonator. It has the
advantage of providing a low-power, but highly accurate clock source to the real-time clock
peripheral (RTC) for clock/calendar or other timing functions.
The resonator and the load capacitors have to be connected as close as possible to the
oscillator pins in order to minimize output distortion and start-up stabilization time. The load
capacitance values must be adjusted according to the selected oscillator.
Doc ID 16139 Rev 313/42
Loading...
+ 29 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.