By Paolo Alcantara
USB device firmware update (DFU) bootloader provides an easy and reliable way to load new user applications to devices having preloaded the USB DFU bootloader. After loaded, the new user application is be able to run in the MCU. The USB DFU bootloader requires an application running on a PC (USB DFU PC application). The DFU PC application supports loading the firmware to the device by using specific requests as stated in the USB DFU specification class.
The USB DFU bootloader is able to enumerate in two ways:
-USB composite device mode: also know as run time mode. It’s formed of a DFU device plus another USB device class. For this implementation, human interface
device (HID) mouse device is used to avoid increasing the bootloader memory size. The MCU must be in the following conditions prior to enter to this mode:
- MCU doesn’t contain a valid firmware image or doesn’t contain firmware.
- An external action is applied to MCU such as pressing a button during a reset event. This is dependant of the USB DFU bootloader implementation.
-DFU device mode: used when DFU is ready to upload or download firmware images by a request made from the USB DFU PC Application. Prior to this mode, the MCU was in USB composite device mode.
A bootloader is a small application that is used to load new user applications to devices. Therefore, the bootloader needs to be able to run in both, the user application and bootloader mode. As an example:
After reset, the device attempts to run the user application. If the user application is not found or corrupted, the device automatically runs into bootloader mode. In case the application is valid and user wants to run bootloader program, external intervention is
required such as pressing a specific key at reset time to force the device entering to bootloader mode.
Full application note and software attached.