AN2662 DFU bootloader
Doc ID 14156 Rev 1 77/83
A second DFU_GETSTATUS request is needed to check if the command has been correctly
executed. If the received address is wrong or unsupported, the device status will then be
(Status = dfuERROR, State = errTARGET).
The allowed locations for Address Pointer values are:
● Internal Flash and embedded RAM addresses.
● System Memory addresses
● Option Byte addresses
Note: The Set Address Pointer command is allowed and executed when the Flash Read
Protection is enabled.
Figure 58. Set Address Pointer Command: Device side
4.5.3 Erase command
The Erase command is selected when wValue = 0 and the first byte of the buffer sent by the
Host is 0x41. The Buffer length may be 5 bytes (the four remaining bytes are the address
bytes, LSB first) for the page erase operation or only 1 byte (only the command byte) for the
Mass erase operation.
The Host sends a DFU_DNLOAD request with the above parameters to erase one page of
the internal Flash memory or to perform a mass erase of this Flash.
The STM32F105xx and STM32F107xx receives the bytes as follows (Page erase):
Or, if a 1-byte command is received:
Set Address Pointer
command
No
Ye s
Set the new value of
address pointer
Address allowed?
Compute
address
State = dfuERROR
Status = errTARGET
State = dfuDNLOAD-IDLE
Status = OK
Byte 1: 0x41 - Erase command
Byte 2: A[7:0] - LSB of the Page address
Byte 3: A[15:8] - Second byte of the Page address
Byte 4: A[22:16] - Third byte of the Page address
Byte 4: A[31:23] - MSB of the Page address