+ All Categories
Home > Documents > Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher...

Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher...

Date post: 04-May-2018
Category:
Upload: lyanh
View: 228 times
Download: 3 times
Share this document with a friend
74
A product of SEGGER Microcontroller GmbH & Co. KG www.segger.com Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores Document: UM05006 Date: August 11, 2011
Transcript
Page 1: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

A product of SEGGER Microcontroller GmbH & Co. KG

www.segger.com

Flasher STM8

Manual Rev. 9

User guide of the stand-alone SWIM programmer for STM8 Cores

Document: UM05006

Date: August 11, 2011

Page 2: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

2

Disclaimer

Specifications written in this document are believed to be accurate, but are not guar-anteed to be entirely free of error. The information in this manual is subject tochange for functional or performance improvements without notice. Please make sureyour manual is the latest edition. While the information herein is assumed to beaccurate, SEGGER Microcontroller GmbH & Co. KG (the manufacturer) assumes noresponsibility for any errors or omissions. The manufacturer makes and you receiveno warranties or conditions, express, implied, statutory or in any communication withyou. The manufacturer specifically disclaims any implied warranty of merchantabilityor fitness for a particular purpose.

Copyright notice

You may not extract portions of this manual or modify the PDF file in any way withoutthe prior written permission of the manufacturer. The software described in this doc-ument is furnished under a license and may only be used or copied in accordancewith the terms of such a license.

© 2011 SEGGER Microcontroller GmbH & Co. KG, Hilden / Germany

Trademarks

Names mentioned in this manual may be trademarks of their respective companies.

Brand and product names are trademarks or registered trademarks of their respec-tive holders.

Contact address

SEGGER Microcontroller GmbH & Co. KG

In den Weiden 11D-40721 Hilden

Germany

Tel.+49 2103-2878-0Fax.+49 2103-2878-28Email: [email protected]: http://www.segger.com

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 3: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

3

Revisions

This manual describes the Flasher STM8 device.

For further information on topics or routines not yet specified, please contact us.

Revision Date By Explanation

9 110811 OO Some minor changes.

8 110502 OO

Chapter "Hardware":- Some minor changes.- Added more detailed information about the con-nection cable.

7 110307 OO Chapter "Introduction":- Added speed measurements

6 101007 OO

Chapter "Working with Flasher STM8":- Added example for setting up multiple configura-tions for stand-alone mode and how to switch between configurations remotely.

5 100702 OO Chapter "Remote control":- Added information regarding TCP/IP terminal

4 100624 OOUpdated document to renamed binaries in Flasher STM8 software and documentation package.Updated all screenshots.

3 100607 OO

Chapter "Hardware":- Added information about connecting Flasher GND to power supply ground for more power stabiliza-tion

2 100525 OO

Chapter "Hardware":- Added more information to SWIM and Reset out-put signals- Some minor changes

1 100401 OO

Chapter "Working with Flasher STM8":- Added information about setup multiple Flasher on one PCChapter "Hardware":- Declared 10-pin connector as obsolete interface

0 091210 OO Initial version.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 4: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

4

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 5: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

5

About this document

This document describes the Flasher STM8. It provides an overview over the majorfeatures of the Flasher STM8, gives you some background information about SWIM,STM8 general and describes Flasher STM8 related software packages available fromSegger. Finally, the chapter Support and FAQs on page 65 helps to troubleshoot com-mon problems.

Typographic conventions

This manual uses the following typographic conventions:

Style Used for

Body Body text.

KeywordText that you enter at the command-prompt or that appears on the display (that is system functions, file- or pathnames).

Reference Reference to chapters, tables and figures or other documents.

GUIElement Buttons, dialog boxes, menu names, menu commands.

Table 1.1: Typographic conventions

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 6: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

6

EMBEDDED SOFTWARE(Middleware)

emWinGraphics software and GUIemWin is designed to provide an effi-cient, processor- and display control-ler-independent graphical user interface (GUI) for any application that operates with a graphical display. Starterkits, eval- and trial-versions are available.

embOSReal Time Operating SystemembOS is an RTOS designed to offer the benefits of a complete multitasking system for hard real time applications with minimal resources. The profiling PC tool embOSView is included.

emFileFile systememFile is an embedded file system with FAT12, FAT16 and FAT32 support. emFile has been optimized for mini-mum memory consumption in RAM and ROM while maintaining high speed. Various Device drivers, e.g. for NAND and NOR flashes, SD/MMC and Com-pactFlash cards, are available.

emUSBUSB device stackA USB stack designed to work on any embedded system with a USB client controller. Bulk communication and most standard device classes are sup-ported.

SEGGER TOOLS

Flasher Flash programmerFlash Programming tool primarily for microcon-trollers.

J-LinkJTAG emulator for ARM coresUSB driven JTAG interface for ARM cores.

J-TraceJTAG emulator with traceUSB driven JTAG interface for ARM cores with Trace memory. supporting the ARM ETM (Embed-ded Trace Macrocell).

J-Link / J-Trace Related SoftwareAdd-on software to be used with SEGGER�s indus-try standard JTAG emulator, this includes flash programming software and flash breakpoints.

SEGGER Microcontroller GmbH & Co. KG developsand distributes software development tools and ANSIC software components (middleware) for embeddedsystems in several industries such as telecom, medi-cal technology, consumer electronics, automotiveindustry and industrial automation.

SEGGER�s intention is to cut software development-time for embedded applications by offering compact flexible and easy to use middleware,allowing developers to concentrate on their application.

Our most popular products are emWin, a universal graphic software package for embed-ded applications, and embOS, a small yet efficient real-time kernel. emWin, writtenentirely in ANSI C, can easily be used on any CPU and most any display. It is comple-mented by the available PC tools: Bitmap Converter, Font Converter, Simulator andViewer. embOS supports most 8/16/32-bit CPUs. Its small memory footprint makes itsuitable for single-chip applications.

Apart from its main focus on software tools, SEGGER develops and produces programmingtools for flash microcontrollers, as well as J-Link, a JTAG emulator to assist in develop-ment, debugging and production, which has rapidly become the industry standard fordebug access to ARM cores.

Corporate Office:http://www.segger.com

United States Office:http://www.segger-us.com

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 7: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

7

Table of Contents

1 Introduction ......................................................................................................................9

1.1 Flasher STM8 overview.............................................................................101.1.1 Features of Flasher STM8..........................................................................101.1.2 Working environment...............................................................................101.2 Specifications..........................................................................................111.2.1 Specifications for Flasher STM8 .................................................................111.3 Supported CPU cores ...............................................................................121.4 Download speed ......................................................................................13

2 Setup..............................................................................................................................15

2.1 Installing the Flasher STM8 software and documentation pack .......................162.1.1 Setup procedure......................................................................................162.2 Setting up the USB interface .....................................................................192.2.1 Verifying correct driver installation.............................................................192.3 Uninstalling the J-Link USB driver ..............................................................212.4 Setting up the IP interface ........................................................................222.4.1 Connecting the first time ..........................................................................222.4.2 Configuring the Flasher ............................................................................23

3 Flasher STM8 related software......................................................................................27

3.1 Flasher STM8 software and documentation package .....................................283.2 Flasher STM8 software and documentation package in detail .........................293.2.1 STM8 Commander (Command line tool)......................................................293.2.2 Flasher STM8 Software (Program flash memory)..........................................303.3 Using the JLinkSTM8.dll ............................................................................313.3.1 What is the JLinkSTM8.dll?........................................................................313.3.2 Determining the version of JLinkSTM8.dll ....................................................313.3.3 Determining which DLL is used by a program ..............................................32

4 Working with Flasher STM8...........................................................................................33

