ST STM8AL Application Note Download Page 3

DocID16139 Rev 5

3/42

AN3029

Contents

3

7

Reference design   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

7.1

Component references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  19

7.2

Schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  20

8

STM8 development tools   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

8.1

Single wire interface module (SWIM)  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  21

8.1.1

SWIM overview  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

8.1.2

SWIM connector pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

8.1.3

Hardware connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

8.2

STice emulator  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  23

8.2.1

STice overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

8.2.2

STice in emulation configuration  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

8.2.3

In-circuit programming and debugging   . . . . . . . . . . . . . . . . . . . . . . . . . 25

8.3

RLink and STLink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  25

9

STM8 software toolchain   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

9.1

Integrated development environment . . . . . . . . . . . . . . . . . . . . . . . . . . . .  27

9.2

Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  27

9.3

Firmware library  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  27

10

Setting up the STM8 development environment   . . . . . . . . . . . . . . . . . 28

10.1

Installing the tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  28

10.2

Using the tools  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  29

10.2.1

Project editing   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

10.2.2

Online help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

10.3

Running the demonstration software  . . . . . . . . . . . . . . . . . . . . . . . . . . . .  32

10.3.1

Compiling the project  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

10.3.2

Selecting the correct debug instrument  . . . . . . . . . . . . . . . . . . . . . . . . . 33

10.3.3

Connecting the hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

10.3.4

Starting the debug session   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

10.3.5

Running the software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

10.3.6

Follow up  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

11

Documentation and online support . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

12

Revision history   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

Summary of Contents for STM8AL

Page 1: ...ommendations are given This application note also contains detailed reference design schematics with descriptions of the main components The STM8 development tools and software toolchain are common to...

Page 2: ...4 1 Clock management overview 10 4 2 Internal clocks 10 4 3 External clock 10 4 3 1 HSE clock 10 4 3 2 LSE clock 12 5 Reset control 14 5 1 Reset management overview 14 5 1 1 Output characteristics 15...

Page 3: ...3 RLink and STLink 25 9 STM8 software toolchain 26 9 1 Integrated development environment 27 9 2 Compiler 27 9 3 Firmware library 27 10 Setting up the STM8 development environment 28 10 1 Installing...

Page 4: ...List of tables AN3029 4 42 DocID16139 Rev 5 List of tables Table 1 Applicable products 1 Table 2 Component list 19 Table 3 SWIM connector pins 22 Table 4 Document revision history 40...

Page 5: ...ure 13 Connection description 23 Figure 14 STice in emulation configuration 24 Figure 15 In circuit programming and debugging 25 Figure 16 STM8 software toolchain 26 Figure 17 STVD open example worksp...

Page 6: ...packages one pair of pads VDD VSS or several pairs of pads VDDx VSSx from 1 65 V or 1 8 V to 3 6 V All VDDx and VSSx must be at the same potential respectively The VDDx pins must be connected to VDD w...

Page 7: ...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 VSS 2 2 Main operating vol...

Page 8: ...ernal BOR or an external reset circuit especially for STM8L101xx devices to ensure correct device reset during power down when VPDR VDD VDD min For better power monitoring the STM8L15xxx STM8L162xx ST...

Page 9: ...ed on VREF a 100 nF and a 1 F capacitor must be connected on this pin To compensate for peak consumption on VREF the 1 F capacitor may be increased to 10 F when the sampling speed is low In all cases...

Page 10: ...y a division factor 4 2 Internal clocks STM8L and STM8AL 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...

Page 11: ...in the 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 AN286...

Page 12: ...f about 50 has to drive the OSC32_IN pin while the OSC32_OUT pin must be left high impedance see Figure 5 and Figure 6 Figure 5 External clock 1 OSC32_IN and OSC32_OUT pins can be used also as GPIO bu...

Page 13: ...867 Oscillator design guide for ST microcontrollers 2 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 3 The...

Page 14: ...the device under reset until the supply voltage VDD and VDDx reach the voltage level at which level the BOR starts to function STM8L101xx devices have only a POR Independent watchdog reset IWDG Windo...

Page 15: ...characteristics All pulses with a duration less than 50 ns are filtered All train burst spikes with a ratio of 1 10 must be filtered This means that a negative spike of up to 50 ns is always filtered...

Page 16: ...or has a negative influence on the device power consumption Therefore the recommended capacitor value of 100 nF can be reduced down to 10 nF to limit such power consumption The STM8L101xx reset state...

Page 17: ...e The power supply should be implemented close to the ground line to minimize the surface of the supply loop This is due to the fact that the supply loop acts as an antenna and is therefore the main e...

Page 18: ...t for battery powered applications and also to improve EMC performance unused clocks counters or I Os should not be left free I Os should be forced externally pull up or pull down to the unused I O pi...

Page 19: ...ts to choose the right package 2 Battery 1 65 V to 3 6 V 1 1 1 8 V to 3 6 V for STM8L05xxx 1 Min 1 8 V when BOR is enabled 3 Capacitor 1 F n Decoupling capacitor 4 Capacitor 100 nF n Ceramic capacitor...

