This application note describes the easy programmer which is a low cost solution allowing
the content of the STM8A Flash program memory to be updated when the chip is already
soldered on the application board. The easy programmer works by calling the functions of
the bootloader, an IAP application embedded in the system memory of the device (the ROM
memory). Through the bootloader firmware, the device memory can be erased and
programmed using one of the standard communication interfaces present on the particular
device. The easy programmer interfaces the bootloader using a serial port (USART
protocol) with the application board for the upload.
Section 2 of this document gives a brief introduction to the STM8A bootloader. Section 3,
Section 4, and Section 5 describe the easy programmer procedure and its software and
hardware requirements.
For further information on the STM8A family features, pinout, electrical characteristics,
mechanical data and ordering information, please refer to the STM8A128 Kbyte and STM8A
32 Kbyte datasheets. For more details on the bootloader, please refer to the bootloader user
manual (UM0500). All documents are available onst.com.
AN2792
Application note
STM8A easy programmer
This document, its associated firmware, and other such application notes are written to
accompany the STM8S firmware library which is available onst.com.
The bootloader code is stored in the internal boot ROM memory. Its main task is to
download the application program into the internal memories through the USART, LINUART,
SPI, or CAN peripherals.
The main features of the bootloader are:
●Polling the serial interface (USART and LINUART are both configured as a normal
UART, SPI or CAN) to check which peripheral is used
●Programming code, data, option bytes and/or the vector table at the address(es)
received from the host.
The STM8A reset vector is located at the beginning of the boot ROM (6000h), while the
other vectors are in the Flash program memory starting at address 8004h.
The device jumps inside the boot ROM area and after checking certain address locations
(see Table 1: Initial checking on page 6), it jumps to the reset vector in the Flash program
memory (8000h).
2.1 Bootloader flowchart description
The bootloader activation flowchart is shown in Figure 1 on page 4. The basic steps are
described below.
3/12
Bootloader descriptionAN2792
GET cmd
Figure 1.Bootloader activation flowchart
ROM reset
(6000h)
1
Disable all interrupt sources
2
3rd condition verified
Checks according to
Table 1
2nd condition verified
1st condition verified
Yes (memory read out protected)
Ye sNo
4
Initializes CAN at
125 kbps
Configure HSI and initialize RX-LINUART pin (PD6) and
RX-USART pin (PDA) in GPIO mofe (pull-up state).
Received a byte/message! = SYNCHR
6
SYNCHR
failed
RM cmdEM cmd
GET cmd
routine
RM cmd
routine
Is ROP active?
No (memory not read out protected)
Is an external clock present?
Configure SPI in slave mode
6
Wait for SYNCHR
SYNCHR received
Send ACK byte and disable unused
peripherals. Execute RASS KEYs
Wait for a command
Command received
EM cmd
routine
Timeout (1 s)
8
WM cmdGO cmd
WM cmd
routine
3
4
7
Is Flash virgin?
Recover the registers
SD cmd
SD cmd
routine
5
No
reset status
6
Ye s
6
GO cmd
routine
Remove EM and WM
Flash reset
(8000h)
routines from the RAM
Jump to host address
ai15000b
1. See flowchart description below for explanation of points 1 to 8.
2. Dotted routines are loaded in RAM by the host. They are removed by the go command before jumping to the Flash program
memory to execute an application.
4/12
Loading...
+ 8 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.