4.1 Operating modes .....................................................................................344.1.1 PC mode ................................................................................................344.1.2 Stand-alone mode ...................................................................................374.1.3 MSD mode..............................................................................................384.2 Multiple File Support ................................................................................394.2.1 Setting up configurations and switching configurations .................................404.3 Connecting multiple Flasher to your PC.......................................................444.3.1 How does it work? ...................................................................................444.3.2 Configuring multiple Flasher STM8 .............................................................454.3.3 Connecting to a Flasher with non default USB-Address..................................46

5 Remote control...............................................................................................................47

5.1 Overview................................................................................................485.2 Handshake control ...................................................................................495.3 ASCII command interface .........................................................................505.3.1 Introduction............................................................................................505.3.2 General command and reply message format ..............................................505.3.3 Communication port settings.....................................................................505.3.4 Commands to Flasher...............................................................................50

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 8: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

8

5.3.5 Reply from Flasher STM8.......................................................................... 54

6 Hardware .......................................................................................................................57

6.1 10-pin connector (obsolete)...................................................................... 586.1.1 10-pin connector pinout ........................................................................... 586.2 4-pin Connector ...................................................................................... 596.2.1 4-pin connector pinout............................................................................. 596.3 Connection cable..................................................................................... 606.4 Target board design for SWIM................................................................... 616.4.1 Target power supply ................................................................................ 616.5 How to determine the hardware version ..................................................... 62

7 Background information .................................................................................................63

7.1 Flash programming ................................................................................. 647.1.1 How does flash programming via Flasher STM8 work ? ................................. 647.1.2 Data download to RAM............................................................................. 647.1.3 Available options for flash programming ..................................................... 64

8 Support and FAQs .........................................................................................................65

8.1 Contacting support .................................................................................. 668.2 Frequently Asked Questions...................................................................... 67

9 Glossary.........................................................................................................................69

10 Literature and references.............................................................................................71

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 9: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

9

Chapter 1

Introduction

This chapter gives a short overview about the Flasher STM8.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 10: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

10 CHAPTER 1 Introduction

1.1 Flasher STM8 overviewFlasher STM8 is a programming tool for microcontrollers with on-chip Flash memoryand STM8 core. Flasher STM8 is designed for programming flash targets with a PCprogram or stand-alone.Flasher STM8 connects via USB, via ethernet or via RS232 interface to a PC, runningMicrosoft Windows 2000, Windows XP, Windows 2003, Windows Vista or Windows 7.Flasher STM8 has a built-in 10-pin interface connector and a built-in 4-pin interfaceconnector, which are compatible with the debug connectors used by STM8 eval sys-tems.

1.1.1 Features of Flasher STM8� USB 2.0 interface� Full duplex 100Mbit ethernet interface� TCP/IP server included in Flasher STM8, which allows using Flasher via TCP/IP

networks� Standard 4-pin SWIM connector� USB, ethernet, RS232 and 4-pin ribbon cable included� No power supply required, powered through USB� Target power supply via pin 1 of the 4-pin interface (up to 300mA to target with

overload protection)� Integrated optical isolation between host and target system� Support for all STM8 devices� Target voltage can be measured� Fully plug and play compatible� Three boot modes: PC mode, stand-alone mode, MSD mode� Stand-alone SWIM programmer (Once set up, Flasher can be controlled without

the use of PC program)� 128 MB memory for storage of target program� Serial in target programming supported� Data files can be updated via PC program� Flash programming software available

1.1.2 Working environmentGeneral

Flasher STM8 can be operated from a PC with an appropriate software like FlasherSTM8 software or in stand-alone mode.

Host System

IBM PC/AT or compatible. CPU: Pentium with at least 192MB of RAM, runningMicrosoft Windows 2000, Windows XP, Windows 2003, Windows Vista or Windows 7.It needs to have an USB, ethernet or RS232 interface available for communicationwith Flasher STM8.

Power supply

Flasher requires 5V DC, min. 100mA via USB connector. If USB is not connected, theUSB connector is used to power the device. Supply voltage is the same in this case.Please avoid excess voltage.

Installing Flasher STM8 PC-software Flasher STM8

The latest version of the Flasher STM8 Software, which is part of the Flasher STM8software and documentation package, can be downloaded from our website: http://www.segger.com. For more information about using Flasher STM8 Software pleaserefer to the Flasher STM8 Software User Guide which is also available for downloadon our website.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 11: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

11

1.2 Specifications

1.2.1 Specifications for Flasher STM8The following table gives an overview about the specifications (general, mechanical,electrical) for Flasher STM8.

General

Supported OS

Microsoft Windows 2000Microsoft Windows XPMicrosoft Windows XP x64Microsoft Windows 2003Microsoft Windows 2003 x64Microsoft Windows VistaMicrosoft Windows Vista x64Windows 7Windows 7 x64

Electromagnetic compatibility (EMC) EN 55022, EN 55024Operating temperature +5°C ... +60°CStorage temperature -20°C ... +65 °CRelative humidity (non-condensing) Max. 90% rHSize (without cables) 121mm x 66mm x 30mmWeight (without cables) 122g

Mechanical

USB interface USB 2.0, full speedEthernet interface 100MHz full duplexRS232 Host Interface RS232 9-pin

Target interfaceSWIM (either via 10-pin connector or 4-pin connector depending on target hard-ware)

SWIM Interface, Electrical

Power supplyUSB powered, 100mA for Flasher STM8. 500mA if target is powered by Flasher STM8.

Target interface voltage (VIF) 1.2V ... 5VTarget supply voltage 4.5V ... 5V (if powered with 5V on USB)Target supply current Max. 300mALOW level input voltage (VIL) Max. 40% of VIF

HIGH level input voltage (VIH) Min. 60% of VIFTable 1.1: Flasher STM8 specifications

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 12: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

12 CHAPTER 1 Introduction

1.3 Supported CPU coresFlasher STM8 has been designed and tested with the following cores, but should workwith any STM8 core. If you experience problems with a particular core, do not hesi-tate to contact Segger.

� STM8A� STM8L� STM8S

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 13: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

13

1.4 Download speedFlasher STM8 has been designed to allow downloading to the target as fast as thetarget can receive and program flash. The table below shows the measured downloadspeed for standalone programming and for programming via PC driven software. Thefollowing testing environment has been used:

� PC with 2.53 GHz Core2Duo, running WinXP� USB 2.0 port� USB 2.0 hub� Flasher STM8� STM8S208MBT6B

Operation Standalone mode PC mode

Program (128kB) 8.5s (15kB/s) 8.5s (15kB)Program and verify (128kB) 11.3s 11.3s

Table 1.2: Flasher STM8 download speed

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 14: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

14 CHAPTER 1 Introduction

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 15: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

15

Chapter 2

Setup

This chapter describes the setup procedure required in order to work with FlasherSTM8. Primarily this includes the installation of the Flasher STM8 software and docu-mentation package.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 16: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

16 CHAPTER 2 Setup

2.1 Installing the Flasher STM8 software and docu-mentation pack

Flasher STM8 is shipped with a bundle of applications, corresponding manuals andsome sample projects and the kernel mode USB driver.

Refer to chapter Flasher STM8 related software on page 27 for an overview about theFlasher STM8 software and documentation pack.

2.1.1 Setup procedureTo install the Flasher STM8 software and documentation pack, follow this procedure:

Note: We recommend to check if a newer version of the Flasher STM8 softwareand documentation pack is available for download before starting the installation.Check therefore the Flasher STM8 related download section of our website.