Page 20: ...antalum or Ceramic capacitor VDD1 VDDA VREF VSS1 2 N VLCD NRST OSC_IN OSC_OUT OSC32_IN OSC32_OUT Biggest package 20pF 1 16MHz 0 Ohm 20pF 4 1 3 2 32 768kHz 6 8pF 6 8pF 100 H BEAD 1uF 1uF Only if accura...

Page 21: ...L1526 EVAL and STM8L1528 EVAL STM8L DISCOVERY 8 1 Single wire interface module SWIM 8 1 1 SWIM overview In circuit debugging mode or in circuit programming mode are managed through a single wire hardw...

Page 22: ...ware connection Caution It is recommended to place the SWIM header as close as possible to the STM8L STM8AL device as this minimizes any possible signal degradation caused by long PCB tracks Table 3 S...

Page 23: ...emulator for STM8 for more details STice has two distinct modes of operation which are described further in this section Emulation mode In circuit mode It can also be used instead of RLink for SWIM c...

Page 24: ...that relays signals from the STice to the application board Connection adapter Links the connection flex to the footprint of the target microcontroller on the users application board Adapter socket S...

Page 25: ...O In both the emulation and the in circuit programming debugging configuration STice is driven by the ST Visual Develop STVD or ST Visual Programmer STVP integrated development environment running on...

Page 26: ...n To write compile and run the first software on an STM8L STM8AL device the following components of the software toolchain are required see Figure 16 Integrated development environment Compiler Firmwa...

Page 27: ...gramming tools supported by STVP The free ST toolset for STM8 is available from STMicroelectronics homepage see www st com 9 2 Compiler STM8L STM8AL devices can be programmed by a free assembler toolc...

Page 28: ...user through the installation process It is recommended to install the tools in the following order 1 C compiler 2 ST toolset 3 STM8 firmware library ST LINK does not need any dedicated software insta...

Page 29: ...ommended to open an existing project from the STM8 firmware library Note Even if you are not intending to use the library an existing library project can be used as a template to configure all the com...

Page 30: ...Setting up the STM8 development environment AN3029 30 42 DocID16139 Rev 5 10 2 1 Project editing All project source files are visible and can be edited see Figure 18 Figure 18 STVD MCU edit mode...

Page 31: ...opment environment 41 10 2 2 Online help An online help manual is available inside the firmware installation directory see Figure 19 to help the user understand the structure of the STM8 firmware libr...

Page 32: ...VAL firmware Open the desired project workspace within the chosen demonstration firmware package To run the demonstration software on the STM8 evaluation board the project has to be compiled and the c...

Page 33: ...instrument In the example below the Rlink tool is used for communicating via the SWIM interface with the on board debug module of the STM8 The Rlink tool can be selected from the Debug Instrument Sel...

Page 34: ...longer in the default position please read the evaluation board user manuals to select power and debug support jumpers For the STM8L101 EVAL the Rlink tool can be connected to the PC by a standard US...

Page 35: ...Figure 23 Connecting the debug instrument to the STM8L152x EVAL evaluation board Caution On the Rlink adapter board for STM8 the SWIM jumper must be set If there is no pull up on the application SWIM...

Page 36: ...e STM8 development environment AN3029 36 42 DocID16139 Rev 5 10 3 4 Starting the debug session Debug mode can be entered by the command Debug Start Debugging see Figure 24 Figure 24 STVD Starting the...

Page 37: ...AN3029 Setting up the STM8 development environment 41 10 3 5 Running the software After entering debug mode the software can be started by the run command in the menu Debug Run see Figure 25 Figure 25...

Page 38: ...ep by step additional peripherals of STM8L STM8AL devices can be run following on from the initial debug session described above Many features of STM8L STM8AL devices are supported by dedicated hardwa...

Page 39: ...STice advanced emulation system for ST microcontrollers data briefing STice user manual Cosmic Raisonance or IAR C compiler user manual STM8L101 EVAL STM8L1526 EVAL or STM8L1528 EVAL evaluation board...

Page 40: ...dware reset implementation added text about the pull down capacitor Table 2 Component list updated comment information for ID number 2 battery added ID number 5 ceramic capacitor Figure 10 added exter...

Page 41: ...roducts Added Table 1 Applicable products Added note 1 to Table 2 Component list Updated references in Section 8 STM8 development tools 23 Jul 2013 5 Updated Section 2 1 Power supply overview Section...

Page 42: ...UAL PROPERTY RIGHT ST PRODUCTS ARE NOT AUTHORIZED FOR USE IN WEAPONS NOR ARE ST PRODUCTS DESIGNED OR AUTHORIZED FOR USE IN A SAFETY CRITICAL APPLICATIONS SUCH AS LIFE SUPPORTING ACTIVE IMPLANTED DEVIC...

Reviews: