
AN2662
DFU bootloader
Doc ID 14156 Rev 1
Note:
The Detach request is not meaningful in the case of the bootloader. The bootloader is
started by a system reset depending on the boot mode configuration settings, which means
that no other application is running at this time.
Communication safety
The communication between Host and Device is secured by the embedded USB protection
mechanisms (CRC checking, Acknowledgements ...). No further protection is performed for
transferred data or for bootloader specific commands/data.
4.3
DFU bootloader commands
The DFU_DNLOAD and DFU_UPLOAD requests are mainly used to perform simple Write
Memory and Read Memory operations. They are also used to initiate the integrated
bootloader commands (write, read unprotect, erase, set address ...). The
DFU_GETSTATUS
command then triggers the command execution.
The selection of a command through the DFU download request is done through the
wValue
parameter in the USB request structure. If
wValue
= 0 then the data sent by the Host after the request
is a bootloader command code. The first byte is the command code and the other bytes (if any) are the
data related to this command.
The selection of a command through the DFU upload request is done through the
wValue
parameter in the USB request structure. If
wValue
= 0 then Get Command is selected and performed.
4.4 DFU_UPLOAD
request commands
The upload request allows different commands to be performed. The command selection is
done through the value of
parameter
wValue
in the USB request structure. The operations
described in
to
are supported.
4.4.1 Read
memory
The Read operation is selected when
wValue
> 1.
Table 6.
Summary of DFU Class-Specific requests
bmRequest
bRequest
wValue
wIndex
wLength
Data
00100001b
DFU_DETACH
wTimeout
Interface
Zero
None
00100001b
DFU_DNLOAD
wBlockNum
Interface
Length
Firmware
10100001b
DFU_UPLOAD
Zero
Interface
Length
Firmware
00100001b
DFU_GETSTATUS
Zero
Interface
6
Status
00100001b
DFU_CLRSTATUS
Zero
Interface
Zero
None
00100001b
DFU_GETSTATE
Zero
Interface
1
State
00100001b
DFU_ABORT
Zero
Interface
Zero
None