ST STM32L152-EVAL Installation and operating instructions

June 2011 Doc ID 17496 Rev 5 1/30
AN3216
Application note
Getting started with STM32L1xxx hardware development
1 Introduction
This application note is intended for system designers who require a hardware
implementation overview of the development board features such as the power supply, the
clock management, the reset control, the boot mode settings and the debug management. It
shows how to use STM32L1xxx product families and describes the minimum hardware
resources required to develop an STM32L1xxx application.
Detailed reference design schematics are also contained in this document with descriptions
of the main components, interfaces and modes.
www.st.com

Contents AN3216
2/30 Doc ID 17496 Rev 5
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Power supplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1.1 Independent A/D converter supply and reference voltage . . . . . . . . . . . . 7
2.1.2 Independent LCD supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.3 Voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 Power supply schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 Reset and power supply supervisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.1 Power-on reset (POR)/power-down reset (PDR),
brownout reset (BOR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.2 Programmable voltage detector (PVD) . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.3 Brownout reset (BOR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.4 System reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3 Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.1 MSI clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2 HSE OSC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2.1 External source (HSE bypass) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2.2 External crystal/ceramic resonator (HSE crystal) . . . . . . . . . . . . . . . . . 15
3.3 LSE OSC clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3.1 External source (LSE bypass) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3.2 External crystal/ceramic resonator (LSE crystal) . . . . . . . . . . . . . . . . . . 16
3.4 Clock security system (CSS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4 Boot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.1 Boot mode selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.2 Boot pin connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.3 Embedded boot loader mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5 Debug management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.2 SWJ debug port (serial wire and JTAG) . . . . . . . . . . . . . . . . . . . . . . . . . . 20

AN3216 Contents
Doc ID 17496 Rev 5 3/30
5.3 Pinout and debug port pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.3.1 SWJ debug port pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.3.2 Flexible SWJ-DP pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
5.3.3 Internal pull-up and pull-down resistors on JTAG pins . . . . . . . . . . . . . . 22
5.3.4 SWJ debug port connection with standard JTAG connector . . . . . . . . . 22
6 Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.1 Printed circuit board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.2 Component position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.3 Ground and power supply (VSS, VDD) . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.4 Decoupling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.5 Other signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.6 Unused I/Os and features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7 Reference design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7.1.1 Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7.1.2 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7.1.3 Boot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7.1.4 SWJ interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7.1.5 Power supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7.2 Component references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
8 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

List of tables AN3216
4/30 Doc ID 17496 Rev 5
List of tables
Table 1. Boot modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Table 2. Debug port pin assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Table 3. SWJ I/O pin availability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Table 4. Mandatory components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Table 5. Optional components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Table 6. Reference connection for all packages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Table 7. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

AN3216 List of figures
Doc ID 17496 Rev 5 5/30
List of figures
Figure 1. Power supply overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 2. Power supply scheme. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 3. Power supply supervisors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 4. Power on reset/power down reset waveform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 5. PVD thresholds. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 6. Reset circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 7. External clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 8. Crystal/ceramic resonators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 9. External clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 10. Crystal/ceramic resonators(2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 11. Boot mode selection implementation example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Figure 12. Host-to-board connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Figure 13. JTAG connector implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Figure 14. Typical layout for VDD/VSS pair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Figure 15. STM32L152VB(T6) microcontroller reference schematic . . . . . . . . . . . . . . . . . . . . . . . . . . 27

Power supplies AN3216
6/30 Doc ID 17496 Rev 5
2 Power supplies
2.1 Introduction
The device requires a 2.0 V to 3.6 V operating voltage supply (VDD), to be fully functional at
full speed. This maximum frequency is only achieved when the digital power voltage VCORE
is equal to 1.8 V (product voltage range 1).
Product voltage range 2 (VCORE = 1.5 V) and 3 (VCORE = 1.2 V) can be selected when the
VDD operates from 1.65 V to 3.6 V. Frequency is limited to 16 MHz and 4 MHz when the
device is in product voltage range 2 and 3 respectively.
When the ADC and brownout reset (BOR) are not used, the device can operate at power
voltages below 1.8 V down to 1.65 V.
Digital power voltage (VCORE) is provided with an embedded linear voltage regulator with
three different programmable ranges from 1.2 to 1.8 V (typical).
Figure 1. Power supply overview
Note: VDDA and VSSA must be connected to VDD and VSS, respectively.
6$$
633
AI
6$$6$$!
633633!
!$#
$!#TEMPSENSOR
2ESETBLOCK
0,,
FROM6UPTO6$$!62%&
MUSTBETIEDTO633!62%&
6,#$
&LASHMEMORY
)/SUPPLY
6$$!DOMAIN
6$$DOMAIN
3TANDBYCIRCUITRY
WAKEUPLOGIC
)7$'24#
,3%CRYSTAL
+BYTEOSC
2###32
6OLTAGEREGULATOR
DYNAMICVOLTAGE
SCALING
,#$
6COREDOMAIN
#ORE
MEMORIES
DIGITAL
PERIPHERALS

AN3216 Power supplies
Doc ID 17496 Rev 5 7/30
2.1.1 Independent A/D converter supply and reference voltage
To improve conversion accuracy, the ADC and the DAC have an independent power supply
that can be filtered separately, and shielded from noise on the PCB.
●The ADC voltage supply input is available on a separate VDDA pin
●An isolated supply ground connection is provided on the VSSA pin
VDDA and VREF require a stable voltage. The consumption on VDDA can reach several mA
(see IDD(ADCx), IDD(DAC), IDD(COMPx), IVDDA, and IVREF in the product datasheets for
further information).
When available (depending on the package), VREF¨ must be tied to VSSA.
On BGA 64-pin and all 100-pin packages
To ensure a better accuracy on low-voltage inputs and outputs, the user can connect to
VREF+, a separate external reference voltage which is lower than VDD. VREF+ is the highest
voltage, represented by the full scale value, for an analog input (ADC) or output (DAC)
signal.
●For ADC
– 2.4 V ≤V
REF+ = VDDA for full speed (ADCCLK = 16 MHz, 1 Msps)
– 1.8 V ≤V
REF+ = VDDA for medium speed (ADCCLK = 8 MHz, 500 Ksps)
– 2.4 V ≤V
REF+ ≠ VDDA for medium speed (ADCCLK = 8 MHz, 500 Ksps)
– 1.8 V ≤V
REF+ < VDDA for low speed (ADCCLK = 4 MHz, 250 Ksps)
– When product voltage range 3 is selected (VCORE = 1.2 V), the ADC is low speed
(ADCCLK = 4 MHz, 250 Ksps)
●For DAC
– 1.8 V≤ VREF+ < VDDA
On packages with 64 pins or less (except BGA package)
VREF+ and VREF- pins are not available. They are internally connected to the ADC voltage
supply (VDDA) and ground (VSSA).

Power supplies AN3216
8/30 Doc ID 17496 Rev 5
2.1.2 Independent LCD supply
The VLCD pin is provided to control the contrast of the glass LCD. This pin can be used in
two ways:
●It can receive, from an external circuitry, the desired maximum voltage that is provided
on the segment and common lines to the glass LCD by the microcontroller.
●It can also be used to connect an external capacitor that is used by the microcontroller
for its voltage step-up converter. This step-up converter is controlled by software to
provide the desired voltage to the segment and common lines of the glass LCD.
The voltage provided to the segment and common lines defines the contrast of the glass
LCD pixels. This contrast can be reduced when the dead time between frames is
configured.
●When an external power supply is provided to the VLCD pin, it should range from 2.5 V
to 3.6 V. It does not depend on VDD.
●When the LCD is based on the internal step-up converter, the VLCD pin should be
connected to a capacitor (see the product datasheets for further information).
2.1.3 Voltage regulator
The internal voltage regulator is always enabled after reset. It can be configured to provide
the core with three different voltage ranges. Choosing a range with low Vcore reduces the
consumption but lowers the maximum acceptable core speed. Consumption ranges in
decreasing consumption order are as follows:
●Range 1, available only for VDD above 2.0 V, allows maximum speed
●Range 2 allows CPU frequency up to 16 MHz
●Range 3 allows CPU frequency up to 4 MHz
Voltage regulator works in three different modes depending on the application modes.
●In Run mode, the regulator supplies full power to the Vcore domain (core, memories and
digital peripherals).
●In Stop mode, Low power run and Low power wait modes, the regulator supplies low
power to the Vcore domain, preserving the contents of the registers and SRAM.
●In Standby mode, the regulator is powered off. The contents of the registers and SRAM
are lost except for those concerned with the Standby circuitry.

AN3216 Power supplies
Doc ID 17496 Rev 5 9/30
2.2 Power supply schemes
The circuit is powered by a stabilized power supply, VDD.
●The VDD pins must be connected to VDD with external decoupling capacitors; one
single Tantalum or Ceramic capacitor (minimum 4.7 µF typical 10 µF) for the package +
one 100 nF Ceramic capacitor for each VDD pin).
●The VDDA pin must be connected to two external decoupling capacitors (100 nF
Ceramic capacitor + 1 µF Tantalum or Ceramic capacitor).
●The VREF+ pin can be connected to the VDDA external power supply. If a separate,
external reference voltage is applied on VREF+, a 100 nF and a 1 µF capacitor must be
connected on this pin. To compensate peak consumption on Vref, the 1 µF capacitor
may be increased up to 10µF when the sampling speed is low. When ADC or DAC is
used, VREF+ must remain between 1.8 V and VDDA. VREF+ can be grounded when
ADC and DAC are not active; this enables the user to power down an external voltage
reference.
●Additional precautions can be taken to filter analog noise: VDDA can be connected to
VDD through a ferrite bead.
Figure 2. Power supply scheme
1. Optional. If a separate, external reference voltage is connected on VREF+, the two capacitors (100 nF and
1 µF) must be connected.
2. VREF+ is either connected to VDDA or to VREF.
3. N is the number of VDD and VSS inputs.
2.3 Reset and power supply supervisor
The input supply to the main and low power regulators is monitored by a power-on/power-
down/brownout reset circuit. Power-on/power-down reset are a null power monitoring with
fixed threshold voltages, whereas brownout reset gives the choice between several
thresholds with a very low, but not null, power consumption.
In addition, the STM32L1xxx embeds a programmable voltage detector that compares the
power supply with the programmable threshold. An interrupt can be generated when the
power supply drops below the VPVD threshold and/or when the power supply is higher than
the VPVD threshold. The interrupt service routine then generates a warning message and/or
puts the MCU into a safe state.
6,#$
34-,XXX
.§N&
6$$
§&
N&&
N&&
NOTE
6,#$
62%&
6$$!
633!
62%&n
6$$.
633.
62%&
6$$
AID
&
OPTIONAL

Power supplies AN3216
10/30 Doc ID 17496 Rev 5
Figure 3. Power supply supervisors
1. The PVD is available on all STM32L devices and it is enabled or disabled by software.
2. The BOR is available only on devices operating from 1.8 to 3.6 V, and unless disabled by option byte it
masks the POR/PDR threshold.
3. When the BOR is disabled by option byte, the reset is asserted when VDD goes below PDR level.
4. For devices operating from 1.65 to 3.6 V, there is no BOR and the reset is released when VDD goes above
POR level and asserted when VDD goes below PDR level.
VDD/V DDA
PVD output
100 mV
hysteresis
VPVD
VBOR hysteresis
100 mV
IT enabled
BOR reset
(NRST)
POR/PDR reset
(NR ST)
PVD
BOR alwaysactive
POR/PDR (BOR not available) ai17211b
POR
V/PDR
V
BOR/PDR reset
(NRST)
BOR disabled by option byte
(Note 1)
(Note 2)
(Note 3)
(Note 4)

AN3216 Power supplies
Doc ID 17496 Rev 5 11/30
2.3.1 Power-on reset (POR)/power-down reset (PDR),
brownout reset (BOR)
The monitoring voltage begins at 0.7 V.
During power-on, for devices operating between 1.8 and 3.6 V, the BOR keeps the device
under reset until the supply voltages (VDD and VDDIO) come close to the lowest acceptable
voltage (1.8 V). At power-up this internal reset is maintained during ~1 ms to wait for the
supply to reach its final value and stabilize.
At power-down the reset is activated as soon as the power drops below the lowest limit
(1.65 V).
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.
Figure 4. Power on reset/power down reset waveform
If you want to run the cpu at full speed the threshold should be raised to 2.0 V. For a
programmable threshold above the chip lowest limit, a brownout reset can be configured to
the desired value. The BOR can also be used to detect a power voltage drop earlier. The
threshold values of the BOR can be configured through the FLASH_OBR option byte.
2.3.2 Programmable voltage detector (PVD)
The device features an embedded programmable voltage detector (PVD) that monitors the
VDD/VDDA power supply and compares it to the VPVD threshold. Seven different PVD levels
can be selected by software between 1.85 V and 3.05 V, with a 200 mV step. An interrupt
can be generated when VDD/VDDA drops below the VPVD threshold and/or when VDD/VDDA
is higher than the VPVD threshold. The interrupt service routine then generates a warning
message and/or puts the MCU into a safe state. The PVD is enabled by software
configuration. As an example, the service routine can perform emergency shutdown tasks.
VDD/VDDA
Reset
POR
PDR
Temporization
tRSTTEMPO

Power supplies AN3216
12/30 Doc ID 17496 Rev 5
Figure 5. PVD thresholds
2.3.3 Brownout reset (BOR)
During power on, the brownout reset (BOR) keeps the device under reset until the supply
voltage reaches the specified VBOR threshold.
For devices operating from 1.65 to 3.6 V, the BOR option is not available and the power
supply is monitored by the POR/PDR. As the POR/PDR thresholds are at 1.5 V, a “grey
zone” exists between the VPOR/VPDR thresholds and the minimum product operating voltage
1.65 V.
For devices operating from 1.8 to 3.6 V, the BOR is always active at power on and its
threshold is 1.8 V.
When the system reset is released, the BOR level can be reconfigured or disabled by option
byte loading.
If the BOR level is kept at the lowest level, 1.8 V at power-on and 1.65 V at power down, the
system reset is fully managed by the BOR and the product operating voltages are within
safe ranges.
When the BOR option is disabled by option byte, the power down reset is controlled by the
PDR and a “grey zone” exists between the 1.65 V and VPDR.
VBOR is configured through device option bytes. By default, level 4 threshold is activated.
Five programmable VBOR thresholds can be selected (see product datasheets for actual
VBOR0 to VBOR4 thresholds).
When the supply voltage (VDD) drops below the selected VBOR threshold, a device reset is
generated. When the VDD is above the VBOR upper limit the device reset is released and the
system can start.
BOR can be disabled by programming the device option bytes. To disable the BOR function,
VDD must have been higher than VBOR0 to start the device option byte programming
sequence. The power-on and power-down is then monitored by the POR and PDR (see
power-on reset (POR)/power-down reset (PDR) section in the product datasheets).
The BOR threshold hysteresis is ~100 mV (between the rising and the falling edge of the
supply voltage).
VDD/VDDA
PVD output
100 mV
hysteresis
PVD threshold

AN3216 Power supplies
Doc ID 17496 Rev 5 13/30
2.3.4 System reset
A system reset sets all registers to their reset values except for the RTC, backup registers
and RCC control/status register, RCC_CSR.
A system reset is generated when one of the following events occurs:
1. A low level on the NRST pin (external reset)
2. Window watchdog end-of-count condition (WWDG reset)
3. Independent watchdog end-of-count condition (IWDG reset)
4. A reset bit set by software (SWreset)
5. Entering Standby or Stop mode configured to generate a reset (Low-power
management reset).
6. Option byte loader reset
7. Exiting Standby mode
The reset source can be identified by checking the reset flags in the Control/Status register,
RCC_CSR.
Figure 6. Reset circuit
The STM32L does not require an external reset circuit to power-up correctly. Only a pull-
down capacitor is recommended to improve EMS performance by protecting the device
against parasitic resets (see Figure 6).
Charging/discharging the pull-down capacitor thru the internal resistor adds to the device
power consumption. The recommended value of 100 nF for the capacitor can be reduced to
10 nF to limit this power consumption.
205
6$$6$$!
0ULSE
GENERATOR
MINS
3YSTEMRESET
&ILTER
&
%XTERNAL
RESETCIRCUIT
.234
AIC
88%(SFTFU
*8%(SFTFU
1PXFSSFTFU
4PGUXBSFSFTFU
-PXQPXFSNBOBHFNFOUSFTFU
0QUJPOCZUFMPBEFSSFTFU
&YJUJOH4UBOECZNPEF

Clocks AN3216
14/30 Doc ID 17496 Rev 5
3 Clocks
Four different clock sources can be used to drive the system clock (SYSCLK). They are:
●HSI ((high-speed internal) oscillator clock
●HSE (high-speed external) oscillator clock
●PLL clock
●MSI (multispeed internal) oscillator clock
The MSI is used as a system clock source after startup from reset, wake-up from Stop or
Standby low power modes.
The devices have the following two secondary clock sources:
●37 kHz low speed internal RC (LSI RC) which drives the independent watchdog and
optionally the RTC used for auto-wakeup from Stop/Standby mode.
●32.768 kHz low speed external crystal (LSE crystal) which optionally drives the
real-time clock (RTCCLK)
Each clock source can be switched on or off independently when it is not used, to optimize
power consumption.
Refer to the STM32L15xxx reference manual (RM0038) for a description of the clock tree.
3.1 MSI clock
The MSI clock signal is generated from an internal RC oscillator. Its frequency range can be
adjusted by software through the RCC_ICSCR register. Seven frequency ranges are
available: 65.5 kHz, 131 kHz, 262 kHz, 524 kHz, 1.05 MHz, 2.1 MHz (default value) and
4.2 MHz. Those frequencies are multiple values of 32.768 kHz.
The MSI clock is used as a system clock after a restart from reset.
The MSI RC oscillator has the advantage of providing a low-cost (no external components)
low-power clock source. It is used as a wakeup clock in low power modes to reduce power
consumption and wakeup time.
The MSIRDY flag in the RCC_CR register indicates wether the MSI RC is stable or not. At
startup, the MSI RC output clock is not released until this bit is set by hardware.
The MSI RC can be switched on and off through the RCC_CR register (default is on).
If the application is subject to voltage or temperature variations, this may affect the RC
oscillator speed. You can trim the MSI frequency in the application through the RCC_ICSCR
register. Typically, this uses the HSE as reference (see RM0038 for details on clock
measurement with TIM9/TIM10/TIM11).

AN3216 Clocks
Doc ID 17496 Rev 5 15/30
3.2 HSE OSC clock
The high-speed external clock signal (HSE) can be generated from two possible clock
sources:
●HSE user external clock (see Figure 7)
●HSE external crystal/ceramic resonator (see Figure 8)
1. The value of REXT depends on the crystal characteristics. A typical value is in the range of 5 to 6 RS
(resonator series resistance).
2. Load capacitance, CL, has the following formula: CL= CL1 x CL2 / (CL1 + CL2) + Cstray where: Cstray is the
pin capacitance and board or trace PCB-related capacitance. Typically, it is between 2 pF and 7 pF. Please
refer to Section 6: Recommendations on page 23 to minimize its value.
3.2.1 External source (HSE bypass)
In this mode, an external clock source must be provided. It can have a frequency of up to
32 MHz.
The external clock signal (square, sine or triangle) with a duty cycle of about 50%, has to
drive the OSC_IN pin while the OSC_OUT pin must be left in the high impedance state (see
Figure 7 and Figure 8).
3.2.2 External crystal/ceramic resonator (HSE crystal)
The external oscillator frequency ranges from 1 to 24 MHz.
The external oscillator has the advantage of producing a very accurate rate on the main
clock. The associated hardware configuration is shown in Figure 8.
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 startup stabilization time. The load
capacitance values must be adjusted according to the selected oscillator.
For CL1 and CL2 it is recommended to use high-quality ceramic capacitors in the 5 pF to 25
pF range (typical), designed for high-frequency applications and selected to meet the
requirements of the crystal or resonator. CL1 and CL2, are usually the same value. The
crystal manufacturer typically specifies a load capacitance that is the series combination of
CL1 and CL2. The PCB and MCU pin capacitances must be included when sizing CL1 and
CL2 (10 pF can be used as a rough estimate of the combined pin and board capacitance).
Refer to the electrical characteristics sections in the datasheet of your product for more
details.
Figure 7. External clock Figure 8. Crystal/ceramic resonators
OSC_OUTOSC_IN
External source
(Hi-Z)
ai14369
Hardware configuration
/3#?/54/3#?).
AIB
34-,XXX
2%84
#, #,
(ARDWARECONFIGURATION

Clocks AN3216
16/30 Doc ID 17496 Rev 5
3.3 LSE OSC clock
The low-speed external clock signal (LSE) can be generated from two possible clock
sources:
●LSE user external clock (see Figure 9)
●LSE external crystal/ceramic resonator (see Figure 10)
3. The value of REXT depends on the crystal characteristics. A 0 Ωresistor works but, is not optimal. A typical
value is in the range of 5 to 6 RS(resonator series resistance). To fine tune the RS value refer to AN2867
(Oscillator design guide for ST microcontrollers).
3.3.1 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 9).
3.3.2 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 oscillator can be switched on and off by software (default is off). When switched on, the
oscillator is not stable immediately. A bit is set in the RCC_CSR register when the oscillator
becomes stable and an interrupt can be generated if enabled in the RCC_CIR register.
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 startup stabilization time. The load
capacitance values must be adjusted according to the selected oscillator (see Figure 10).
Figure 9. External clock(1)(2)
1. To avoid exceeding the maximum value of CL1 and CL2 (15 pF), it is strongly recommended to use a
resonator with a load capacitance CL≤7 pF. Never use a resonator with a load capacitance of 12.5 pF.
2. OSC32_IN and OSC_OUT pins can be also used as GPIOs, but it is recommended not to use them as
both RTC and GPIO pins in the same application.
Figure 10. Crystal/ceramic resonators(2)
OSC32_OUTOSC32_IN
External source
(Hi-Z)
ai14371
Hardware configuration
/3#?/54/3#?).
AID
34-,XXX
#, #,
(ARDWARECONFIGURATION
2%84

AN3216 Clocks
Doc ID 17496 Rev 5 17/30
3.4 Clock security system (CSS)
The clock security system can be activated by software. In this case, the clock detector is
enabled after the HSE oscillator startup delay, and disabled when this oscillator is stopped.
If a failure is detected on the HSE oscillator clock, this oscillator is automatically disabled
and an interrupt is generated to inform the software about the failure (clock security system
interrupt, CSSI), allowing the MCU to perform rescue operations. The CSSI is linked to the
Cortex™-M3 NMI (non-maskable interrupt) exception vector.
If the HSE oscillator is used directly or indirectly as the system clock (indirectly means: it is
used as the PLL input clock, and the PLL clock is used as the system clock), a detected
failure causes the system clock to switch to the MSI oscillator and the external HSE
oscillator to be disabled. If the HSE oscillator clock is the clock entry of the PLL used as the
system clock when the failure occurs, the PLL is also disabled.
For details, see the STM32L15xxx reference manual (RM0038).

Boot configuration AN3216
18/30 Doc ID 17496 Rev 5
4 Boot configuration
4.1 Boot mode selection
In the STM32L1xxx, three different boot modes can be selected by means of the BOOT[1:0]
pins as shown in Ta b l e 1 .
The values on the BOOT pins are latched on the 4th rising edge of SYSCLK after a reset. It
is up to the user to set the BOOT1 and BOOT0 pins after reset to select the required boot
mode.
BOOT0 is a dedicated pin while BOOT1 is shared with a GPIO pin. Once BOOT1 has been
sampled, the corresponding GPIO pin is free and can be used by the application.
The BOOT pins are also resampled when exiting Standby mode. Consequently, they must
be kept in the required Boot mode configuration in Standby mode. After this startup delay
has elapsed, the CPU fetches the top-of-stack value from address 0x0000 0000, and starts
code execution from the boot memory starting from 0x0000 0004.
4.2 Boot pin connection
Figure 11 shows the external connection required to select the boot memory of the
STM32L1xxx.
Figure 11. Boot mode selection implementation example
1. Resistor values are given only as a typical example.
Table 1. Boot modes
BOOT mode selection pins
Boot mode Aliasing
BOOT1 BOOT0
x 0 Main Flash memory Main Flash memory is selected as boot
space
0 1 System memory System memory is selected as boot
space
1 1 Embedded SRAM Embedded SRAM is selected as boot
space
AIB
6$$
34-,XXX
"//4
"//4
6$$
K½
K½

AN3216 Boot configuration
Doc ID 17496 Rev 5 19/30
4.3 Embedded boot loader mode
The embedded boot loader is used to reprogram the Flash memory through one of the
following interfaces: USART1 or USART2. This program is located in the system memory
and is programmed by ST during production (see the STM32L Flash programming manual
for further details).

Debug management AN3216
20/30 Doc ID 17496 Rev 5
5 Debug management
5.1 Introduction
The host/target interface is the hardware equipment that connects the host to the application
board. This interface is made of three components: a hardware debug tool, a JTAG or SW
connector and a cable connecting the host to the debug tool.
Figure 12 shows the connection of the host to a development board. The evaluation board
(STM32L152-EVAL) embeds the debug tools (ST-LINK) so it can be directly connected to
the PC through an USB cable.
Figure 12. Host-to-board connection
5.2 SWJ debug port (serial wire and JTAG)
The STM32L1xxx core integrates the serial wire/JTAG debug port (SWJ-DP). It is an ARM®
standard CoreSight™ debug port that combines a JTAG-DP (5-pin) interface and a SW-DP
(2-pin) interface.
●The JTAG debug port (JTAG-DP) provides a 5-pin standard JTAG interface to the AHP-
AP port
●The serial wire debug port (SW-DP) provides a 2-pin (clock + data) interface to the
AHP-AP port
In the SWJ-DP, the two JTAG pins of the SW-DP are multiplexed with some of the five JTAG
pins of the JTAG-DP.
5.3 Pinout and debug port pins
The STM32L1xxx MCU is offered in various packages with different numbers of available
pins. As a result, some functionality related to the pin availability may differ from one
package to another.
$EVELOPMENTBOARD
(OST0# 0OWERSUPPLY
*4!'37CONNECTOR
$EBUGTOOL
AIC
Other manuals for STM32L152-EVAL
1
This manual suits for next models
3
Table of contents
Other ST Motherboard manuals

ST
ST AN3954 Installation and operating instructions

ST
ST STM3241G-EVAL User manual

ST
ST STM3241G-EVAL User manual

ST
ST STM8L101-EVAL User manual

ST
ST SPC560D-DIS User manual

ST
ST STEVAL-ISC004V1 User manual

ST
ST SPC563M64CAL144 User manual

ST
ST STR730-EVAL User manual

ST
ST EVAL-IBD002-35W User manual

ST
ST UM1682 User manual