EVAL KIT STM8S DISCOVERY

STM8S-DISCOVERY

Manufacturer Part NumberSTM8S-DISCOVERY
DescriptionEVAL KIT STM8S DISCOVERY
ManufacturerSTMicroelectronics
SeriesSTM8S
TypeMCU
STM8S-DISCOVERY datasheets
 

Specifications of STM8S-DISCOVERY

ContentsBoardProcessor To Be EvaluatedSTM8S
Processor SeriesSTM8Interface TypeUSB, I2C, SPI, UART
Operating Supply Voltage5 VSilicon ManufacturerST Micro
Core ArchitectureSTM8Core Sub-architectureSTM8
Silicon Core NumberSTM8Silicon Family NameSTM8L1xx
Kit ContentsBrd, Cable, DocRohs CompliantNo
For Use With/related ProductsSTM8SLead Free Status / RoHS StatusNot applicable / Not applicable
Other names497-10040  
1
Page 1
2
Page 2
3
Page 3
4
Page 4
5
Page 5
6
Page 6
7
Page 7
8
Page 8
9
Page 9
10
Page 10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Page 1/42

Download datasheet (3Mb)Embed
Next
Introduction
This document complements the information in the STM8S datasheets by describing the
software environment and development recommendations required to build an application
around the STM8S-DISCOVERY. It also explains how to use the STM8S firmware and
STM8S touch sensing libraries provided by STMicroelectronics, in order to develop cost-
effective applications.
In addition, ST provides a development package which can be used to build an application
running on the STM8S-DISCOVERY. This package includes application code examples and
a project template.
Reference documents
STM8S-DISCOVERY user manual (UM0817)
ST Visual Develop (STVD) user manual (UM0036)
Adjustable LED blinking speed using STM8S-DISCOVERY touch sensing key
(UM0833)
Displaying variable voltage on a LED bar using STM8S-DISCOVERY (UM0848)
Generating PWM signals using STM8S-DISCOVERY (UM0856)
STM8S reference manual (RM0016)
STM8S105xx datasheet
January 2011
Developing and debugging
your STM8S-DISCOVERY application code
Doc ID 16499 Rev 3
UM0834
User manual
1/42
www.st.com