Before you plug your Flasher STM8 into your computer's USB port, extract the setuptool Setup_FlasherSTM8_V<VersionNumber>.zip. The setup wizard will install thesoftware and documentation pack that also includes the certified J-Link USB driver.Start the setup by double clicking Setup_FlasherSTM8_V<VersionNumber>.exe. Thelicense Agreement dialog box will be opened. Accept the terms with the Yes but-ton.

1. The Welcome dialog box is opened. Click Next > to open the Choose Destina-tion Location dialog box.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 17: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

17

2. Accept the default installation path C:\Program Files\SEG-GER\FlasherSTM8_V<VersionNumber> or choose an alternative location. Confirmyour choice with the Next > button.

3. The Choose options dialog is opened. The Create entry in start menu optionis preselected. Accept or deselect the options and confirm the selection with theNext > button.

Confirm start of installation by pressing Next > button again.

4. The installation process will be started.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 18: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

18 CHAPTER 2 Setup

5. The Installation Complete dialog box appears after the copy process. Close theinstallation wizard with the Finish > button.

The Flasher STM8 software and documentation pack is successfully installed onyour PC.

6. Connect your Flasher STM8 via USB with your PC. The Flasher STM8 will be iden-tified and after a short period the Flasher LED stops rapidly flashing and stays onpermanently.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 19: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

19

2.2 Setting up the USB interfaceAfter installing the Flasher STM8 software and documentation package it should notbe necessary to perform any additional setup sequences in order to configure theUSB interface of Flasher STM8.

2.2.1 Verifying correct driver installationTo verify the correct installation of the driver, disconnect and reconnect Flasher STM8to the USB port. During the enumeration process which takes about 2 seconds, theLED on Flasher STM8 is flashing. After successful enumeration, the LED stays on per-manently.

Start the provided sample application STM8Commander.exe, which should display thecompilation time of the Flasher firmware, the serial number and a target voltage of0.000V. The screenshot below shows an example.

In addition you can verify the driver installation by consulting the Windows devicemanager. If the driver is installed and your Flasher STM8 is connected to your com-puter, the device manager should list the J-Link USB driver as a node below "Univer-sal Serial Bus controllers" as shown in the following screenshot:

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 20: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

20 CHAPTER 2 Setup

Right-click on the driver to open a context menu which contains the command Prop-erties. If you select this command, a J-Link driver Properties dialog box is openedand should report: This device is working properly.

If you experience problems, refer to the chapter Support and FAQs on page 65 forhelp. You can select the Driver tab for detailed information about driver provider,version, date and digital signer.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 21: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

21

2.3 Uninstalling the J-Link USB driverIf Flasher STM8 is not properly recognized by Windows and therefore does not enu-merate, it makes sense to uninstall the J-Link USB driver.

This might be the case when:

� The LED on the Flasher STM8 is rapidly flashing.� The Flasher STM8 is recognized as Unknown Device by Windows.

To have a clean system and help Windows to reinstall the J-Link driver, follow thisprocedure:

1. Disconnect Flasher STM8 from your PC.2. Open the Add/Remove Programs dialog (Start > Settings > Control Panel

> Add/Remove Programs) and select Windows Driver Package - Segger(jlink) USB and click the Change/Remove button.

3. Confirm the uninstallation process.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 22: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

22 CHAPTER 2 Setup

2.4 Setting up the IP interfaceFlasher STM8 has an additional Ethernet interface, to communicate with the host sys-tem. A built-in web server allows configuration of the flasher via web interface. Inaddition to that, you can set a default gateway for the flasher which allows using iteven in large intranets. For simplicity the setup process of Flasher STM8 is describedin this section.

2.4.1 Connecting the first timeWhen connecting Flasher the first time, it attempts to acquire an IP address viaDHCP. To get information about which IP address is acquired, you have two possibili-ties:

� Connecting Flasher via USB and via Ethernet and read out the IP address viaSTM8Commander.exe.

� Connecting Flasher only via Ethernet and read out the IP via the DHCP IP Assign-ment table of your DHCP Server.

In the following, both ways to get the IP address assigned to Flasher via DHCP, areexplained.

2.4.1.1 Connecting via USB and EthernetWhen using STM8Commander.exe in order to read out the IP address, Flasher has tobe connected to your host system via Ethernet and via USB. When startingSTM8Commander.exe, it will show information about the IP address (static / dynamic)when connecting to Flasher.

To get more detailed information about the current configuration of the Flasher (suchas subnet mask and MAC address), you can use the conf command inSTM8Commander.exe.

After reading out the IP address you can connect to Flasher via Ethernet, using the IPaddress.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 23: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

23

2.4.1.2 Connecting via Ethernet onlyThis way of reading out the IP address of Flasher can be used for example if you donot have administrator rights on the host system in order to install the USB driverwhich is necessary to connect to Flasher via USB. To get the IP address which hasbeen assigned to Flasher via DHCP, you have to read it out from the DHCP IP Assign-ment table of your DHCP Server:

You can easily identify your Flasher by its host ID (in this case FLASHER351100023)and by its MAC addr which always starts with: 00-22-C7-03-XX-XX where XX dependson the last five digits of the serial number of your Flasher. In this case the serialnumber of the connected Flasher is 351100023 (0x0017), so its MAC address is: 00-22-C7-03-00-17.

2.4.2 Configuring the FlasherBy default, Flasher is configured to receive an IP address and a subnet mask viaDHCP. It is also possible to assign a fixed IP address to it. Setting up Flasher can bedone via STM8Commander.exe or via web interface. In the following, both configura-tion methods are described.

2.4.2.1 Configuring Flasher via STM8Commander.exeConfiguring Flasher via STM8Commander.exe is very simple because only one com-mand (in different variations) is necessary to choose between automatic IP addressand dynamic IP address assignment.

Note: If you want to configure Flasher via STM8Commander.exe and Flasher isconnected to your host-system via Ethernet only, you have to type in the ip<IPAddr> command.

Example

ip 192.168.199.29

Assigning an IP address via DHCP

By default, Flasher is configured to acquire an IP address via DHCP, so it should notbe necessary to configure this. But, if you change the IP address to a fixed one,DHCP is disabled from this point. To re-enable DHCP you should use the ipaddr DHCPcommand in STM8Commander.exe. The ipaddr command will be explained in the fol-lowing.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 24: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

24 CHAPTER 2 Setup

Assigning an IP address manually

If you do not want Flasher to be configured via DHCP, you can assign an IP addressand a subnet mask (optional) manually. This is done via the ipaddr command inSTM8Commander.exe. This command can be used in four different ways, which areexplained in the table below:

Example ipaddrSTM8>ipaddrDHCP assigned network configurationIP-Addr: 192.168.199.29Subnetmask: 255.255.0.0

Example ipaddr <IP>STM8>ipaddr 192.168.87.115IP address successfully changed to '192.168.87.115'.Subnetmask successfully changed to '255.255.0.0'.

Example ipaddr <IP> <Subnet mask>

STM8>ipaddr 192.168.87.116 255.255.0.0IP address successfully changed to '192.168.87.116'.Subnetmask successfully changed to '255.255.0.0'.

Example ipaddr DHCP

STM8>ipaddr DHCPConfiguration successfully changed to DHCP.

Command Explanation

ipaddrIf no additional parameter is specified, the current IP and subnet mask of Flasher are shown.

ipaddr <IP>

If an IP is given as an additional parameter the given IP address is set as the IP address for Flasher. A default 16-bit subnet mask (255.255.0.0) is used. From this time Flasher uses this static IP, DHCP is disabled from this point.

ipaddr <IP> <Subnet mask>

If an IP and a subnet mask is given as an additional parameter, the given IP and the given subnet mask are used. From this time Flasher uses this static IP and subnet mask, DHCP is disabled from this point.

ipaddr DHCPIf DHCP is given as an additional parameter the use of DHCP is enabled.Previously made IP settings are discarded.

Table 2.1: ipaddr command description

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 25: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

25

2.4.2.2 Configuring Flasher via web interfaceFlasher comes with a web server, which provides a web interface for configuration.This enables you to configure Flasher without additional tools, just with a simple webbrowser. The Home page of the web interface shows the serial number, the currentIP address and the MAC address of the Flasher.

The Network configuration page allows you to configure the IP address, the subnetmask and the default gateway of Flasher. You can choose between automatic IPassignment and manual IP assignment by selecting the appropriate radio button. Ifyou choose manual, you can change the IP address, the subnet mask and thedefault gateway by entering the desired values in the appropriate fields and clickingchange. So, you do not have to care about any command syntax in order to changethe IP address/subnet mask/default gateway.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 26: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

26 CHAPTER 2 Setup

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 27: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

27

Chapter 3

Flasher STM8 related software

This chapter describes Segger�s Flasher STM8 related software portfolio available foruse with Flasher STM8 hardware.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 28: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

28 CHAPTER 3 Flasher STM8 related software

3.1 Flasher STM8 software and documentation pack-age

Flasher STM8 is shipped with a bundle of applications.

Software Description

JLinkSTM8.dll DLL for using Flasher STM8 with third-party programs.

STM8Commander.exe

Free command-line tool with basic functionality for target anal-ysis.

FlasherSTM8.exeStand-alone flash programming application. For more informa-tion about Flasher STM8 Software please refer to Flasher STM8 Software User�s Guide (UM05007).

Table 3.1: Flasher STM8 related software

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 29: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

29

3.2 Flasher STM8 software and documentation pack-age in detail

The Flasher STM8 software documentation package is shipped together with FlasherSTM8 and may also be downloaded from www.segger.com.

3.2.1 STM8 Commander (Command line tool)STM8 Commander (STM8Commander.exe) is a tool that can be used for verifyingproper installation of the USB driver and to verify the connection to the STM8 chip, aswell as for simple analysis of the target system. It permits some simple commands,such as memory dump, halt, step and go. You can get an overview of the availablecommands by simply using the [ENTER] key or "?".

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 30: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

30 CHAPTER 3 Flasher STM8 related software

3.2.2 Flasher STM8 Software (Program flash memory)Flasher STM8 is a software running on Windows 2000, Windows XP, Windows 2003,Windows Vista or Windows 7 systems and enables you to program your flash EEPROMdevices via the SWIM connector on your target system.

Flasher STM8 works with any STM8 system and supports the programming of internalflash of STM8 microcontrollers. It allows you to erase, fill, program, blank check,upload flash content, and view memory of your flash devices.

Features� Works with any STM8 chip� STM8 microcontrollers (internal flash) supported� Smart read-back: Only non-blank portions of flash transferred and saved� Easy to use, comes with projects for standard eval boards.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 31: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

31

3.3 Using the JLinkSTM8.dll

3.3.1 What is the JLinkSTM8.dll?The JLinkSTM8.dll is a standard Windows DLL typically used from C or C++, but alsoVisual Basic or Delphi projects. It makes the entire functionality of the Flasher STM8available through the exported functions.

The functionality includes things such as halting/running the STM8 core and reading/writing memory. Therefore, it can be used in any kind of application accessing anSTM8 core.

3.3.2 Determining the version of JLinkSTM8.dllTo determine which version of the JLinkSTM8.dll you are facing, the DLL version canbe viewed by right clicking the DLL in explorer and choosing Properties from thecontext menu. Click the Version tab to display information about the product ver-sion.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 32: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

32 CHAPTER 3 Flasher STM8 related software

3.3.3 Determining which DLL is used by a programTo verify that the program you are working with is using the DLL you expect it to use,you can investigate which DLLs are loaded by your program with tools like Sysinter-nals� Process Explorer. It shows you details about the DLLs, used by your program,such as manufacturer and version.

Process Explorer is - at the time of writing - a free utility which can be downloadedfrom www.sysinternals.com.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 33: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

33

Chapter 4

Working with Flasher STM8

This chapter describes functionality and how to use Flasher STM8.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 34: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

34 CHAPTER 4 Working with Flasher STM8

4.1 Operating modesFlasher STM8 is able to boot in 3 different modes:

� PC mode� Stand-alone mode� MSD (Mass storage device) mode

If Flasher STM8 can enumerate on the USB port, Flasher STM8 boots in "PC mode".In this mode Flasher STM8 can be used as an emulator. When Flasher is powered upand Flasher STM8 cannot enumerate, the "stand-alone mode" is started. In this modeFlasher STM8 can be used as a stand-alone flash programmer. When the Start/Stopbutton is kept pressed when Flasher is powered, Flasher STM8 boots in "MSD mode".In this mode Flasher STM8 boots as a mass storage device.

4.1.1 PC modeWhen you want to use Flasher STM8 for the first time you need to install the FlasherSTM8 related software and documentation pack. After installation, connect FlasherSTM8 to the host PC via USB.

4.1.1.1 Connecting the target systemPower-on sequence

In general, Flasher STM8 should be powered before connecting the target device.That means you should first connect Flasher STM8 with the host system via USB /ethernet / RS232 and then power up Flasher STM8 if not already powered via USB.Flasher STM8 will boot in "PC" mode. Then connect your target device to Flasher andpower up your target device.

Verifying target device connection with STM8Commander.exe

If the USB driver is working properly and your Flasher STM8 is connected to the hostsystem, you may connect Flasher STM8 to your target hardware. Then start the STM8command line tool STM8Commander.exe, which should now display the normal FlasherSTM8 related information and in addition to that it should report that it found anSTM8 target and the target�s communication speed. The screenshot below shows theoutput of STM8Commander.exe.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 35: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

35

4.1.1.2 Setting up Flasher STM8 for stand-alone modeIn order to set up Flasher STM8 for the "stand-alone mode" it has to be in "PC mode".When the correct connection of Flasher STM8 to the host PC is verified start theFlasher STM8 Software. For more information about Flasher STM8 Software, refer tothe Flasher STM8 Software User Guide. The Flasher STM8 related software and docu-mentation package contains the Flasher STM8 Software. When the Flasher STM8Software is started, open an appropriate Flasher project file and an appropriate datafile for the target you want to program.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 36: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

36 CHAPTER 4 Working with Flasher STM8

Now, choose File->Download to programmer from the menu in order to downloadthe target configuration as well as the data file to the Flasher STM8.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 37: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

37

After the download, you should see in the Flasher Log window that the Flasher.cfgand the Flasher.dat files have been successfully downloaded.

From now on, Flasher STM8 can be used in "stand-alone mode" for stand-alone pro-gramming.

4.1.2 Stand-alone modeIn order to use Flasher STM8 in "stand-alone mode", it has to be configured first, asdescribed in Setting up Flasher STM8 for stand-alone mode on page 35. To bootFlasher STM8 in the "stand-alone mode", just power up the Flasher STM8 withoutconnection to a PC via ethernet or USB. In the "stand-alone mode" Flasher STM8 canbe used as a stand-alone flash programmer.

Note: Flasher STM8 can only program the target device it was configured for. Inorder to program another target device, you have to reconfigure it following thesteps described in Setting up Flasher STM8 for stand-alone mode on page 35.

4.1.2.1 LED status indicatorsProgress and result of an operation is indicated by Flasher STM8�s LEDs:

Status of LED Meaning

GREEN, high frequency flashing (10 Hz)Enumerating Flasher STM8. This only happens before the first programming operation is performed.

GREEN, after programming operation has been started

Connect to target and perform init sequence.

Table 4.1: Flasher STM8 LEDs

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 38: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

38 CHAPTER 4 Working with Flasher STM8

4.1.3 MSD modeWhen pressing the Start/Stop button of Flasher STM8 while connecting it to the PCvia USB, Flasher STM8 will boot in the "MSD mode". This mode can be used to down-date a Flasher STM8 firmware version if a firmware update did not work properly andit can be used to configure Flasher STM8 for the "stand-alone mode", without usingFlasher STM8 Software. If Flasher STM8 has been configured for "stand-alone mode"before, there will be four files on the MSD, FLASHER.CFG, FLASHER.DAT, FLASHER.LOG,SERIAL.TXT.

FLASHER.CFG contains the configuration settings for programming the target deviceand FLASHER.DAT contains the data to be programmed. FLASHER.LOG contains all log-ging information about the commands, performed in stand-alone mode. TheSERIAL.TXT contains the serial number, which will be programmed next. Currently,Flasher STM8 Software does not support to configure Flasher STM8 for automatedserial number programming.

If you want to configure multiple Flasher STM8 for the same target you do not haveto use Flasher STM8 Software all the time. It is also possible to copy theFLASHER.CFG and the FLASHER.DAT files from a configured Flasher STM8 to anotherone. To copy these files boot Flasher STM8 in "MSD mode".

GREEN, slow blinking (1 Hz) Erasing/Programming/Verifying opera-tion is in progress.

GREEN Operation successful / Ready.RED Operation failed.

Status of LED Meaning

Table 4.1: Flasher STM8 LEDs

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 39: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

39

4.2 Multiple File SupportIt is also possible to have multiple data files and config files on Flasher STM8, tomake Flasher STM8 more easy to use in production environment. To choose the cor-rect configuration file and data file pair, a FLASHER.INI file is used. This init file con-tains a [FILES] section which describes which configuration file and which data fileshould be used for programming. A sample content of a FLASHER.INI file is shownbelow:

[FILES]DataFile = "Flasher1.dat"ConfigFile = "Flasher1.cfg"

Using this method, all configuration files and data files which are used in the produc-tion have to be downloaded once only. From there on a configuration file / data filepair can be switched by simply replacing the FLASHER.INI by a new one, which con-tains the new descriptions for the configuration file and data file. The FLASHER.INIcan be replaced in three ways:

1. Boot Flasher STM8 in MSD mode in order to replace the FLASHER.INI2. If Flasher STM8 is already integrated into the production line, runs in stand-alone

mode and can not be booted in other mode: Use the file I/O commands providedby the ASCII interface of Flasher STM8, to replace the FLASHER.INI. For moreinformation about the file I/O commands, please refer to File I/O commands onpage 52.

3. If Flasher STM8 is already integrated into the production line and is driven viaFlasher STM8 PC software: Use the file I/O commands provided by the FlasherSTM8 Commander to replace the FLASHER.INI. For more information about theSTM8 Commander please refer to STM8 Commander (Command line tool) onpage 29.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 40: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

40 CHAPTER 4 Working with Flasher STM8

4.2.1 Setting up configurations and switching configurationsThe following steps describe the way to setup and use multiple configurations andhow they can be exchanged using the STM8 Commander. Setup and exchanging con-figurations can be done via RS232 the same way except that the way of file access isslightly different using the ASCII command interface as described in ASCII commandinterface on page 50.

1. Setup your first configuration you wish to use with the Flasher using Flasher STM8Software.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 41: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

41

2. Use "File->Save programmer configuration file..." and save as "Flasher1.cfg" to atemporary directory.

3. Use "File->Save programmer data file..." and save as "Flasher1.dat" to a tempo-rary directory.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 42: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

42 CHAPTER 4 Working with Flasher STM8

4. Repeat the steps 1-3 to create an other configuration and save the files as"Flasher2.cfg" and "Flasher2.dat" to the same directory you saved the first set ofconfiguration files.

5. Create a text file named "FLASHER.ini" with the following content:

[FILES]DataFile = "Flasher1.dat"ConfigFile = "Flasher1.cfg"

6. The content of your temporary folder should now look like the following screen-shot:

Note: Steps from now on may slightly differ in command usage when using othercommunication channels such as RS232 ASCII interface but follow the same steps.

7. Start the STM8 Commander utility.

8. Delete old files on the Flasher using the "fdelete" command if you are unsure ifthe Flasher is empty. In the screenshot below no files were on the Flasher, there-for returning an error on these operations:

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 43: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

43

9. Download the files from your temporary folder to the Flasher using the "fwrite"command as shown in the screenshot below:

From now on the files "Flasher1.cfg" and "Flasher1.dat" will be used for stand-alone flashing.

10. If you wish to switch configurations please change your "FLASHER.ini" to containthe file names of the second set of configuration files.Then delete the old "FLASHER.ini" currently on your Flasher and download thenew one to activate the configuration for the second set of files.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 44: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

44 CHAPTER 4 Working with Flasher STM8

4.3 Connecting multiple Flasher to your PCYou can connect up to 4 Flasher to your PC. In this case, all Flasher must have differ-ent USB-addresses. The default USB-address is 0.

In order to do this, 3 Flasher must be configured as described below. Every Flasherneed its own J-Link USB driver which can be downloaded from www.segger.com.

Note: Flasher STM8 along with other USB featured SEGGER products use the J-Link USB driver. Therefore you can connect up to 4 devices which use this drivertotal.

4.3.1 How does it work?USB devices are identified by the OS by their product id, vendor id and serial number.The serial number reported by Flasher is always the same. The product id depends onthe configured USB-address.

� The vendor id (VID) representing SEGGER is always 1366� The product id (PID) for Flasher #1 is 101� The product id (PID) for Flasher #2 is 102 and so on.

A different PID means that Flasher is identified as a different device, requiring a newdriver. The driver for a new Flasher device will be installed automatically.

The sketch below shows a host, running two application programs. Each applicationcommunicates with one STM8 core via a separate Flasher.

Host (PC)

Target hardware 1

STM8#2

ApplicationInstance 2

ApplicationInstance 1

STM8#1

USB

SWIM

Flasher1

USB

SWIM

Flasher2

Target hardware 2

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 45: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

45

4.3.2 Configuring multiple Flasher STM81. Start STM8Commander.exe2. Type usbaddr = 1 to set the Flasher #1.

3. Unplug Flasher and then plug it back in.4. The system will recognize and automatically install a new Flasher using the J-Link

USB driver.

5. You can verify the driver installation by consulting the Windows device manager.If the driver is installed and your Flasher is connected to your computer, thedevice manager should list the J-Link USB drivers as a node below "UniversalSerial Bus controllers" as shown in the following screenshot:

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 46: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

46 CHAPTER 4 Working with Flasher STM8

4.3.3 Connecting to a Flasher with non default USB-AddressRestart STM8Commander.exe and type usb 1 to connect to Flasher #1.

You may connect other Flasher to your PC and connect to them as well. To connect toan unconfigured Flasher (with default address "0"), restart STM8Commander.exe ortype usb 0.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 47: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

47

Chapter 5

Remote control

This chapter describes how to control Flasher STM8 via the 9-pin serial interface con-nector or via TCP/IP.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 48: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

48 CHAPTER 5 Remote control

5.1 OverviewThere are 4 ways to control Flasher STM8 operation:

� Manual: Programming operation starts when pressing the button. The LEDs serveas visible indication.

� Via Handshake lines: 3 lines on the serial interface are used.1 line is an input and can be used to start operation,2 lines are outputs and serve as Busy and status output

� Terminal communication via RS232� Terminal communication via TCP/IP.

Note: All four ways to control Flasher STM8 operation can only be used if FlasherSTM8 is in standalone mode. In PC / MSD mode they have no effect.For TCP/IP terminal communication Flasher STM8 switches automatically from PCmode to standalone mode on receiving the first program command via terminal.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 49: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

49

5.2 Handshake controlFlasher STM8 can be remote controlled by automated testers without the need of aconnection to PC and Flasher STM8�s PC program. Therefore Flasher STM8 isequipped with additional hardware control functions, which are connected to theSUBD9 male connector, normally used as RS232 interface to PC.

The following diagrams show the internal remote control circuitry of Flasher STM8:

Pin No. Function Description

1 START

A positive pulse of any voltage between 5 and 30V with dura-tion of min. 30 ms starts �Auto� function (Clear / Program / Verify) on falling edge of pulse. The behavior of the "Auto" function depends on the project settings, chosen in Flasher STM8 Software at the Production tab.

4 BUSY As soon as the "Auto" function is started, BUSY becomes active, which means that transistor is switched OFF.

5 GND Common Signal ground.

7 OKThis output reflects result of last action. It is valid after BUSY turned back to passive state. The output transistor is switched ON to reflect OK state.

Table 5.1: Flasher STM8 LED status

470

470

22k

4k7

BUSY

OK

STARTFlasher STM 8internal Logic1

4

7

5

START

BUSY

OK previous state validOK

Not OK

Ready

BUSY

Undefined

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 50: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

50 CHAPTER 5 Remote control

5.3 ASCII command interface

5.3.1 IntroductionOnce set up using Flasher STM8 Software, Flasher STM8 can be driven by any appli-cation or just a simple terminal using ASCII commands.

Every known command is acknowledged by Flasher and then executed. After com-mand execution, Flasher sends an ASCII reply message. If an unknown command isreceived, Flasher responds with #NACK.

5.3.2 General command and reply message format� Any ASCII command has to start with the start delimiter #.� Any ASCII command has to end with simple carriage return (ASCII code 13)� Commands can be sent upper or lower case.

5.3.3 Communication port settingsFlasher can be driven via TCP/IP or via a RS232 serial port with the following inter-face settings:

� 8 data bits,� no parity� 1 stop bit

at 9600 baud.

5.3.4 Commands to FlasherThe following commands are supported by the current version of Flasher firmware:

#AUTO

The #AUTO command behaves exactly as the start button or external remote controlinput.

Usually, the following command sequence will be performed when receiving the#AUTO command:

� Flasher starts erasing� Flasher programs target CPU� Flasher verifies target CPU

Depending on the settings chosen in the Production tab in Flasher STM8 Software,this sequence can differ from the one shown above.

Finally, Flasher responds with

� #OK if no error occurred� #ERRxxx if any error occurred during operation. xxx represents the error code,

normally replied to Flasher PC program. The #ERRxxx message may be followedby an additional error text.

During execution of the #AUTO command, Flasher automatically sends �status� mes-sages via RS232 to reflect the state of execution. Typically during execution of #AUTOcommand, Flasher will reply the following sequence of messages:

#ACK#STATUS:INITIALIZING#STATUS:CONNECTING#STATUS:UNLOCKING#STATUS:ERASING#STATUS:PROGRAMMING#STATUS:VERIFYING#OK (Total 13.993s, Erase 0.483s, Prog 9.183s, Verify 2.514s)

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 51: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

51

#AUTO NOINFO

This command may be used instead of #AUTO, if no status messages from Flashershould be sent during execution. The NOINFO extension is also available for all othercommands.

The command ends with #OK or #ERRxxx

#ERASE

This command can be sent to erase all selected target flash sectors.

Flasher will reply the following sequence of messages:

#ACK#STATUS:INITIALIZING#STATUS:CONNECTING#STATUS:UNLOCKING#STATUS:ERASING#OK (Total 0.893s, Erase 0.483s)

#START

This command can be sent to release Flasher�s target interface. All signals fromFlasher to target will be set into high-Z mode, reset of target will be released. It maybe used to start target application program.

Flasher will reply with the following sequence of messages:

#ACK#STATUS:INITIALIZING#STATUS:CONNECTING#OK (Total 1.148s)

#STATUS

This command can be sent any time, even during other command execution. Flasherresponds with its current state. All defined state messages are described under Replyfrom Flasher STM8 on page 54.

#PROGRAM

This command can be used instead of #AUTO to program a target without erasing thetarget before programming and without performing a final verification.

#VERIFY

This command can used to verify the target Flash content against the data stored inFlasher.

#RESULT

This command can be sent any time, even during other command execution. Flasherresponds with the last result of the previously executed command.

#CANCEL

This command can be sent to abort a running program. It may take a while until thecurrent program is actually canceled.

Flasher will respond with:

#ERR007:CANCELED.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 52: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

52 CHAPTER 5 Remote control

#BAUDRATE<Baudrate>

This command can be sent in order to change the baudrate of the UART used for theASCII command interface communication. <Baudrate> is expected in decimal format.

If this command succeeds, Flasher responds with:

#ACK#OK

Otherwise it will respond with one of the following error messages:

#ERR255: Invalid parameters

or

#ERR255: Baudrate is not supported

Note: After sending the #BAUDRATE command you will first have to wait until theFlasher responds with the #OK message. It is recommended wait 5ms before sendingthe next command with the new baudrate in order to give the Flasher the time tochange the baudrate.

5.3.4.1 File I/O commandsThe ASCII interface of Flasher STM8 also supports file I/O operations via RS232. Thefollowing file I/O commands are supported:

#FOPEN <Filename>

The #FOPEN command is used to open a file on Flasher for further file I/O operations.<Filename> specifies the file on the Flasher which should be opened. If <Filename>can not be found on Flasher a new one will be created.

A typical sequence using the #FOPEN command does look like as follows:

#FOPEN flasher.dat#ACK#OK

Note: Currently only one file can be open at the same time. If #FOPEN is sent andanother file is already open, Flasher will respond with:

#ACK#ERR255:A file has already been opened

#FCLOSE

The #FCLOSE command closes the file on Flasher which was opened via #FOPEN. Afterthis command has been issued further file I/O operations except #FDELETE are notallowed until the #FOPEN command is sent again.

A typical sequence when using the #FCLOSE command looks as follows:

#FCLOSE#ACK#OK

Note: When using the #FCLOSE command a file has to be open (previouslyopened by #FOPEN). Otherwise Flasher will respond with the following error reply:

#ACK#ERR255:No file opened

#FDELETE <Filename>

The #FDELETE command is used to delete a file on Flasher where <Filename> speci-fies the name of the file.

A typical sequence when using the #FDELETE command looks as follows:

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 53: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

53

#FDELETE flasher.dat#ACK#OK

Note: If deletion of the file fails for example if the file does not exist, Flasher willrespond with the following sequence:

#ACK#ERR255:Failed to delete file

#FWRITE <Offset>,<NumBytes>:<Data>

The #FWRITE command is used to write a file. <Offset> specifies the offset in the file,at which data writing is started. <NumBytes> specifies the number of bytes which aresent and which are written into the file on Flasher. <NumBytes> is limited to 512 bytesat once. This means, if you want to write e.g. 1024 bytes, you have to send the#FWRITE command twice, using an appropriate offset when sending it the secondtime.

<Offset> and <NumBytes> are expected in hexadecimal format.

#FWRITE 0,200:<Data>#FWRITE 200,200:<Data>

The data is expected in hexadecimal format (two hexadecimal characters per byte).The following example illustrates the use of #FWRITE:

