herunterladen
June 2011 Doc ID 14614 Rev 3 1/27
PM0051
Programming manual
How to program STM8S and STM8A
Flash program memory and data EEPROM
Introduction
This manual describes how to program Flash program memory and data EEPROM on
STM8 microcontrollers. It applies to access and performance line STM8S and medium and
high density STM8A devices. It is intended to provide information to the programming tool
manufacturers and to the customers who want to implement programming by themselves on
their production line.
The in-circuit programming (ICP) method is used to update the content of Flash program
memory and data EEPROM while the user software is not running. It uses the Single wire
interface module (SWIM) to communicate between the programming tool and the device.
In contrast to the ICP method, in-application programming (IAP) can use any
communication interface supported by the microcontroller (I/Os, SPI, USART, I
2
C, USB,
CAN...). IAP has been implemented for users who want their application software to update
itself by re-programming the Flash program memory during program execution. The main
advantage of IAP is its ability to re-program Flash program memory and data EEPROM
when the chip has already been soldered on the application board and while the user
software is running. Nevertheless, part of the Flash program memory has to be previously
programmed using ICP.
Some devices also contain a bootloader embedded in a ROM memory. Through this
firmware the device memory can be re-programmed using a standard communication
interface. This programming method is not described in this document.
For details on memory implementation and features, registers or stack top addresses, refer
to the product datasheets.
Related documents
● STM8 SWIM communication protocol and debug module (UM0470)
● STM8 bootloader user manual (UM0560)l
● STM8S and STM8A microcontroller families reference manual (RM0016)
● Basic in-application programming example using the STM8 I
2
C and SPI peripherals
(AN2737)
● STM8 in-application programming example (AN2659)
● Performance line datasheet (high density Flash program and data EEPROM)
● Access line datasheets (low and medium density Flash program and data EEPROM)
● STM8A datasheets (up to 32 Kbytes and up to 128 Kbytes of Flash program memory)
www.st.com