
DFU bootloader
AN2662
Doc ID 14156 Rev 1
The host requests the device to send a specified number of data bytes (
wLength
) from
Internal Flash, Embedded RAM (starting from 0x2000 1000 address), System Memory or
from Option Bytes. The allowed number of bytes to be read depends on the memory target:
●
For internal Flash, embedded RAM and System Memory: read size can be from 2 to
2048 bytes.
●
For Option Bytes: read size should be 16 bytes.
The address, from which the Host requests to read data, is computed using the value of
wBlockNumber (
wValue
) and the Address Pointer according to the following formula:
Address = ((wBlockNum - 2) * wTransferSize) + Address_Pointer.
Where wTransferSize is the length of the requested data buffer.
The Address Pointer should have been previously specified through a Set Address Pointer
command (using a DFU_DNLOAD request). Otherwise (if no address is previously
specified) the device assumes that it will be the internal Flash start address (0x08000000).
If the Flash Read Protection is enabled, the Read operation is not performed and the device
status returned is (Status = dfuERROR, State = errVENDOR) whatever the target (internal
Flash, embedded RAM, System Memory or Option Bytes).
4.4.2 Get
commands
This command is selected when
wValue
= 0.
The Host requests to read the commands supported by the bootloader. After receiving this
command, the device returns N bytes representing the command codes.
The STM32F105xx and STM32F107xx sends the bytes as follows (N = 4):
The processing of DFU_UPLOAD command is shown in
and
Byte 1:
0x00
- Get command
Byte 2:
0x21
- Set Address Pointer
Byte 3:
0x41
- Erase
Byte 4:
0x92
- Read Unprotect