
DFU bootloader
AN2662
Doc ID 14156 Rev 1
Once System Memory boot mode is entered and the
STM32F105xx and STM32F107xx
has been configured as described above, the bootloader code configures the USB and its
interrupts and waits for the “enumeration done” interrupt.
Once this interrupt is detected (A Host is present, has connected the device and
enumerated it), the system is configured in External Oscillator mode and the USB device is
re-initialized.
The device first tries the 25 MHz configuration, then, if it fails, the 14.7456 MHz
configuration, then, if it fails, the 8 MHz configuration. If it fails, this operation is repeated
with a large timeout value (the three configurations are re-tested). If the second trial also
fails, a system reset is then generated.
Note:
Independently of the initial USB cable status (plugged or unplugged) when the
STM32F105xx and STM32F107xx
enters the Bootloader application, it configures the
USB. The enumeration is performed as soon as the USB cable is plugged (or immediately if
the cable is already plugged). If you do not want the
STM32F105xx and STM32F107xx to
enter the USB DFU bootloader application, the USB cable has to be unplugged before reset.
4.2
USB DFU Bootloader requests
USB DFU Bootloader supports DFU protocol and requests compliant with the “Universal
Serial Bus Device Upgrade Specification for Device Firmware Upgrade” Version 1.1, Aug
5,2004. For more details concerning these requests refer to this specification document.
enumerate the DFU Class-Specific requests and their parameters.
Table 5.
DFU Class requests:
Request
Request
Code
Request description
DFU_DETACH
0x00
Requests the device to leave DFU mode and enter
the application.
DFU_DNLOAD
0x01
Requests data transfer from Host to the device in
order to load them into device internal Flash.
Includes also erase commands.
DFU_UPLOAD
0x02
Requests data transfer from device to Host in order
to load content of device internal Flash into a Host
file.
DFU_GETSTATUS
0x03
Requests device to send status report to the Host
(including status resulting from the last request
execution and the state the device will enter
immediately after this request).
DFU_CLRSTATUS
0x04
Requests device to clear error status and move to
next step.
DFU_GETSTATE
0x05
Requests the device to send only the state it will
enter immediately after this request.
DFU_ABORT
0x06
Requests device to exit the current state/operation
and enter idle state immediately.