The STM8L-DISCOVERY helps you to discover the STM8L ultralow power features and to
develop and share your applications. It is based on an STM8L152C6T6 and includes an STLink embedded debug tool interface, LCD (24 segments, 4 commons), LEDs and push
buttons.
The STM8L-DISCOVERY is a low-cost and easy-to-use development kit to quickly evaluate
and start a development with an STM8L ultralow power microcontroller.
Before installing and using the product, please accept the Evaluation Product License
Agreement from www.st.com/stm8l-discovery.
For more information on the STM8L-DISCOVERY and for demonstration software visit
www.st.com/stm8l-discovery.
1.1 Getting started
1.Check jumper positions on the board, JP1 and CN3 ON (Discovery selected).
2. Connect the STM8L-DISCOVERY board to a PC with a USB cable to power the board.
Red LED LD2 (PWR) then lights up.
3. Function 1 is executed and each click on user button B2 changes the executed function
as described in Ta ble 1 .
Table 1.Functions
Function LED LD3/4BarsValue displayed
1BlinkSTM8L VDD voltage measured
2OffSTM8L consumption measured in Run mode
3OffSTM8L consumption measured in Low power mode, LCD on
4OffSTM8L consumption measured in Low power mode, LCD off
5OffSTM8L consumption measured in Halt mode, LCD off
To study or modify the DISCOVER project related to this demo, visit www.st.com/stm8ldiscovery and follow the tutorial. Discover the STM8L features, download and execute
programs proposed in the list of projects. This site also contains examples from which you
can develop your own applications.
1.2 System requirements
●Windows PC (2000, XP, Vista)
●A/Mini-B USB cable
Doc ID 17693 Rev 13/29
Page 4
Quick startUM0970
1.3 Development toolchain
●IAR, Embedded Workbench® for STM8
●STMicroelectronics, ST Visual Develop (STVD)
1.4 Demonstration software
Demonstration software is preloaded in the board's Flash memory. This demonstration uses
the built-in IDD measurement feature of the STM8L-DISCOVERY to automatically measure
and display on the LCD the consumption of the MCU in run and low power modes.
The latest versions of this demonstration source code and associated documentation can
be downloaded from www.st.com/stm8l-discovery.
1.5 Order code
To order the STM8L ultralow power Discovery, use the order code STM8L-DISCOVERY.
4/29Doc ID 17693 Rev 1
Page 5
UM0970Features
2 Features
The STM8L-DISCOVERY offers the following features:
Speed and power consumption independent of MCU power supply, Ultralow leakage
●Ultralow power design (clock gating, low-power Flash with power-off capability):
Reduced overall Run and Wait mode current consumption by turning off clocks of
unused peripherals or Flash
●Sub 1 µA hardware RTC and AWU system unit:
Ultralow power modes for applications requesting regular wake up
●Range of Low power modes (up to 4):
Suitable for many applications from complete switch off to continuous monitoring at
ultralow frequency
●Advanced and flexible clock system (multiple internal and external clock sources):
Switch and adjust frequency and clock sources on the fly depending on application
needs
●Direct memory access on board (4-channel DMA):
Autonomy for peripherals, independent from core; can switch off Flash memory and
CPU (large current consumption contributors) while keeping peripherals active
●Ultralow power and ultrasafe reset system POR/PDR; additional optional activation
BOR:
Integrated safety and security for application
●Ultrafast wakeup from lowest Low power mode (4 µs):
Fast switching from Static and Dynamic power modes
●Analog functional down to 1.8 V, programming down to 1.65 V:
Full functionality over the complete V
For more information see the STM8L152C6T6 datasheet (Doc ID 15962) on the ST website.
DD
range
Doc ID 17693 Rev 19/29
Page 10
Hardware and layoutUM0970
Figure 6.STM8L152C6T6 block diagram
10/29Doc ID 17693 Rev 1
Page 11
UM0970Hardware and layout
3.2 Embedded ST-Link
The ST-Link programming and debugging tool is integrated on the STM8L-DISCOVERY.
The embedded ST-Link can be used in 2 different ways according to the jumper states (see
Ta bl e 2 ):
●to program/debug the MCU on board,
●to program/debug an MCU in an external application board using a cable connected to
SWIM connector CN2.
For information about debugging and programming features refer to ST-Link UM0627.
Note:UM0627 contains information about all the ST-Link features. Usage in this situation is
restricted to STM8 devices and SWIM support.
Figure 7.Typical configuration
Hardware requirements:
- USB cable type A to mini-B
- Computer with Windows 2000, XP or Vista OS
Development toolchain:
- IAR, Embedded Workbench® for STM8L
- STMicroelectronics, ST Visual Develop (STVD)
Table 2.Jumper states
Jumper stateDescription
Both CN3 jumpers ON ST-Link functions enabled for on board programming (default)
Both CN3 jumpers OFF
ST-Link functions enabled for external application through CN2
connector (SWIM supported).
Doc ID 17693 Rev 111/29
Page 12
Hardware and layoutUM0970
3.2.1 Using the ST-Link to program/debug the STM8L on board
To program the STM8L on board, simply plug in the two jumpers on CN3, as shown in
Figure 8 in red, but do not use the CN2 connector as that could disturb communication with
the STM8L152C6T6 of the STM8L-DISCOVERY.
Figure 8.STM8L-DISCOVERY connections image
Jumpers on CN3
3.2.2 Using the ST-Link to program/debug an external STM8L application
It is very easy to use the ST-Link to program the STM8L on an external application. Simply
remove the 2 jumpers from CN3 as shown in Figure 9, and connect your application to the
CN2 debug connector according to Tab l e 3.
Table 3.Debug connector CN2 (SWIM)
PinCN2Designation
1VDD_TARGETVDD from application
2SWIMSWIM data input/output
3GNDGround
4SWIM_RSTSWIM reset
12/29Doc ID 17693 Rev 1
Page 13
UM0970Hardware and layout
Figure 9.ST-Link connections image
No jumpers on CN3
3.3 Power supply and power selection
The power supply is provided either by the host PC through the USB cable, or by external
power supply (5 V or 3.3 V). The D1 and D2 protection diodes allow the 5V and 3V3 pins to
be used independently as input or output power supplies (see Figure 3). The 5V and 3V3
pins can be used as an output power supply for use by an application board connected on
pin headers (P1 to P3). In such a case, the 3V3 pin provides only a 3V power supply and the
power consumption must be lower than 100 mA. The 5V and 3V3 pins can also be used as
an input power supply for the board when the USB connector is not connected to the PC.
3.4 LEDs
●LD1 COM: Red LED indicates communication in progress between PC and ST-Link.
●LD2 PWR: Red LED indicates that the board is powered.
●LD3 PE7: Green LED is a user LED connected to the I/O PE7 of the STM8L152C6T6.
●LD4 PC7: Blue LED is a user LED connected to the I/O PC7 of the STM8L152C6T6.
3.5 Push buttons
●B1 RST: Push button is used to RESET the STM8L152C6T6.
●B2 USER: User push button connected to the I/O PC1 of the STM8L152C6T6.
Doc ID 17693 Rev 113/29
Page 14
Hardware and layoutUM0970
3.6 Built-in IDD measurement circuit
The STM8L-DISCOVERY built-in IDD measurement circuit allows the consumption of the
STM8L152C6T6 to be measured and displayed on the LCD Glass while the MCU is in Run
or Low power saving modes.
●JP1 in ON position: STM8L152C6T6 is powered through I
(default).
●JP1 in OFF position: STM8L152C6T6 is powered directly by +3V3, I
circuit is bypassed.
Note:When jumper JP1 is removed the current consumption of the STM8L152C6T6 can be
measured by connecting an ammeter between jumper JP1 pin 1 and pin 2.
measurement circuit
DD
measurement
DD
For I
measurement by the MCU itself, the circuit below is implemented on the STM8L-
DD
DISCOVERY. Solder bridges SB11, SB12 and SB14 must be closed and a jumper must be
plugged between JP1 pin 2 and pin 3.
Figure 10. STM8L-DISCOVERY I
IDD
VDD_MCU
onoff
5
4
U4
1
MAX9938FEUK+
2
+3V3
3
4
5
2
+3V3
123
R20
2(1%)
JP1
R21
2K(1%)
4
5
126
S
D
T1
G
STT5PF20V
3
measurement circuit
DD
U6
I/O1O/I
4
C
3
GND
74H1G66STR
3
U7
74LX1G04CTR
VCC
2
5
+3V3
1
2
3
4
5
6
7
R18
10K
U3
Q12
VCC
Q13
Q10
Q14
Q8
Q6
Q9
Q5
CLR
Q7
CI
Q4
CO
GND8CO
M74HC4060TTR
R17
0
C11
1uF
+3V3
16
15
14
13
12
11
10
9
C13
1nF
Oscillator frequency 30KHz
T2
3
G
STT5PF20V
C12
100nF
R22
15K
S
D
R23
30K
4
5
1
2
6
+3V3
R26
10K
+3V3
R19
47K
SB11
SB12
SB14
PF0
IDD_Measurement
PE6
IDD_WAKEUP
PC4
IDD_CNT_EN
3.6.1 Run mode
In Run mode, IDD current is measured using the operational amplifier MAX9938FEUK+ (U4)
connected to the 2Ω shunt resistor (R20). In this case IDD_CNT_EN remains high during
measurement, so R21 remains in short-circuit during the measurement because of transitor
T1 which remains ON permanently. The jumper JP1 must be connected between pins 2 and
3 of JP1.
3.6.2 Low power mode
In Low power modes (Halt or Active halt), the operational amplifier MAX9938FEUK+ (U4) is
connected to the 2KΩ shunt resistor (R21), controlled by the analogue switch STT5PF20V
(T1). In this case the counter 74HC4060 (U3) enabled by IDD_CNT_EN manages the
measurement timing according to Figure 11.
14/29Doc ID 17693 Rev 1
Page 15
UM0970Hardware and layout
3.6.3 Low power mode IDD measurement principle
The principle used to measure a current when the STM8L152C6T6 is in Low power mode is:
1.Configure ADC to measure voltage on the IDD_Measurement pin.
2. Configure PE6 to serve as wakeup pin.
3. Enter Low power mode after setting IDD_CNT_EN (PC4) signal low.
4. IDD_WAKEUP rising edge wakes up the MCU after around 300 ms.
5. Start ADC conversion as soon as possible after wakeup in order to measure the
voltage corresponding to Low power mode on capacitor C11.
6. Reset the counter by programming IDD_CNT_EN high (in less than 70 ms after the
wakeup) to avoid the R21 2 KΩ resistor being connected later in Run mode.
The measurement timing is given in Figure 11. In Low power modes, the 2 KΩ resistor is
connected when T1 goes off after entering Low power mode. Q13 output of the counter
allows connection of the 2 KΩ resistor when the current I
Figure 11 shows how the counter and T1 ensure that, 150 ms after IDD_CNT_EN falling
edge, the shunt resistor R21 is connected between VDD_MCU and the power supply in
order to reduce the measurement range to 30 uA full scale. Then after another 150 ms for
current stabilization, R21 is shorted, the IDD measurement is stored in C11, and the MCU is
woken up. After wakeup the MCU can measure the IDD current corresponding to the Low
power mode stored in C11.
becomes very low.
DD
Figure 11. STM8L-DISCOVERY I
The Low power mode measurement procedure can be used in Halt or Active halt mode if the
current does not exceed 30 uA, otherwise the I
I
DD
should be used up to 30 mA.
Low power mode measurement timing diagram
DD
measurement procedure in Run mode
DD
Doc ID 17693 Rev 115/29
Page 16
Hardware and layoutUM0970
3.6.4 Ibias current measurement procedure
In Low power mode the bias current of operational amplifier input (U4 pin 4) is not negligible
compared to I
measurement it is mandatory to subtract the bias current from the I
current (typical Ibias is ~240 nA). To obtain a reliable STM8L152 IDD
DD
low power
DD
measurement since this current is not sinked by the MCU. Ibias is measured during
production test and stored in the MCU EPROM. The demonstration software, Discover, uses
this value to display the correct I
. The Ibias measurement procedure is part of the
DD
demonstration software and can be launched if required.
The procedure for Ibias measurement (implemented in the Demo) is:
1.Power off the board (disconnect the USB cable).
2. Set jumper JP1 to OFF position (pins 1 and 2).
3. Push down B2 (USER button), power on the board from the USB.
4. Wait at least 1 second before releasing B2, the LCD displays the Ibias measurement.
5. Power off the board (disconnect the USB cable).
6. Set jumper JP1 to ON position (pins 2 and 3). The Ibias value is now stored. The bias
current is then subtracted from the I
measurement performed in Low power mode.
DD
3.7 Solder bridges
Table 4.Solder bridge
BridgeState
SB1,2
(X2 crystal)
SB3,5,7,9
(DEFAULT)
SB4,6,8,10
(PRG-32)
SB11,12,14
(IDD_Measurement)
SB13,15
(X3 crystal)
SB16
(B1-RESET)
SB17
(B2-USER)
1. Default state is in bold type.
Off
On PA2, PA3 are connected to P1 (X2, C19, C20, R24 must not be fitted)
On Reserved, do not modify
Off Reserved, do not modify
Off
On
Off PC5, PC6 are only connected to P2 (but do not remove X3, C21, C23, R27)
On PC5, PC6 are connected to P2. X3, C21, C23 and R27 provide 32 KHz clock
Off PA1/RESET signal is only connected to P1
OnPA1/RESET signal is used by ST_LINK as SWIM_RST and also connected to P1
Off PC1 is only connected to P2
On PC1 is connected to P2 and push button B2 for user
(1)
PA2, PA3 are disconnected from P1
X2, C19, C20 and R24 provide a clock as shown in schematics
PFO, PE6, PC4 are available and IDD module cannot be used
JP1 must be set to OFF
PFO, PE6, PC4 are used by IDD module
JP1 must be set to ON
Description
16/29Doc ID 17693 Rev 1
Page 17
UM0970Hardware and layout
3.8 LCD (24 segments, 4 commons)
This LCD allows the STM8L152C6T6 to display any information on six 14-segment digits
and 4 BARs, using all COMs. (See the LCD segment mapping in Figure 12 and pin
connections in Ta bl e 5 .)
Note:This LCD also supports six 8-segment digits by only using COM0 and COM1.
This configuration allows COM2 and COM3 to be used as I/O ports. In this case the 2 LCD
pins must not be plugged into the LCD socket. To proceed with this configuration, remove
the LCD carefully, slightly open the COM2 and COM3 pins (pin 13 and pin 14) of the LCD,
then replug it in the socket.
Characteristics overview:
●24 segments and 4 commons
●Drive method: multiplexed 1/4 duty, 1/3 bias
●Operating voltage: 3 V
●Operating temperature: 0 to 50°C
●Connector: 28-pin DIL 2.54 mm pitch
Note:When the LCD is plugged, all I/O ports listed in Tabl e 5 are unavailable. To use one of these
as I/O, you must remove the LCD.
Figure 12. LCD segment mapping
Doc ID 17693 Rev 117/29
Page 18
Hardware and layoutUM0970
Table 5.LCD connections
STM8L152C6T6 LCD
Pin namePinCOM3COM2COM1COM0
PA7_LCDSEG011N1P1D1E
PE0_LCDSEG121DP1COLON1C1M
PE1_LCDSEG232N2P2D2E
PE2_LCDSEG342DP2COLON2C2M
PE3_LCDSEG453N3P3D3E
PE4_LCDSEG563DP3COLON3C3M
PE5_LCDSEG674N4P4D4E
PD0_LCDSEG784DP4COLON4C4M
PD2_LCDSEG895N5P5D5E
PD3_LCDSEG910BAR2BAR35C5M
PB0_LCDSEG10116N6P6D6E
PB1_LCDSEG1112BAR0BAR16C6M
PD1_LCDCOM313COM3
PA6_LCDCOM214COM2
PA5_LCDCOM115COM1
PA4_LCDCOM016COM0
PB2_LCDSEG12176J6K6A6B
PB3_LCDSEG13186H6Q6F6G
PB4_LCDSEG14195J5K5A5B
PB5_LCDSEG15205H5Q5F5G
PB6_LCDSEG16214J4K4A4B
PB7_LCDSEG17224H4Q4F4G
PD4_LCDSEG18233J3K3A3B
PD5_LCDSEG19243H3Q3F3G
PD6_LCDSEG20252J2K2A2B
PD7_LCDSEG21262H2Q2F2G
PC2_LCDSEG22271J1K1A1B
PC3_LCDSEG23281H1Q1F1G
18/29Doc ID 17693 Rev 1
Page 19
Extension connectionUM0970
4 Extension connection
Male headers P1, P2 and P3 can connect the STM8L-DISCOVERY to a standard
prototyping/wrapping board. All GPI/Os of STM8L152C6T6 are available on it.
P1, P2 and P3 can also be probed by an oscilloscope, logical analyzer or voltmeter.
Table 6.P1 pinout
Pin number
(P1)
1+3V3
21PA0I/O Port A0
39/40GNDGround
42PA1I/O Reset NRST/PA1(1)
53PA2I/O Port A2
64PA3I/O Port A3
75PA4I/O Port A4
86PA5I/O Port A5
97PA6I/O Port A6
Pin number
(STM8L)
Board pin
name
function
Type
Main
3.3 V board power
supplied or supply
external application when
USB connected
PA0/[USART1_CK](3)/
SWIM/BEEP/
IR_TIM (7)
PA 2/ OS C _ IN /
[USART1_TX](3)/
[SPI1_MISO] (3)
PA 3/ OS C _ OU T /
[USART1 _RX](3)/
[SPI1_MOSI](3)
Jumpers ON --> DISCOVERY Selected
Jumpers OFF --> ST-LINK Selected
ST_LINK_LED
BAT60JFILM
C2
100nF
PRG-32
STM_JTCK
STM_JTMS
4
ST-LINK
R8
510
D1
R1
1K
+3V3EXT_3V3
STMicroelectronics
Title:
STM8L-DISCOVERY ST-LINK (SWIM only)
Number:Rev:Sheet of
MB91555
B.2(PCB.SCH)
Date:
7/15/2010
ST_LINK_SWIM
RESET#
+3V3
SWCLK
SWDIO
COM
LD1
RED
PWR
LD2
RED
UM0970Electrical schematics
Page 28
Revision historyUM0970
6 Revision history
Table 9.Document revision history
DateRevisionChanges
24-Sep-2010
1
Initial release.
28/29Doc ID 17693 Rev 1
Page 29
UM0970
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 AN AUTHORIZED ST REPRESENTATIVE, 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.