Data to be sent: Hello !ASCII values: 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x21

#FWRITE 0,7:48656C6C6F2021

Note: In order to use the #FWRITE command a file has to be opened via the#FOPEN command, first. Otherwise Flasher will respond with the following sequence:

#ACK#ERR255:No file opened

#FREAD <Offset>,<NumBytes>

The #FREAD command is used to read data from a file on Flasher. <Offset> specifiesthe offset in the file, at which data reading is started. <NumBytes> specifies the num-ber of bytes which should be read.

A typical sequence when using the #FREAD command looks as follows:

#FREAD 0,4#ACK#OK:04:466c6173

If the #FREAD command succeeds, Flasher will finally respond with a #OK:<Num-Bytes>:<Data> reply message. For more information about the Flasher reply mes-sages, refer to Reply from Flasher STM8 on page 54.

Note: In order to use the #FREAD command, a file has to be opened before, usingthe #FOPEN command. Otherwise Flasher will respond with the following sequence:

#ACK#ERR255:No file opened

#FSIZE

The #FSIZE command is used to get the size of the currently opened file on Flasher.

A typical sequence when using the #FSIZE command looks as follows:

#FSIZE#ACK#OK:10 // file on flasher which is currently open, has a size of 16 bytes

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 54: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

54 CHAPTER 5 Remote control

If the #FSIZE command succeeds, Flasher will respond with a #OK:<Size> reply mes-sage. For more information about the Flasher reply messages, please refer to Replyfrom Flasher STM8 on page 54.

Note: In order to use the #FREAD command, a file has to be opened before, usingthe #FOPEN command. Otherwise Flasher will respond with the following sequence:

#ACK#ERR255:No file opened

5.3.5 Reply from Flasher STM8The reply messages from Flasher follow the same data format as commands. Anyreply message starts with ASCII start delimiter #, ends with simple carriage return(ASCII code 13) and is sent in uppercase. In contrast to commands, replies can befollowed by a description message, which gives more detailed information about thereply. This description is sent in mixed case. The #OK reply, for example, is such areply. It is followed by a string containing information about the performance timeneeded for the operations:

#OK (Total 13.993s, Erase 0.483s, Prog 9.183s, Verify 2.514s)

The following reply messages from Flasher are defined:

#ACK

Flasher replies with #ACK message on reception of any defined command before thecommand itself is executed.

#NACK

Flasher replies with #NACK, if an undefined command was received.

#OK

Flasher replies with #OK, if a command other then #STATUS or #RESULT was executedand ended with no error.

#OK:<NumBytes>:<Data>

Flasher replies with #OK:<Len>:<Data> if a #FREAD command was executed. <Num-Bytes> is the number of bytes which could be read. This value may differ from thenumber of requested bytes, for example if more bytes than available, wererequested. <NumBytes> and <Data> are send in hexadecimal format (for <Data>: twohexadecimal characters per byte).

#OK:<Size>

Flasher replies #OK:<Size> if a #FSIZE command has been executed. <Size> is thesize (in bytes) of the currently opened file. <Size> is send in hexadecimal format.

#STATUS:

Flasher replies with its current state.

The following status messages are currently defined:

Message Description

#STATUS:READYFlasher is ready to receive a new command.

#STATUS:CONNECTINGFlasher initializes connection to tar-get CPU.

#STATUS:INITIALIZINGFlasher performs self check and internal init.

#STATUS:UNLOCKING Unlocking flash sectors.Table 5.2: List of status messages that are currently defined

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 55: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

55

#STATUS:ERASINGFlasher is erasing the flash of the target device.

#STATUS:PROGRAMMINGFlasher is programming the flash of the target device.

#STATUS:VERIFYINGFlasher verifies the programmed flash contents.

Message Description

Table 5.2: List of status messages that are currently defined

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 56: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

56 CHAPTER 5 Remote control

#ERRxxx

If any command other than #STATUS or #RESULT was terminated with an error,Flasher cancels the command and replies with an error message instead of #OK mes-sage.

Some error codes may be followed by colon and an additional error text.

For example:

#ERR007:CANCELED.

The error code numbers are described in the following table:

Message Description

#ERR007Flasher received #CANCEL command and has canceled the current opera-tion.

#ERR255Undefined error occurred. This reply is followed by an error string.

Table 5.3: List of error code numbers which are currently defined

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 57: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

57

Chapter 6

Hardware

This chapter gives an overview about Flasher STM8 specific hardware details, such asthe pinouts and available adapters.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 58: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

58 CHAPTER 6 Hardware

6.1 10-pin connector (obsolete)First production charge of Flasher STM8has a 10-pin connector. The connector is a10 way Insulation Displacement Connector(IDC) keyed box header (male) that mateswith IDC sockets mounted on a ribboncable.

This 10-pin connector is obsolete and willnot be available on future Flasher ver-sions.

The signal outputs of the 10-pin interface are the same as for the 4-pin connector.Therefore, if needed for a specific hardware, an adapter cable can be soldered byusing a 4-pin "Ernie" cable and soldering one end to a 10-pin header.

6.1.1 10-pin connector pinoutThe following table lists the Flasher STM8 10-pin connector pinout.

Pins 1, 3, 5 are GND pins connected to GND in Flasher STM8. They should also beconnected to GND in the target system.

Pins 4, 8, 9, 10 are not connected in Flasher STM8. They should also be not con-nected in the target system.

PIN SIGNAL TYPE Description

2 SWIM I/OOpen drain output, tristateable, with 100 Ohms series resis-tor to target.This is the pin used to transfer SWIM input/output data.

6 Reset I/O

Open collector with 100 Ohms series resistor to target.Target CPU reset signal. Typically connected to the RESET pin of the target CPU, which is typically called "nRST", "nRESET" or "RESET".

7 VCCT I/OTarget voltage reference or target supply pin.Has to be connected to the target CPUs supply voltage. It may be used to supply the target board.

Table 6.1: Flasher STM8 10-pin connector pinout

1 2

3 4

5 6

7 8

9 10

GND

GND

GND

VCCT

NC

SWIM

Reset

NC

NC

NC

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 59: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

59

6.2 4-pin ConnectorFlasher STM8 has a 4-pin connector. The connector is a 4way connector keyed box header (male) that mates witha connector of type ERNI 214012 mounted on a ribboncable.

6.2.1 4-pin connector pinoutThe following table lists the Flasher STM8 4-pin connec-tor pinout.

Pins 3 is GND pin connected to GND in Flasher STM8. It should also be connected toGND in the target system.

PIN SIGNAL TYPE Description

1 VCCT I/OTarget voltage reference or target supply pin.Has to be connected to the target CPUs supply voltage. It may be used to supply the target board.

2 SWIM I/OOpen drain output, tristateable, with 100 Ohms series resis-tor to target.This is the pin used to transfer SWIM input/output data.

4 Reset I/O

Open collector with 100 Ohms series resistor to target.Target CPU reset signal. Typically connected to the RESET pin of the target CPU, which is typically called "nRST", "nRESET" or "RESET".

Table 6.2: Flasher STM8 4-pin connector pinout

1

2

34 Reset

GND

VCCTSWIM

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 60: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

60 CHAPTER 6 Hardware

6.3 Connection cableThe standard cable which is delivered with Flasher STM8 to connect a target to theFlasher is a 4 way ribbon cable of type ERNI part no. 839016 (100mm) mounted withkeyed header (female) mounted on both sides (resulting in a total length of around120mm).

Flasher STM8 is tested with the delivered cable for being fully functional. Using yourown cable or using a different cable length is not recommended as proper functioncan not be guaranteed. Using a different cable is on your own risk.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 61: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

