Skip to content
gicking edited this page Aug 29, 2017 · 19 revisions

Welcome to the stm8gal Wiki!

License / Disclaimer

  • stm8gal and it's source code is distributed under the Apache License Version 2.0 (see License)

  • exception is some RAM code, which is required for flash programming. This code is available on the STM Homepage. All rights to this RAM code remain with STM.

Overview

stm8gal is an application for programming or reading out the STM8 microcontroller using the built-in ROM bootloader (BSL) via RS232/USB, or UART interface. It is compatible with Windows, MacOS X and all flavours of Linux, including Raspbian. For a list of tested configurations see supported platforms.

Note: stm8gal is identical to STM8_serial_flasher. It was only renamed after a proposal by Philipp Krause

Tools with similar functionality are:

Notes:

  • this tool has been tested only for a few devices (see supported platforms). Theoretically it should work for all STM8 devices, especially since STM8AF, STLUX, STNRG, STM8SPLNB are mere test variants of STM8S. And STM8AL, STM8T are test variants of STM8L. But, as said, this has not been tested, so any feedback is highly appreciated!

  • the popular STM8S Discovery and STM8L Discovery boards connect to the PC via SWIM (=debug) interface, so a separate USB-UART adapter is required to connect to the respective UART pins directly. For an example see hardware setup.

  • exception is the Raspberry Pi or similar “embedded PCs“ with direct access to UART pins at the GPIO connector. For hardware setup see page hardware setup.

  • when directly connecting IO pins, pay special attention to compatible voltage levels, e.g. never connect a 5V adapter to 3.3V STM8 pins ore vice versa!

  • the STM8 ROM bootloader (=BSL) must be enables for uploading new code

    • for virgin devices (i.e. flash erased) the BSL is automatically enabled

    • for other devices the BSL can be re-enabled

      • with the free ST Visual Programmer application (Windows only) by STM

      • by uploading and running the STM8 program in subfolder BSL_activate using stm8flash by Valentin Dudouyt (programmer via SWIM interface)

    • stm8gal by default activates the BSL after upload (see page usage)

  • the BSL can be entered only within 1s after reset. Reset can be triggered manually (reset button), via DTR (requires connection of DTR to STM8 RST pin), or via Raspberry Pi pin GPIO18 (see page hardware setup)

  • the BSL is supported by most STM8 UARTs. However, some operate in "reply mode", which require a "Rx echo" for each sent byte. This mode is implemented to support single-wire interfaces like LIN or ISO9141.

    • for an overview of STM8 devices and UART modes see the BSL reference

    • in case of dual wires (as shown in hardware setup), stm8gal has to echo each received byte individually, which leads to a much lower upload speed. For options see page usage

  • for a full BSL documentation see UM0560 by STM. The STM32 uses a very similar communication protocol, so adapting the flasher tool for STM32 should be straightforward. However, I have no board available, but please feel free to go ahead...

See other Wiki pages for instructions on building, hardware setup, and using the software. Have fun! :-)

Clone this wiki locally