Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
June 2011 Doc ID 17693 Rev 2 1/30
UM0970User Manual
STM8L-DISCOVERY
IntroductionThe 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 ST-Link embedded debug tool interface, LCD (24 segments, 4 commons), LEDs and push buttons.
Figure 1. STM8L-DISCOVERY board
www.st.com
Contents UM0970
2/30 Doc ID 17693 Rev 2
Contents
1 Quick start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1 Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Development toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Demonstration software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Order code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 Hardware and layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1 STM8L152C6T6 microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Embedded ST-Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2.1 Using the ST-Link to program/debug the STM8L on board . . . . . . . . . . 12
3.2.2 Using the ST-Link to program/debug an external STM8L application . . 12
3.3 Power supply and power selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4 LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.5 Push buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.6 Built-in IDD measurement circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.6.1 Run mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.6.2 Low power mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.6.3 Low power mode IDD measurement principle . . . . . . . . . . . . . . . . . . . . 15
3.6.4 Ibias current measurement procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.7 Solder bridges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.8 LCD (24 segments, 4 commons) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4 Extension connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5 Mechanical drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6 Electrical schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
UM0970 Quick start
Doc ID 17693 Rev 2 3/30
1 Quick start
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.
For more information on the STM8L-DISCOVERY and for demonstration software visit www.st.com/stm8l-discovery.
1.1 Getting started1. 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 Table 1.
To study or modify the DISCOVER project related to this demo, visit www.st.com/stm8l-discovery 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
Table 1. Functions
Function LED LD3/4 Bars Value displayed
1 Blink STM8L VDD voltage measured
2 Off STM8L consumption measured in Run mode
3 Off STM8L consumption measured in Low power mode, LCD on
4 Off STM8L consumption measured in Low power mode, LCD off
5 Off STM8L consumption measured in Halt mode, LCD off
Quick start UM0970
4/30 Doc ID 17693 Rev 2
1.3 Development toolchain● IAR, Embedded Workbench® for STM8
● STMicroelectronics, ST Visual Develop (STVD)
1.4 Demonstration softwareDemonstration 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 codeTo order the STM8L ultralow power Discovery, use the order code STM8L-DISCOVERY.
UM0970 Features
Doc ID 17693 Rev 2 5/30
2 Features
The STM8L-DISCOVERY offers the following features:
● STM8L152C6T6 microcontroller, 32 KB Flash, 2 KB RAM, 1 KB EEPROM in 48-pin LQFP
● On-board ST-Link with selection mode switch to use the kit as a stand-alone ST-Link (with SWIM connector for programming and debugging)
● Two red LEDs; LD1 for USB communication, LD2 for 3.3 V power on
● Designed to be powered by USB or an external supply of 5 V or 3.3 V
● Can supply target application with 5 volts and 3 volts
● Two user LEDs, LD3 and LD4 (green and blue)
● Two push buttons (User and Reset)
● IDD current measurement
● LCD 28-pin DIP (24 segments, 4 commons)
● Extension header for all QFP48 I/Os for quick connection to prototyping board for easy probing
Hardware and layout UM0970
6/30 Doc ID 17693 Rev 2
3 Hardware and layout
The STM8L-DISCOVERY is designed around the STM8L152C6T6 microcontroller in a 48-pin LQFP package.
Figure 2 illustrates the connections between the STM8L152C6T6 and its peripherals (ST-Link, push button, LED, LCD and connectors).
Figure 3 and Figure 4 help you to locate these features on the STM8L-DISCOVERY.
Figure 2. Hardware block diagram
Blue LEDLD4
B2USER
I/O
MiniUSB
Green LEDLD3
B1RST
RESET
I/OI/O
P1
Hea
der
P3
Hea
der
P2 Header
SW
IM
LCD (24 segments, 4 commons)
IDDmeasurement
Embedded ST-LINK
STM8L152C6T6
UM0970 Hardware and layout
Doc ID 17693 Rev 2 7/30
Figure 3. Top layout
ST-Link
LCD 24 segments
IDD measurement
STM8L152C6T6
B2
CN2
JP1
LD3LD4
B1
CN3
IDD module
LD1
LD2
User button
LED blue
Reset button
LED green
SWIM connector
COM
power
SB1,2X2 crystal
D2 diodeD1 diode
ST-Link/Discoveryselector
+3.3V power supplyinput
+5V power supplyinput
Hardware and layout UM0970
8/30 Doc ID 17693 Rev 2
Figure 4. Bottom layout
P1
P2
SB4,6,8,10
PRG-32SB3,5,7,9
DEFAULT
SB11,12,14
SB13,15
SB16
SB17
P3
IDD_Measurement
B2-USER
B1-RESET
X3 crystal
connector
connector
connector
JP1IDD
(RESERVED)
UM0970 Hardware and layout
Doc ID 17693 Rev 2 9/30
3.1 STM8L152C6T6 microcontrollerThis 8-bit ultralow power MCU has 32 KB Flash, 2 KB RAM, 1 KB data EEPROM, RTC, LCD, timers, USART, I2C, SPI, ADC, DAC and comparators.
Figure 5. STM8L152C6T6 package
This device provides the following benefits:
● Ultralow power proprietary 130 nm technology: 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 VDD range
For more information see the STM8L152C6T6 datasheet (Doc ID 15962) on the ST website.
The STM8L152C6T6 8-bit microcontroller offers:
2 Kbytes RAM32 Kbytes of Flash memory
LQFP48 7 x 7 mm
1 Kbytes EEPROM
Hardware and layout UM0970
10/30 Doc ID 17693 Rev 2
Figure 6. STM8L152C6T6 block diagram
UM0970 Hardware and layout
Doc ID 17693 Rev 2 11/30
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 Table 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
Table 2. Jumper states
Jumper state Description
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).
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)
Hardware and layout UM0970
12/30 Doc ID 17693 Rev 2
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
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 Table 3.
Jumpers on CN3
Table 3. Debug connector CN2 (SWIM)
Pin CN2 Designation
1 VDD_TARGET VDD from application
2 SWIM SWIM data input/output
3 GND Ground
4 SWIM_RST SWIM reset
UM0970 Hardware and layout
Doc ID 17693 Rev 2 13/30
Figure 9. ST-Link connections image
3.3 Power supply and power selectionThe 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.
Note: If an external power supply is used, it must conform to EN 60950-1 SELV (safety extra low voltage) LPS (limited power source) definitions.
If the 5V and 3V3 pins are used as an input power supply, the STM8L-DISCOVERY board must be powered by a power supply unit or auxiliary equipment complying with standard EN-60950-1: 2006+A11/2009, and must be safety extra low voltage (SELV) with limited power capability.
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.
No jumpers on CN3
Hardware and layout UM0970
14/30 Doc ID 17693 Rev 2
3.6 Built-in IDD measurement circuitThe 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 IDD measurement circuit (default).
● JP1 in OFF position: STM8L152C6T6 is powered directly by +3V3, IDD measurement 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.
For IDD measurement by the MCU itself, the circuit below is implemented on the STM8L-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 IDD measurement circuit
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 transistor T1 which remains ON permanently. The jumper JP1 must be connected between pins 2 and 3 of JP1. The measurement range in this case can be up to 30 mA.
3.6.2 Low power mode
In Low power modes (Halt or Active halt), IDD current is measured using the operational amplifier MAX9938FEUK+ (U4) 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. The measurement range in this case can be up to 30 µA.
R1947K
IDD_Measurement
IDD_CNT_EN
IDD_WAKEUP
2
3
4
5
U774LX1G04CTR
I/O1 O/I 2
GND3 C4
VCC 5
U6
74H1G66STR+3V3R20
2(1%)
R21
2K(1%)
3
4 5
G
S D
1 2 6
T1STT5PF20V
3
4
5G
SD 1
26
T2
STT5PF20V
+3V3
Q121
Q132
Q143
Q64
Q55
Q76
Q47
GND8 CO 9CO 10CI 11CLR 12Q9 13Q8 14Q10 15VCC 16U3
M74HC4060TTR
+3V3+3V3
R2610K
R18
10K C111uF +3V3
VDD_MCU
12
3 JP1
C131nF
R2215K
R2330K
Oscillator frequency 30KHz
+3V3
R17
0
PF0
PE6
PC4
C12100nF
4
5
2
3
1 U4MAX9938FEUK+
SB11
SB12
SB14
IDD
onoff
UM0970 Hardware and layout
Doc ID 17693 Rev 2 15/30
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 IDD becomes very low.
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 (instead of 30 mA in Run mode). 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.
Figure 11. STM8L-DISCOVERY IDD Low power mode measurement timing diagram
Hardware and layout UM0970
16/30 Doc ID 17693 Rev 2
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 IDD current (typical Ibias is ~240 nA). To obtain a reliable STM8L152 IDD measurement it is mandatory to subtract the bias current from the IDD low power 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 IDD. The Ibias measurement procedure is part of the 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 IDD measurement performed in Low power mode.
3.7 Solder bridgesTable 4. Solder bridge
Bridge State(1)
1. Default state is in bold type.
Description
SB1,2(X2 crystal)
Off PA2, PA3 are disconnected from P1 X2, C19, C20 and R24 provide a clock as shown in schematics
On PA2, PA3 are connected to P1 (X2, C19, C20, R24 must not be fitted)
SB3,5,7,9 (DEFAULT)
On Reserved, do not modify
SB4,6,8,10(PRG-32)
Off Reserved, do not modify
SB11,12,14(IDD_Measurement)
Off PFO, PE6, PC4 are available and IDD module cannot be usedJP1 must be set to OFF
On PFO, PE6, PC4 are used by IDD moduleJP1 must be set to ON
SB13,15(X3 crystal)
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
SB16(B1-RESET)
Off PA1/RESET signal is only connected to P1
On PA1/RESET signal is used by ST_LINK as SWIM_RST and also connected to P1
SB17(B2-USER)
Off PC1 is only connected to P2
On PC1 is connected to P2 and push button B2 for user
UM0970 Hardware and layout
Doc ID 17693 Rev 2 17/30
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 Table 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 Table 5 are unavailable. To use one of these as I/O, you must remove the LCD.
Figure 12. LCD segment mapping
Hardware and layout UM0970
18/30 Doc ID 17693 Rev 2
Table 5. LCD connections
STM8L152C6T6 LCD
Pin name Pin COM3 COM2 COM1 COM0
PA7_LCDSEG0 1 1N 1P 1D 1E
PE0_LCDSEG1 2 1DP 1COLON 1C 1M
PE1_LCDSEG2 3 2N 2P 2D 2E
PE2_LCDSEG3 4 2DP 2COLON 2C 2M
PE3_LCDSEG4 5 3N 3P 3D 3E
PE4_LCDSEG5 6 3DP 3COLON 3C 3M
PE5_LCDSEG6 7 4N 4P 4D 4E
PD0_LCDSEG7 8 4DP 4COLON 4C 4M
PD2_LCDSEG8 9 5N 5P 5D 5E
PD3_LCDSEG9 10 BAR2 BAR3 5C 5M
PB0_LCDSEG10 11 6N 6P 6D 6E
PB1_LCDSEG11 12 BAR0 BAR1 6C 6M
PD1_LCDCOM3 13 COM3
PA6_LCDCOM2 14 COM2
PA5_LCDCOM1 15 COM1
PA4_LCDCOM0 16 COM0
PB2_LCDSEG12 17 6J 6K 6A 6B
PB3_LCDSEG13 18 6H 6Q 6F 6G
PB4_LCDSEG14 19 5J 5K 5A 5B
PB5_LCDSEG15 20 5H 5Q 5F 5G
PB6_LCDSEG16 21 4J 4K 4A 4B
PB7_LCDSEG17 22 4H 4Q 4F 4G
PD4_LCDSEG18 23 3J 3K 3A 3B
PD5_LCDSEG19 24 3H 3Q 3F 3G
PD6_LCDSEG20 25 2J 2K 2A 2B
PD7_LCDSEG21 26 2H 2Q 2F 2G
PC2_LCDSEG22 27 1J 1K 1A 1B
PC3_LCDSEG23 28 1H 1Q 1F 1G
Extension connection UM0970
19/30 Doc ID 17693 Rev 2
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)
Pin number(STM8L)
Board pin name Ty
pe Main
functionAlternate function LCD (U5)
1 +3V3
3.3 V board power supplied or supply external application when USB connected
2 1 PA0 I/O Port A0 PA0/[USART1_CK](3)/ SWIM/BEEP/IR_TIM (7)
3 9/40 GND Ground
4 2 PA1 I/O Reset NRST/PA1(1)
5 3 PA2 I/O Port A2 PA2/OSC_IN/[USART1_TX](3)/[SPI1_MISO] (3)
6 4 PA3 I/O Port A3 PA3/OSC_OUT/[USART1 _RX](3)/[SPI1_MOSI](3)
7 5 PA4 I/O Port A4
PA4/TIM2_BKIN/ LCD_COM0(2)/ADC1_IN2/COMP1_INP
LCD_COM0
8 6 PA5 I/O Port A5
PA5/TIM3_BKIN/ LCD_COM1(2)/ADC1_IN1/COMP1_INP
LCD_COM1
9 7 PA6 I/O Port A6
PA6/[ADC1_TRIG](3)/LCD_COM2(2)/ADC1_IN0/ COMP1_INP
LCD_COM2
10 8 PA7 I/O Port A7 PA7/LCD_SEG0(2)(4)
LCD_SEG0
11 14 PE0 I/O Port E0 PE0(4)/LCD_SEG1(2)
LCD_SEG1
12 15 PE1 I/O Port E1 PE1/TIM1_CH2N / LCD_SEG2(2)
LCD_SEG2
13 16 PE2 I/O Port E2 PE2/TIM1_CH3N / LCD_SEG3(2)
LCD_SEG3
14 17 PE3 I/O Port E3 PE3/LCD_SEG4(2) LCD_SEG4
15 18 PE4 I/O Port E4 PE4/LCD_SEG5(2) LCD_SEG5
UM0970 Extension connection
Doc ID 17693 Rev 2 20/30
16 19 PE5 I/O Port E5
PE5/LCD_SEG6(2)/ ADC1_IN23/ COMP2_INP/ COMP1_INP
LCD_SEG6
17 20 PD0 I/O Port D0
PD0/TIM3_CH2/ [ADC1_TRIG](3)/ LCD_SEG7(2)/ADC1_IN2 2/COMP2_INP/ COMP1_INP
LCD_SEG7
18 21 PD1 I/O Port D1
PD1/TIM3_TRIG/ LCD_COM3(2)/ ADC1_IN21/COMP2_INP/ COMP1_INP
LCD_COM3
19 9/40 GND Ground
Table 7. P2 pinout
Pin number(P2)
Pin number(STM8L)
Pin name
Typ
e Main function
Alternate function LCD (U5)
1 +5V
5 Volts board power supplied or supply external application when USB connected
2 NC
3 9/40 GND Ground
4 48 PE7 I/O Port E7 PE7/LCD_SEG27(2)
5 47 PE6 I/O Port E6 PE6/LCD_SEG26(2)/ PVD_IN
6 46 PC7 I/O Port C7
PC7/LCD_SEG25(2)/ ADC1_IN3/COMP2_INM/ COMP1_INP
7 45 PC6 I/O Port C6 PC6/OSC32_OUT/ [SPI1_SCK](3)/ [USART1_RX](3)
8 44 PC5 I/O Port C5 PC5/OSC32_IN /[SPI1_NSS](3)/ [USART1_TX](3)
9 43 PC4 I/O Port C4
PC4/[USART1_CK](3)/ I2C1_SMB/CCO/ LCD_SEG24(2)/ ADC1_IN4/COMP2_INM/ COMP1_INP
Table 6. P1 pinout (continued)
Pin number(P1)
Pin number(STM8L)
Board pin name Ty
pe Main
functionAlternate function LCD (U5)
UM0970 Extension connection
Doc ID 17693 Rev 2 21/30
10 42 PC3 I/O Port C3
PC3/[USART1_TX](3)/ LCD_SEG23(2)/ ADC1_IN5/COMP1_INP/ COMP2_INM
LCD_SEG23
11 41 PC2 I/O Port C2
PC2/[USART1_RX](3)/ LCD_SEG22/ADC1_IN6/ COMP1_INP/VREF_OUT
LCD_SEG22
12 38 PC1 I/O Port C1 PC1(4)/I2C1_SCL
13 37 PC0 I/O Port C0 PC0(4)/I2C1_SDA
14 36 PD7 I/O Port D7
PD7/TIM1_CH1N /LCD_SEG21(2)/ ADC1_IN7/RTC_ALARM/ VREF_OUT/ COMP1_INP
LCD_SEG21
15 35 PD6 I/O Port D6
PD6/TIM1_BKIN /LCD_SEG20(2)/ ADC1_IN8/RTC_CALIB/ VREF_OUT/ COMP1_INP
LCD_SEG20
16 34 PD5 I/O Port D5
PD5/TIM1_CH3 /LCD_SEG19(2)/ ADC1_IN9/COMP1_INP
LCD_SEG19
17 33 PD4 I/O Port D4
PD4/TIM1_CH2 /LCD_SEG18(2)/ ADC1_IN10/COMP1_INP
LCD_SEG18
18 32 PF0 I/O Port F0 PF0/ADC1_IN24/ DAC_OUT
19 9/40 GND Ground
Table 7. P2 pinout (continued)
Pin number(P2)
Pin number(STM8L)
Pin name
Typ
e Main function
Alternate function LCD (U5)
Extension connection UM0970
22/30 Doc ID 17693 Rev 2
Table 8. P3 pinout
Pin number(P3)
Pin number(STM8L)
Pin name
Typ
e Main function
Alternate function LCD (U5)
1 22 PD2 I/O Port D2
PD2/TIM1_CH1 /LCD_SEG8(2)/ ADC1_IN20/COMP1_INP
LCD_SEG8
2 23 PD3 I/O Port D3
PD3/ TIM1_TRIG/ LCD_SEG9(2)/ADC1_IN1 9/COMP1_INP
LCD_SEG9
3 24 PB0 I/O Port B0
PB0/TIM2_CH1/ LCD_SEG10(2)/ ADC1_IN18/COMP1_INP
LCD_SEG10
4 25 PB1 I/O Port B1
PB1/TIM3_CH1/ LCD_SEG11(2)/ ADC1_IN17/COMP1_INP
LCD_SEG11
5 26 PB2 I/O Port B2
PB2/ TIM2_CH2/ LCD_SEG12(2)/ ADC1_IN16/COMP1_INP
LCD_SEG12
6 27 PB3 I/O Port B3
PB3/TIM2_TRIG/ LCD_SEG13(2)/ ADC1_IN15/COMP1_INP
LCD_SEG13
7 28 PB4 I/O Port B4
PB4/[SPI1_NSS](3)/ LCD_SEG14(2)/ ADC1_IN14/COMP1_INP
LCD_SEG14
8 29 PB5 I/O Port B5
PB5/[SPI1_SCK](3)/ LCD_SEG15(2)/ ADC1_IN13/COMP1_INP
LCD_SEG15
9 30 PB6 I/O Port B6
PB6/[SPI1_MOSI](3)/ LCD_SEG16(2)/ ADC1_IN12/COMP1_INP
LCD_SEG16
10 31 PB7 I/O Port B7
PB7/[SPI1_MISO](3)/ LCD_SEG17(2)/ ADC1_IN11/COMP1_INP
LCD_SEG17
Mechanical drawing UM0970
23/30 Doc ID 17693 Rev 2
5 Mechanical drawing
Figure 13. STM8L-DISCOVERY
UM
0970E
lectrical schem
atics
Doc ID
17693 Rev 2
24/30
6 Electrical schematics
Figure 14. STM8L-DISCOVERY
STMicroelectronicsTitle:
Number: Rev: Sheet ofB.2(PCB.SCH) Date:7/15/2010MB913 1 5
STM8L-DISCOVERY
PC3_LCDSEG23PC2_LCDSEG22PD7_LCDSEG21PD6_LCDSEG20PD5_LCDSEG19PD4_LCDSEG18PB7_LCDSEG17PB6_LCDSEG16PB5_LCDSEG15PB4_LCDSEG14PB3_LCDSEG13PB2_LCDSEG12PB1_LCDSEG11PB0_LCDSEG10PD3_LCDSEG9PD2_LCDSEG8PD0_LCDSEG7PE5_LCDSEG6PE4_LCDSEG5PE3_LCDSEG4PE2_LCDSEG3PE1_LCDSEG2PE0_LCDSEG1PA7_LCDSEG0
PA6_LCDCOM2PA5_LCDCOM1PA4_LCDCOM0
PD1_LCDCOM3
PD[0..7]PE[0..7]PF0
RESET#ST_LINK_SWIM
PC[0..7]PB[0..7]PA[0..7]
IDD_CNT_ENIDD_MeasurementIDD_WAKEUP
U_MCUMCU.SchDoc
RESET#ST_LINK_SWIM
EXT_5VEXT_3V3
U_ST_LINKST_LINK.SCHDOC
PA4PA5PA6PA7
PA0
PA3PA2
RESET#
EXT_5V
EXT_3V3
IDD_MeasurementIDD_CNT_EN
ST_LINK_SWIM
PB[0..7]PC[0..7]PD[0..7]
IDD_WAKEUP
PF0PE[0..7]
PA[0..7] PC3_LCDSEG23PC2_LCDSEG22PD7_LCDSEG21PD6_LCDSEG20PD5_LCDSEG19PD4_LCDSEG18PB7_LCDSEG17PB6_LCDSEG16PB5_LCDSEG15PB4_LCDSEG14PB3_LCDSEG13PB2_LCDSEG12PB1_LCDSEG11PB0_LCDSEG10
PD2_LCDSEG8PD3_LCDSEG9
PD0_LCDSEG7
PA7_LCDSEG0PE0_LCDSEG1PE1_LCDSEG2PE2_LCDSEG3PE3_LCDSEG4PE4_LCDSEG5PE5_LCDSEG6
PA4_LCDCOM0PA5_LCDCOM1PA6_LCDCOM2PD1_LCDCOM3
U_PowerGH08172_buttons.SchDoc
IDD_MeasurementIDD_CNT_EN
IDD_WAKEUP
U_PowerIDD_measurement.SchDoc
123456789
10
P3
Header 10
123456789
10111213141516171819
P1
Header 19
12345678910111213141516171819
P2
Header 19
RESET#ST_LINK_SWIMIDD_Measurement
IDD_CNT_EN
IDD_WAKEUP EXT_5VEXT_3V3
PA1
PE0PE1PE2PE3PE4PE5PD0PD1 PD2
PD3PB0PB1PB2PB3PB4PB5PB6PB7
PF0PD4PD5PD6PD7PC0PC1PC2PC3PC4PC5PC6PC7PE6PE7
RST
Electrical sch
ematics
UM
0970
25/30D
oc ID 17693 R
ev 2
Figure 15. LCD
STMicroelectronicsTitle:
Number: Rev: Sheet ofB.2(SCH.PCB) Date:7/15/2010MB915 2 5
STM8L-DISCOVERY LCD
LCD
11
22
33
44
55
66
77
88
99
1010
1111
1212
COM3
13
COM2
14COM1
15
COM0
16
1717
1818
1919
2020
2121
2222
2323
2424
2525
2626
2727
2828
U5GH08172T
PB3_LCDSEG13PB2_LCDSEG12
PB1_LCDSEG11
PB6_LCDSEG16PB5_LCDSEG15
PB4_LCDSEG14
PC3_LCDSEG23PC2_LCDSEG22
PD7_LCDSEG21PD6_LCDSEG20
PB7_LCDSEG17
PD5_LCDSEG19PD4_LCDSEG18
PA4_LCDCOM0PA5_LCDCOM1
PA6_LCDCOM2PA7_LCDSEG0PE0_LCDSEG1
PE1_LCDSEG2PE2_LCDSEG3
PE3_LCDSEG4PE4_LCDSEG5
PE5_LCDSEG6 PD0_LCDSEG7
PD1_LCDCOM3
PD2_LCDSEG8PD3_LCDSEG9
PB0_LCDSEG10
UM
0970E
lectrical schem
atics
Doc ID
17693 Rev 2
26/30
Figure 16. IDD measurement
STMicroelectronicsTitle:
Number: Rev: Sheet B.2(SCH.PCB) Date:7/15/2010MB915 3
STM8L-DISCOVERY IDD_Measurement
R1947K
IDD_Measurement
IDD_CNT_EN
IDD_WAKEUP
2
3
4
5
U774LX1G04CTR
I/O1 O/I 2
GND3 C4
VCC 5
U6
74H1G66STR+3V3R20
2(1%)
R21
2K(1%)
3
4 5
G
S D
1 2 6
T1STT5PF20V
3
4
5G
SD 1
26
T2
STT5PF20V
+3V3
Q121
Q132
Q143
Q64
Q55
Q76
Q47
GND8 CO 9CO 10CI 11CLR 12Q9 13Q8 14Q10 15VCC 16U3
M74HC4060TTR
+3V3+3V3
R2610K
R18
10K C111uF +3V3
VDD_MCU
12
3 JP1
C131nF
R2215K
R2330K
Oscillator frequency 30KHz
+3V3
R17
0
PF0
PE6
PC4
C12100nF
4
5
2
3
1 U4MAX9938FEUK+
SB11
SB12
SB14
IDD
onoff
Electrical sch
ematics
UM
0970
27/30D
oc ID 17693 R
ev 2
Figure 17. STM8L MCU
SWIM
LEDSTMicroelectronicsTitle:
Number: Rev: Sheet ofB.2(PCB.SCH) Date:7/15/2010MB915 4 5
STM8L-DISCOVERY MCU
LD3
green
R28
330
LD4
blue
R29
660
PA4_LCDCOM0
1 432
B1RESET (Black) C24
100nF
RESET#
C19
20pF
C20
20pFX216MHz
R24
60
41
32
X3
MC306-G-06Q-32.768 (manufacturer JFVNY)
C216.8pF
C236.8pF
VDD_MCUVDDA
VDD_MCU
PA0PA1
PA2
PA3PA4PA5PA6PA7
PE0PE1PE2PE3PE4PE5PD0PD1PD2PD3PB0 PB1
PB2PB3PB4PB5PB6PB7PF0PD4PD5PD6PD7PC0PC1
PC2PC3PC4PC5PC6PC7PE6PE7
C16100nF
VDD_MCU
C17100nF
L1
BEAD C141uF
C15100nF
VDDA
PA5_LCDCOM1PA6_LCDCOM2PA7_LCDSEG0
PE0_LCDSEG1PE1_LCDSEG2PE2_LCDSEG3PE3_LCDSEG4PE4_LCDSEG5PE5_LCDSEG6PD0_LCDSEG7PD1_LCDCOM3PD2_LCDSEG8PD3_LCDSEG9PB0_LCDSEG10
PB3_LCDSEG13PB2_LCDSEG12PB1_LCDSEG11
PB6_LCDSEG16PB5_LCDSEG15PB4_LCDSEG14
PC3_LCDSEG23PC2_LCDSEG22
PD7_LCDSEG21PD6_LCDSEG20
PB7_LCDSEG17
PD5_LCDSEG19PD4_LCDSEG18
PA[0..7] PA[0..7]
PE[0..7] PE[0..7]
PD[0..7] PD[0..7]
PB[0..7] PB[0..7]
PF0 PF0
PC[0..7] PC[0..7]
C221uF
C181uF
PA01
PA12
PA23
PA34
PA45
PA56
PA67
PA78
AVSS9
VDD10
VDDA11
VREF+12
VLCD13
PE014
PE115
PE216
PE317
PE418
PE519
PD020
PD121
PD222
PD323
PB024 PB1 25PB2 26PB3 27PB4 28PB5 29PB6 30PB7 31PF0 32PD4 33PD5 34PD6 35PD7 36PC0 37PC1 38VDDIO 39VSSIO 40PC2 41PC3 42PC4 43PC5 44PC6 45PC7 46PE6 47PE7 48U8
STM8L152C6T6
RESET#
ST_LINK_SWIM
IDD_Measurement
PE7
PC7
IDD_WAKEUP
IDD_CNT_EN
R25
0VDD_MCU
User Button
1 432
B2USER (Blue) C25
100nF
SB2
SB1
SB16
SB17
Not Fitted
Must be close to the Crystal and ON
SB13SB15
R270 Must be close to the Crystal and ON
RESET
R304K7
+3V3
User_PB
Not Fitted
UM
0970E
lectrical schem
atics
Doc ID
17693 Rev 2
28/30
Figure 18. ST-Link (SWIM only)
STMicroelectronicsTitle:
Number: Rev: Sheet ofB.2(PCB.SCH) Date:7/15/2010
VBAT1
PC132
PC143
PC154
OSC_IN5
OSC_OUT6
/RST7
VSSA8
VDDA9
PA010
PA111
U2_TX12U2_
RX
13
U2_
CK
14
S1_C
K15
S1_M
ISO
16
S1_M
OSI
17
PB0
18
PB1
19
PB2/BOOT1
20
PB10
21
VSS
_123
VDD_1
24
PB12 25
PB11
22
S2_CK 26S2_MISO 27S2_MOSI 28PA8 29PA9 30PA10 31PA11 32PA12 33JTMS 34VSS_2 35VDD_2 36
JTCK
37JT
DI
38JT
DO
39JN
RST
40PB
541
PB6
42PB
743
BOOT0
44PB
845
PB9
46VSS
_347
VDD_3
48
U2STM32F103C8T6C8
20pFC920pF 1 2
X1
8MHz+3V3
U2_TXU2_
RX
U2_
CK
M25_CS
USB_DMUSB_DP
STM_RST
T_JT
CK
T_JTCK
T_JT
DO
T_JT
DI
T_JTMS
STM_JTMS
STM
_JTC
KSTM
_JTD
ISTM
_JTD
OSTM
_JRST
OSC_INOSC_OUT
U1_TXU1_RX
T_NRST
T_JR
ST
LD1
RED
ST_LINK_LED
R154K7
R164K7
AIN_1C10100nF
R14
100K
R8
510
R9
100K
+3V3
+3V3
+3V3
+3V3
+3V3
SWIM
SWIM_RST
SWIM_IN
SWIM_RST_IN
SW
IM_IN
SW
IM_IN
SWIM
_IN
SW
IM
SWIM
SW
IM_R
ST_
INSW
IM_R
ST
RESET#ST_LINK_SWIM
MB915 5 5
STM8L-DISCOVERY ST-LINK (SWIM only)
R7
220
R12
220
SWIM_PULLUP_CTL
ST_LINK_LED
+3V3
R6
47
R13
47
R10680
1234
CN2
USB_DMUSB_DP
+3V3
R31K5
R5
22R4
22
USB
R2100K
VCC 1
D- 2
D+ 3
ID 4
GND 5
SHELL 0
CN1
5075BMR-05-SM
U5V
1 2 3 4
CN3
SB4 SB3
COM
SB6 SB5
SB8 SB7
SB10 SB9STM_JTMS
STM_JTCK
R1110K
+3V3
+5V
U5V
EXT_5V D2
BAT60JFILM
+3V3 EXT_3V3
D1BAT60JFILM
R1
1K
PWR
LD2
RED
+3V3
SWCLK
SWDIO
Vin3 Vout 2
1
U1LD1117S33TR
C310uF
C110uF
+5V
JP3
Wired on Solder Side
JP2
C6100nF
C7100nF
C4100nF
C5100nF
SWIM DISCOVERYST-LINK
PRG-32
DEFAULT
+3V3
C2100nF
Jumpers ON --> DISCOVERY SelectedJumpers OFF --> ST-LINK Selected
Revision history UM0970
29/30 Doc ID 17693 Rev 2
7 Revision history
Table 9. Document revision history
Date Revision Changes
24-Sep-2010 1 Initial release.
15-Jun-2011 2Section 5 Mechanical drawing added. Note added to Section 3.3, measurement range added to Section 3.6.1 and Section 3.6.2.
UM0970
30/30 Doc ID 17693 Rev 2
Please Read Carefully:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve theright to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at anytime, 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 noliability 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 thisdocument 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 productsor services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of suchthird 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 IMPLIEDWARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIEDWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWSOF 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 NOTRECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAININGAPPLICATIONS, 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 "AUTOMOTIVEGRADE" 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 voidany warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, anyliability 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.
© 2011 STMicroelectronics - All rights reserved
STMicroelectronics group of companies
Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan - Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America
www.st.com