STM8S-DISCOVERY Summary of contents

  • Page 1

    ... Introduction This document complements the information in the STM8S datasheets by describing the software environment and development recommendations required to build an application around the STM8S-DISCOVERY. It also explains how to use the STM8S firmware and STM8S touch sensing libraries provided by STMicroelectronics, in order to develop cost- effective applications. ...

  • Page 2

    ... Building and running your STVD project . . . . . . . . . . . . . . . . . . . . . . . 25 5.1 Description of the STM8S-DISCOVERY development package . . . . . 25 5.1.1 5.1.2 5.1.3 5.2 Running the STM8S-Discovery examples . . . . . . . . . . . . . . . . . . . . . . . . 27 5.3 Creating your STVD project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 5.3.1 2/42 Installing the Cosmic compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Installing the Raisonance compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Compiler settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Description of the STM8S standard firmware library . . . . . . . . . . . . . . . 16 STM8S standard firmware library online help ...

  • Page 3

    ... Building your application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 6.2 Debugging your application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 6.3 Online help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 7 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Creating your STVD project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Linking the libraries to your STVD project . . . . . . . . . . . . . . . . . . . . . . . 31 Updating the STM8S standard firmware library . . . . . . . . . . . . . . . . . . . 36 Updating the STM8 touch sensing library . . . . . . . . . . . . . . . . . . . . . . . 36 Doc ID 16499 Rev 3 Contents 3/42 ...

  • Page 4

    ... List of tables List of tables Table 1. Touch sensing library configuration for STM8S-DISCOVERY using TS1 touchkey . . . . . . 20 Table 2. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4/42 Doc ID 16499 Rev 3 UM0834 ...

  • Page 5

    ... Figure 19. STVP option byte selection menu Figure 20. STVP option byte programming menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Figure 21. STVP option byte programming message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Figure 22. STM8S-Discovery_dev package content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Figure 23. Selecting the debug instrument . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Figure 24. Creating your project structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Figure 25. Creating the STVD workspace for your project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Figure 26. ...

  • Page 6

    ... Overview of STM8 software development toolchain 1 Overview of STM8 software development toolchain To develop, compile and run an application software on an STM8S microcontroller, the following software toolchain components are required: ● Integrated development environment (IDE) composed of the ST Visual Develop (STVD) and the ST Visual Programmer software interface (STVP) ● ...

  • Page 7

    ... Firmware libraries The STM8S standard firmware library is a complete package consisting of drivers for all the standard peripherals of Performance line STM8S20x and Access line STM8S10x microcontrollers written in strict ANSI-C code and is fully MISRA C 2004 compliant. ...

  • Page 8

    ... To install STVD, download the installation software and follow each step of the installation wizard. When the installation is complete, the executable is available from START>Programs>ST Toolset>Developement Tools>ST Visual Develop or under C:\Program Files\STMicroelectronics\st_toolset\stvd. 2.2 Downloading and installing the compilers Cosmic and Raisonance compilers are compatible with STVD. They are available together with their documentation at the following urls: ● ...

  • Page 9

    UM0834 1. Step 1 Connect to http://www.cosmicsoftware.com/download_stm8_16k.php, and fill in the information form (see Click Submit to access the download page. Figure 2. Cosmic compiler form Installing the development toolchain Figure 2). Doc ID 16499 Rev 3 9/42 ...

  • Page 10

    Installing the development toolchain 2. Step 2 Download and run the installation software wizard (see Figure 3. Downloading Cosmic compiler software wizard 3. Step 3 Follow the wizard instructions to install the Compiler (see register for a free license and ...

  • Page 11

    UM0834 4. Step 4 Copy the licence file that you have received into the directory \Program files\COSMIC\CXSTM8_16K\License (see Figure 5. Cosmic compiler 2.2.2 Installing the Raisonance compiler To install the Raisonance compiler, follow the sequence described below: Installing the development ...

  • Page 12

    Installing the development toolchain 1. Step 1 Download Ride and the Raisonance kit RKit-STM8 from http://www.raisonance- mcu.com, and follow the installation wizard instructions (see Figure 6. Raisonance compiler installation wizard 2. Step 2 - Register for a free 16 Kbyte ...

  • Page 13

    UM0834 Figure 7. Activation code registration Figure 8. Personal information form Installing the development toolchain Doc ID 16499 Rev 3 13/42 ...

  • Page 14

    Installing the development toolchain Figure 9. Serial key information form 2.2.3 Compiler settings STVD uses the default compiler defined at the first launch of the toolchain. This compiler is not defined during the installation. You can select a different compiler ...

  • Page 15

    ... STM8S208xx device with STMicroelectronics STM8/128-EVAL evaluation board. They have to be considered as example codes to develop your own application. Some examples have already been tailored to run on the STM8S-DISCOVERY. They are available from the STM8S-DISCOVERY web pages at http://www.st.com/stm8s-discovery. The STM8S touch sensing library includes the STM8S standard firmware library ...

  • Page 16

    ... In stm8s_conf.h, the HSE value define statement may be adjusted to the oscillator frequency or to the external clock generator frequency also conditioned by supported devices. Make sure you have the correct value for the STM8S-DISCOVERY external oscillator (expressed in Hz). For example: #define HSE_VALUE ((u32)16000000) The peripheral interrupt function file, stm8s_it ...

  • Page 17

    ... The header stm8s_<periph>.h including the peripheral function prototypes as well as the variables, constant and structures used within these functions. The flow that must be followed to create your application software using the STM8S standard firmware library is described in Figure 12. stm8s_conf.h peripheral define statements 3.1.2 STM8S standard firmware library online help An online help, stm8s_fwlib_um ...

  • Page 18

    ... STM8S touch sensing library working principles The STM8S touch sensing library is a set of compatible C files. It includes the API that makes the interface with the other software layers, a core set of files performing basic functions (main state machine, key state machine, services), plus the drivers to control timers and GPIOs ...

  • Page 19

    ... See Table 1 for an example of define statement configuration for an application using the single touch sensing button of STM8S-DISCOVERY (TS1). The other define statements must remain unchanged (thresholds, integrator settings, IIR filter settings,...). Note: The STM8_TSL_RC_Configuration.h file can be updated to support keys and 2 wheels or sliders ...

  • Page 20

    ... Figure 16 shows the main flowchart that followed to develop an application using the touch sensing library with the STM8S-DISCOVERY. The application code must call some API functions to initialize the library and manage the acquisition state machines. The function TSL_Init() must be called once during the initialization of the complete system. ...

  • Page 21

    ... Figure 16. User application flowchart 3.2.4 STM8S touch sensing library online help An online help, stm8_tsl_um.chm, is located in the STM8S touch sensing library installation directory to help you with the structure of the library (see Figure 17. STM8S touch sensing library online help home page Description of firmware libraries ...

  • Page 22

    ... They are stored in a dedicated memory block. Refer to the option bytes section of the STM8S105xx datasheet for a detailed description. STVP can be used to program the STM8S option bytes part of the free software package provided by STMicroelectronics. This easy-to-use tool has a graphical interface allowing to read, write and verify the STM8 Flash programming memory, data EEPROM and option bytes ...

  • Page 23

    UM0834 Figure 19. STVP option byte selection menu 7. To program an option byte to a new value: a) Click the option byte description, and select the value. b) Click Program>Current tab in the main menu toolbar (see c) If ...

  • Page 24

    Configuring the option bytes for your application Figure 20. STVP option byte programming menu Figure 21. STVP option byte programming message 24/42 Doc ID 16499 Rev 3 UM0834 ...

  • Page 25

    ... Building and running your STVD project 5.1 Description of the STM8S-DISCOVERY development package ST provides a complete development package, the STM8S-Discovery_dev. It allows to easily get started with the STM8S-DISCOVERY by simplifying application code development and execution using the touch sensing or the standard peripherals drivers. This package can be downloaded together with the present user manual from http://www ...

  • Page 26

    ... LED blinking speed using STM8S-DISCOVERY touch sensing key” (UM0833). The Discover application project is proposed only with the Cosmic compiler because the STM8 touch sensing library V1.3.0 included in the STM8S-Discovery_dev package is not yet compatible with the Raisonance compiler. ● ...

  • Page 27

    ... Follow the steps below: 1. Install the development toolchain (see – Cosmic or Raisonance compiler – STVD 2. Download the STM8S-Discovery_dev.zip file and extract the directory STM8S- Discovery_dev on your PC (see development 3. Run STVD From START>Programs>ST Toolset>Development Tools>ST Visual Develop a) Select File -> Open Workspace b) Browse for the project file ...

  • Page 28

    ... This section explains step by step how to create your own application project. The touch sensing and the firmware libraries can be used or not according to the kind of application code to develop. All projects must be created starting from STM8S-Discovery_dev development package (see Section 5.1: Description of the STM8S-DISCOVERY development 5 ...

  • Page 29

    ... Raisonance, select \STM8S- DISCOVERY_dev\Project\My_own_project\STVD\Raisonance\STVD_workspa ce.stw. stvd_project appears in the STVD workspace window as shown in structure is slightly different from the structure of My_own_project directory in STM8S- Discovery_dev package: – Source Files has the same content as \STM8S- DISCOVERY_dev\Project\My_own_project\STVD\src. – Source Files\FWLib contains the STM8S standard library source files. ...

  • Page 30

    ... Building and running your STVD project Figure 26. Checking the selected compiler Projects>settings>MCU selection, and select STM8S105C6 from the MCUs list. Make sure that MCU selected is displayed in the selected MCU field before clicking OK (see Figure Figure 27. Select the MCU 30/42 27). Doc ID 16499 Rev 3 ...

  • Page 31

    ... Edit stm8s.h and comment #define USE_STDPERIPH_DRIVER to be able to use the register structures, memory mapping, and constant definitions for each peripheral. For an example of application code that does not use any library, refer to the ADC project of the STM8S-DISCOVERY development package. Building and running your STVD project Doc ID 16499 Rev 3 ...

  • Page 32

    ... This section explains step by step how to link the STM8S standard firmware library to your STVD project. Prior to linking the library to your project, check that the STM8S library is up-to-date not, download the latest release (see Follow the steps described below to link the STM8S standard firmware library to your STVD project: 1 ...

  • Page 33

    ... DISCOVERY_dev\Libraries\STM8S_StdPeriph_Driver\src into Include Files\FWLib and Source Files\FWLib of STVD project, respectively. You can also decide to copy the whole drivers (.c and .h files) from the library to your STVD project. Figure 31. Linking the STM8S standard firmware library - step 2 Building and running your STVD project Doc ID 16499 Rev 3 33/42 ...

  • Page 34

    ... DISCOVERY_dev\Project\Discover\inc to your project folder STM8S- DISCOVERY_dev\Project\My_own_project\inc. Otherwise, copy the original configuration file, STM8_TSL_RC_Configuration_TOADAPT.h, available in STM8S- DISCOVERY_dev\Libraries\STM8_TouchSensing_Driver\inc to your project folder STM8S-DISCOVERY_dev\Project\My_own_project\inc. Rename it STM8_TSL_RC_Configuration.h. Set the parameters in compliance with your application hardware (refer to the touch sensing library online help available in the installation directory). b) Copy STM8_TSL_RC_Configuration ...

  • Page 35

    ... A specific main.c structure is required to correctly use the touch sensing features. This structure is already implemented in the Discover project. Please refer to STM8S touch sensing library blinking speed using STM8S-DISCOVERY touch sensing key” (UM0833) for an example. Building and running your STVD project for more information, and to user manual “Adjustable LED ...

  • Page 36

    ... Copy the inc and src directories in \“STM8S- DISCOVERY_dev”\Libraries\STM8S_StdPeriph_Driver. 5.4.2 Updating the STM8 touch sensing library To update the STM8 touch sensing library: 1. Download the new release from http://www.st.com/mcu. 2. Copy the inc and src directories in \“STM8S- Discovery_My_own_project”\Libraries\STM8_TouchSensing_Driver. 36/42 Doc ID 16499 Rev 3 UM0834 ...

  • Page 37

    UM0834 6 Building, debugging and running your application Once your have developed your application code, created your workspace environment, and launched STVD, you can start building, debugging and programming your application to the target microcontroller. 6.1 Building your application Once ...

  • Page 38

    Building, debugging and running your application information on the available options for your toolset, refers to the STVD online help available by clicking Help in the STVD main menu toolbar. 3. Once your MCU is selected (Project > Settings > ...

  • Page 39

    ... Several debug windows are available in STVD. You can access them by selecting View menu when a debug session is ongoing. One of the most useful windows is the Peripheral registers window. It can be used to display the content of the STM8S105C6 peripheral registers during the debug session. (see Figure 38). ...

  • Page 40

    Building, debugging and running your application Figure 39. Watch window 6.3 Online help For more information on building and debugging features, refer to embedded STVD online help page (Help>Help Home Page). Figure 40. STVD online help 40/42 Doc ID 16499 ...

  • Page 41

    ... Table 2. Document revision history Date 04-Nov-2009 08-Feb-2010 04-Jan-2011 Revision 1 Initial release. Updated list of reference documents on cover page. Modified url of STM8S-DISCOVERY page. 2 Added warning in Section 3.2: STM8S touch sensing library Reworked Section 5: Building and running your STVD Replaced 3 http://www.st.com/stonline/products/support/micro/files/sttoolset.exe by http://www.st.com. ...

  • Page 42

    ... 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. ...