A key requirement for most Flash-memory-based systems is the ability to update firmware
once the system is installed in the end product. This is referred to as in-application
programming (IAP). The purpose of this application note is to provide general guidelines for
creating an IAP application.
STM32F10x microcontrollers can run user-specific firmware to perform the IAP of their
embedded Flash memory. This feature allows the use of any type of communication protocol
for the reprogramming process (such as CAN, USART, USB, SPI, I2C, etc.).
This application note describes how to perform in-application programming using the
STM32F10x’s I2C peripheral. As a first step, the Aardvark tool is used as the host sending
the IAP commands to the STM32F10x. As a second step, the host is another STM32F10x
microcontroller that behaves as a bridge between the PC and the target (USB/I2C bridge).
The STM32F10x behaves as an I2C memory that can be programmed, erased and read via
the I2C/ interface.
For further information on the STM32F10x family features, pinout, electrical characteristics,
mechanical data and ordering information, please refer to the STM32F10x datasheets
available from the STMicroelectronics website: www.st.com.
The STM32 firmware libraries are available from www.st.com.
The versions of the Aardvark host adapter used during the development are listed below:
●Firmware: Aardvark I2C/SPI Control Center v3.52 -2009.0130
●Hardware: Aardvark I2C/SPI v3.0
For further information on the Aardvark host adapter and its software, please refer to its
documentation on www.st.com.
Figure 8.Hardware connection between the host master and the STM32 I
Figure 9.Read packet sequence using the I
Figure 10.Write packet sequence using the I
Figure 11.Erase Page packet sequence using the I
Figure 12.Erase User Space Memory packet sequence using the I
Figure 13.Go To User Code sequence using the I
Figure 14.IAP I
Figure 15.Configuration of Aardvark I
Figure 16.Read command using the Aardvark I
Figure 17.Read command I
Figure 18.Write command using the Aardvark I
Figure 19.Write command I
Figure 20.Aardvark I
Figure 21.IAP I
Figure 22.IAP I
The IAP driver must be programmed from the Flash memory base address via the JTAG or
SWD interface using a development toolchain. This driver uses the I2C to load a file from
the host to the STM32F10x’s internal Flash memory, and then executes it.
1.2 User program conditions
The IAP application is loaded from the Flash memory base address (0x0800 0000) to the
0x0800 0FFF address. The user application therefore has to be loaded from the
0x0800 1000 address to the top Flash memory address.
Figure 1.Flash memory usage
6/10Doc ID 16393 Rev 1
AN3078IAP overview
1.3 Global flowchart
Figure 2.Global flowchart
Start
Switch to IAP
IAP program
No
A pin connected to a push-button is used to select between jumping to the user application
and executing IAP for reprogramming purposes:
●at reset, when the push-button is pressed IAP is executed
●otherwise, a jump to the user program is performed
1.4 IAP commands
1.4.1 Read command
The read command is used to read data from the STM32’s Flash memory, starting from any
Flash address in the user space memory.
Reset
pressed
Yes
Yes
User button
pressed
No
Switch to User program
User program
No
Reset
pressed
Yes
ai17365
Doc ID 16393 Rev 17/10
Loading...
+ 14 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.