61

6.4 Target board design for SWIMWe strongly advise following the recommendations given by the chip manufacturer.These recommendations are normally in line with the recommendations given in thetable 10-pin connector pinout on page 58 and 4-pin connector pinout on page 59. Incase of doubt you should follow the recommendations given by the semiconductormanufacturer.

To be on the safe side SEGGER recommends the GND connections of the Flasher to bealways connected to the the ground of the power supply of the target to suppressspikes during connecting or disconnecting your target hardware to/from Flasher.

Note: Flasher STM8 uses 100 Ohms resistor on SWIM and reset line. We expectthe target hardware to use pull-up resistors between 2.2 kOhms to 10 kOhms onboth lines.

6.4.1 Target power supplyPin 1 of the connector can be used to supply power to the target hardware. Supplyvoltage is 5V, max. current is 300mA. The output current is monitored and protectedagainst overload and short-circuit.

Power can be controlled via commands using the STM8 Commander. The followingcommands are available to control power:

Command Explanation

power on Switch target power onpower off Switch target power offpower on perm Set target power supply default to "on"power off perm Set target power supply default to "off"

Table 6.3: Command List

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 62: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

62 CHAPTER 6 Hardware

6.5 How to determine the hardware versionTo determine the hardware version of your Flasher STM8, you should first look at thelabel at the bottom side of the unit. The hardware version is printed on the backlabel.

If this is not the case with your Flasher STM8, you can use STM8Commander.exe todetermine your hardware version (if Flasher STM8 is in PC mode). As part of the ini-tial message, the hardware version is displayed. For more information about how toensure that Flasher STM8 is in PC mode, please refer to PC mode on page 34.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 63: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

63

Chapter 7

Background information

This chapter provides background information about flash programming in general. Italso provides information about how to replace the firmware of Flasher STM8 manu-ally.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 64: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

64 CHAPTER 7 Background information

7.1 Flash programmingFlasher STM8 comes with a DLL, which allows - amongst other functionalities - read-ing and writing RAM and starting and stopping the CPU.

7.1.1 How does flash programming via Flasher STM8 work ?This requires extra code. This extra code typically downloads a program into the RAMof the target system, which is able to erase and program the flash. This program iscalled RAM code and "knows" how to program the flash; it contains an implementa-tion of the flash programming algorithm for the particular device. The RAM coderequires data to be programmed into the flash memory. The data is supplied bydownloading it to RAM.

An other way to program is in circuit programming. This is done by writing to thespecific registers that need to be programmed via SWIM directly. Depending on theflash type and size of the flash this may result in slower programming speed thenprogramming with usage of RAM (RAM code usage).

7.1.2 Data download to RAMThe data (or part of it) is downloaded to another part of the RAM of the target sys-tem. The Instruction pointer of the CPU is then set to the start address of the Ramcode, the CPU is started, executing the RAM code. The RAM code, which contains theprogramming algorithm for the flash chip, copies the data into the flash chip. TheCPU is stopped after this. This process may have to be repeated until the entire datais programmed into the flash.

7.1.3 Available options for flash programmingIn general, there are two possibilities in order to use Flasher STM8 for flash program-ming:

� Using Flasher STM8 stand-alone to program the target flash memory (stand-alone mode)

� Using Flasher STM8 in combination with Flasher STM8 Software to program thetarget flash memory (Flasher STM8 in "PC mode")

7.1.3.1 Using Flasher STM8 in stand-alone modeIn order to use the Flasher STM8 in stand-alone mode, it has to be configured first.For more information about how to setup Flasher STM8 for using in "stand-alonemode", please refer to Setting up Flasher STM8 for stand-alone mode on page 35.

7.1.3.2 Flasher STM8 Software - Complete flash programming solutionFlasher STM8 Software is a stand-alone Windows application, which can read / writedata files and program the flash in all STM8 systems. For more information aboutFlasher STM8 Software please refer to the Flasher STM8 Software User Guide, whichcan be downloaded from our website http://www.segger.com.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 65: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

65

Chapter 8

Support and FAQs

This chapter contains troubleshooting tips together with solutions for common prob-lems which might occur when using Flasher STM8. There are several steps you cantake before contacting support. Performing these steps can solve many problems andoften eliminates the need for assistance. This chapter also contains a collection offrequently asked questions (FAQs) with answers.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 66: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

66 CHAPTER 8 Support and FAQs

8.1 Contacting supportBefore contacting support, make sure you tried to solve your problem by trying yourFlasher STM8 with another PC and if possible with another target system to see if itworks there. If the device functions correctly, the USB setup on the original machineor your target hardware is the source of the problem, not Flasher STM8.

If you need to contact support, send the following information to [email protected]:

� A detailed description of the problem� Flasher STM8 serial number� Information about your target hardware (processor, board, etc.).� FLASHER.CFG, FLASHER.DAT, FLASHER.LOG, SERIAL.TXT file from Flasher STM8.

To get these files, Flasher STM8 has to be in MSD mode. For more informationabout how to boot Flasher STM8 in MSD mode, please refer to MSD mode onpage 38.

Flasher STM8 is sold directly by SEGGER.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 67: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

67

8.2 Frequently Asked QuestionsMaximum download speed

Q: What is the maximum download speed supported by Flasher STM8 ?A: Flasher STM8�s maximum supported programming speed depends on flash pro-

gramming speed supported by your target chip.Programming a 128kByte device can be done in less than 9 seconds resulting inspeeds of about 14-15 kByte/sec.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 68: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

68 CHAPTER 8 Support and FAQs

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 69: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

69

Chapter 9

Glossary

This chapter describes important terms used throughout this manual.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 70: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

70 CHAPTER 9 Glossary

Big-endian

Memory organization where the least significant byte of a word is at a higher addressthan the most significant byte. See Little-endian.

Coprocessor

An additional processor that is used for certain operations, for example, for floating-point math calculations, signal processing, or memory management.

Host

A computer which provides data and other services to another computer. Especially, acomputer providing debugging services to a target being debugged.

ID

Identifier.

Image

An executable file that has been loaded onto a processor for execution.

Processor Core

The part of a microprocessor that reads instructions from memory and executesthem, including the instruction fetch unit, arithmetic and logic unit, and the registerbank. It excludes optional coprocessors, caches, and the memory management unit.

Target

The actual processor (real silicon or simulated) on which the application program isrunning.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 71: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

71

Chapter 10

Literature and references

This chapter lists documents, which we think may be useful to gain a deeper under-standing of technical details.

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 72: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

72 CHAPTER 10 Literature and references

Reference Title Comments

[Flasher STM8 Software]

Flasher STM8 Software User Guide

This document describes the Flasher STM8 Software. It is pub-licly available from SEGGER (www.segger.com).

Table 10.1: Literature and References

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 73: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

73

Index

BBig-endian ..........................................70

CCoprocessor ........................................70

FFlasher STM8

Features ...........................................10Specifications ....................................11

Flasher STM8 Software .........................30

HHost ...................................................70

IID .....................................................70Image ................................................70

PProcessor Core ....................................70

SSTM8 Commander ...............................29Support ........................................ 65, 69SWIM

10-pin connector ...............................584-pin connector .................................59Connection cable ...............................60

TTarget ................................................70

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG

Page 74: Flasher STM 8 User Guide - Farnell element14 product of SEGGER Microcontroller GmbH & Co. KG Flasher STM8 Manual Rev. 9 User guide of the stand-alone SWIM programmer for STM8 Cores

74 Index

Flasher STM8 (UM05006) © 2011 SEGGER Microcontroller GmbH & Co. KG


Recommended