|
AN2737 Datasheet, PDF (9/16 Pages) STMicroelectronics – Basic in-application programming example | |||
|
◁ |
AN2737
IAP example with I2C
1.3.4
Current write command
The current write command allows data to be written in the Flash program memory or data
EEPROM of the STM8, starting from the current address which is set to 4000h after a
firmware reset.
The packet sequence to achieve a âcurrent writeâ with the Aardvark software and the STM8
I2C is summarized in Figure 7.
Figure 7. Current write packet sequence
START
ADD SLV DEVICE-W
ACK-S
Bytes sent by master
ACK-S
STOP
1.3.5
The following points explain how to write current bytes using the Aardvark software:
1. Select the master tabsheet, set the slave address and the bitrate, and uncheck the 10-
bit addressing as per Section 1.3.2: Current read command on page 5.
2. Enter the data to be writen in the Flash program memory at the current address in the
âmessage windowâ text box.
3. Uncheck the âno stopâ option.
4. Press the âmaster writeâ button to send the data to the firmware.
At the end of this command, the data are written in the Flash program memory. They can be
verified using the STVD memory window. The LCD displays the message âwriting OKâ.
Random write command
The random write command allows data to be written in the Flash program memory or data
EEPROM of the STM8, starting from any address in the range 8000hâ027FFFh or
4000hâ47FFh.
The packet sequence to achieve a ârandom writeâ with the Aardvark software and the STM8
I2C is summarized in Figure 8
Figure 8. Random write packet sequence
START ADD SLV DEVICE-W ACK-S
Start program address
ACK-S
Current write
Two steps are required to perform a random write with the Aardvark host adapter software.
Step1 sends the first address to be writen to the firmware. This is done as follows:
1. Select the master tabsheet, set the slave address and the bitrate, and uncheck the 10-
bit addressing mode option as per Section 1.3.2: Current read command on page 5.
2. Enter the âstart addressâ in the âmessage windowâ text box. It corresponds to the first
address to be writen to the Flash program memory.
3. Check the âno stopâ option.
4. Press the âmaster writeâ button to send the start address to the firmware.
At the end of this command, the firmware has initialized its internal pointer address to the
address sent above.
9/16
|
▷ |