AN1603
APPLICATION NOTE
USING THE ST7 USB DEVICE FIRMWARE UPGRADE
DEVELOPMENT KIT (DFU-DK)
by Microcontroller Division Applications
1 INTRODUCTION
This Application Note describes how to use the ST7 USB DFU PC development kit (DFU-DK).
It begins with a presentation of the software architecture. It then gives a full description of the
DFU-DK programming interface and all the features. Finally, an example is given of a vendor
upgrade package developed with the DFU-DK.
The objective of the DFU-DK is to provide you with a simple means of upgrading the firmware
of a USB device. It runs under Microsoft Windows and works with any STMicroelectronics
USB microcontroller that supports the DFU capability including the ST72F62, ST72F63 and
ST72F65x MCU families.
The DFU-DK can be downloaded from ST’s website.
Related Documentation:
ST7 USB Device Firmware Upgrade Demonstrator User Manual.
AN1603/0203
1/21
1
USING THE ST7 USB DEVICE FIRMWARE UPGRADE DEVELOPMENT KIT (DFU-DK)
1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 LIST OF INSTALLED FILES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1 DEVELOPMENT MODULES FOR BUILDING YOUR OWN PC SOFTWARE . . 3
2.2 DOCUMENTATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 DFU DRIVER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.4 EXAMPLE VENDOR UPGRADE SOFTWARE FILES . . . . . . . . . . . . . . . . . . . . 3
3 SOFTWARE ARCHITECTURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4 DFU-DK PROGRAMMING INTERFACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.1 OVERVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.2 DRIVER INSTALLATION FILE (.INF) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.3 PROGRAMMING INTERFACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.3.1 STDFU_EnumGETNBDevices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.3.2 STDFU_GetDeviceDescriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3.3 STDFU_GetDFUDescriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3.4 STDFU_GetStringDescriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.3.5 STDFU_GetNbOfConfigurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4.3.6 STDFU_GetConfigurationDescriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.3.7 STDFU_GetNbOfInterfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.3.8 STDFU_GetNbOfAlternates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.3.9 STDFU_GetInterfaceDescriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.3.10STDFU_Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.3.11STDFU_Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.3.12STDFU_Detach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.3.13STDFU_Dnload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3.14STDFU_UPload . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3.15STDFU_Getstatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.3.16STDFU_Clrstatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.3.17STDFU_Getstate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.3.18STDFU_Abort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.3.19STDFU_HandleDeviceChange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5 EXAMPLE VENDOR UPGRADE SOFTWARE (DFU DEMONSTRATOR) . . . . . . . . 17
5.1 ST7DFUPRT PROGRAMMING INTERFACE . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.1.2 Programming Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.2 DFU DEMONSTRATOR GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2/21
2
USING THE ST7 USB DEVICE FIRMWARE UPGRADE DEVELOPMENT KIT (DFU-DK)
2 LIST OF INSTALLED FILES
This section provides a list of all the DFU-DK files referred to in this application note.
2.1 DEVELOPMENT MODULES FOR BUILDING YOUR OWN PC SOFTWARE
In the
Dev
subdirectory, you will find the following items :
– Bin subdirectory
-ST7DFU.dll : interface dll
-STTubeDevice203.dll : driver dll used by the ST7DFU dll
– Inc subdirectory
-ST7DFU.h : C header containining all prototypes exported by ST7DFU.dll
-USB100.h : Microsoft header for USB.
– Lib subdirectory
-ST7DFU.lib : static lib file
2.2 DOCUMENTATION
In the
Doc
subdirectory, you will find the following items :
– Application note AN1603: this file.
2.3 DFU DRIVER
In the
Driver
subdirectory, you will find the following items :
– STDFU.inf: installation file for the DFU driver that can be customised to meet the require-
ments of your application
– STTub203.sys: STMicroelectronics tube driver used as a DFU class driver
2.4 EXAMPLE VENDOR UPGRADE SOFTWARE FILES
In the
Sources
subdirectory, you will find the following items :
– Binary subdirectory inludes binary modules: debug and release
– DFUDEMO subdirectory includes GUI sources
– ST7DFUPRT subdirectory includes DFU protocol dll sources
3/21
USING THE ST7 USB DEVICE FIRMWARE UPGRADE DEVELOPMENT KIT (DFU-DK)
3 SOFTWARE ARCHITECTURE
Figure 1. DFU-DK software layers
STMicroelectronics
reference software
DFU GUI
Protocol DFU Interface
DFU Interface protocol
STMicroelectronics
binary module
ST7DFU.DLL
STTubeDeviceXXX.dll
User Mode
Kernel Mode
Tube-Driver for the DFU Class
STTubXXX.SYS
Microsoft USB Driver Stack (USBD)
Hardware
USB Bus Interface
4/21
Status and error reporting
Firmware Image
& suffix
Image.s19
Image.dfu
ST7DFUPRT.DLL
USING THE ST7 USB DEVICE FIRMWARE UPGRADE DEVELOPMENT KIT (DFU-DK)
As shown in Figure 1, we can see that the DFU software is divided into four distinct layers:
– The hardware layer (USB bus interface),
– The kernel layer (Microsoft USB stack and STMicroelectronics tube driver)
and a user application layer that is also divided into two other layers:
– A generic one that manages all DFU requests and is provided as ready binary modules
(ST7DFU and STTubeDevice203 dynamic link libraries).
– A vendor-specific one that is provided as an example reference software (protocol manage-
ment dynamic link library and a demonstration GUI).
This modular architecture was chosen so that the DFU-DK can be used for any application
that needs to implement DFU features. Moreover, this will make it easier to add features any-
time in the future and manage changes.
Note:
The DFU-DK is compatible with Windows 98, 98SE, Me, 2000 and XP and is compliant
with the Device Class specification for DFU version1.0 as detailed by the USB-IF.
5/21