This application note descr ibes how to use th e ST 7 USB Low-Spee d Li brary V4.2x. Starting
from version 4.20 the Library supports the DFU class layer.
Caution: The DFU class and the HID class layers are not included in the Library. The Library
contains only the standard U SB requ est layers. Yo u will find the DF U and HID layers in the
ST7 USB Low-Speed DFU EvalKit firmware.
Note: In this document the names “Hiware” and “MetroWerks” refer to the same compiler
manufacturer.
1 OVERVIEW
The ST7 U SB L ow -S peed F irmw are Libra ry is wri tten in C l a nguage a nd is com pat ible w ith
both Cosmic and Metrowerks compilers.
This Library provides a complete USB protocol layer for the ST7 USB Low-Speed microcontrollers (such as the ST 7261, ST 7262, S T7263 and ST7263B) . The source co de is a vailable
free to STMicroelectronics customers.
This Library is supplied in a ZIP file. Star ting from version 4.10, t he Library contains only the
files that are common for all the projects. This new architecture has been choosen in order to
better separate what is really the Library and what is related to a project. This architecture will
also facilitate the upgrade of different projects with new Library versions in the future.
AN1325/02031/15
1
USING THE ST7 USB LOW-SPEED LIBRARY V4.2x
2 LIBRARY
2.1 DIRECTORIES ARCHITECTURE
The files which compose the Library are placed into 4 distinct directories : Docs, Macro,
Micro, and Usb :
ST7USBLS-Library-V4.2x/
|--- Docs/
|--- Macro/
|--- Micro/
|--- Usb/
The files inside these directories cannot be used alone. You have to use them within a project.
To do so, you have to include in your project setting files the path of these directories (Mak file
for Cosmic and Default.env for Metrowerks). This way you will be able to use easily the same
Library for different projects.
Normally there is no need to change any of the files present in these directories. All the
changes must be done inside your project files.
The following chapters will explain in detail the content of all this directories.
2/15
2
USING THE ST7 USB LOW-SPEED LIBRARY V4.2x
2.2 DOCS DIRECTORY
This directory contains all documentations related to the Library: ReleaseNote.txt, FlowChart,
etc...
2.3 MACRO DIRECTOR Y
This di rec tor y cont ain s a ll t he f ile s c ont ai nin g th e m a cro de fin iti on s s h are d be twe en the Li brary and the different projects. It contains also the U nicode tabl e used for the definition of the
String descriptors . For ex ample you will fi nd th e desc ription o f “Ena bleInterr upts” and “Disa bleInterrupts” mac ro. All these files are commo n for Cosmic and Metrowerks com pilers with
the exception of the “Hidef.h” file wich is used only for Metrowerks.
2.4 MICRO DIRECTORY
This directory contains all the files which are related to the microcontrollers. You will find here
all the MAP files for t he ST726X micro controllers fam ily (ST 7261, ST 7262, ST72 63 and
ST7263B) . All these MAP files are common for Cosmic and M etrowerks comp ilers.
Important Note : For Metrowerks, all the H/W registers addresses are written inside the PRM
files of each project. For Cosmic, all these informations are written directly inside the MAP
files.
2.5 USB DIRECTORY
This directory contains the USB Library core files for Cosmic and Metrowerks compilers.
These file don’t need to be changed by the customer.
This USB Library can be seen as a ToolBox where the Application picks up the “tools” it needs
(calls the functions it needs). Note that there is no callback functions from the Library (the user
doesn’t need to create specific functions that could be called by the Library).
2.6 USB CORE FILES
All the following files are placed inside Usb directory. These files are r eally what we call THE
Library.
USB_Rwu.hPrototypes for Remote Wake-Up functions
USB_Lib.cLibrary functions to be called by Application layer code
USB_Lib.h
USB_Rc.cHardware abstraction layer
USB_Rc.hPrototypes for Hardware abstraction layer
USB_Var.cLibrary variables declaration
USB_Var.hP rototy pes for Library variables
USB_JumpTable_Cosmic.a smContains Jump to USB functions (for DFU only)
USB_JumpTable_Hiware.asmContains Jump to USB functions (for DFU only)
Description of all aliases and variables shared between
the Library and the Application layer
Prototypes of all the Library functions to be called by the
Application layer code
The 2 assembly files (USB_JumpTable_xxx.asm) contain a jump table used by the application
to access the Library functions. These files are only used for DFU.
2.7 FILES ORGANIZAT ION
Applica tion Co de
(main.c, Hid_layer.c, User_var.c, ...)
USB_Lib.hUSB_Def.h
USB_Rc.c
USB.c
As you can see on this chart : USB_Lib.h and USB_Def.h are the only files from the Library
that your project needs to refer to.
4/15
USING THE ST7 USB LOW-SPEED LIBRARY V4.2x
3 PROJECT
This chapter describes an example of a project architecture. You are not obliged to follow this
architecture to use the USB Low-Speed Library.
3.1 DIRECTORIES ARCHITECTURE
The project directories architecture has been simplified. You will now have only the following
directories :
ProjectName/
|--- Docs/
|--- Appli/
|--- Config/
|--- Cosmic/
|--- Hiware/
|--- Objects/
|--- Cosmic/
|--- Hiware/
|--- ST7USBLS-Library-V4.2x /
3.2 DOCS DIRECTORY
This directory contains all documentations related to the project. You can use this directory to
put all your project documents.
3.3 APPLI DIRECTORY
All the application-specific files have to be located inside this directory.
Here is a description of the files that are in this directory initially:
File NameDescription
Main.c
Main.h
Descript.c
Descript.h
Entry module. Calls the Initialization functions and contains the infinite loop.
USB Descriptor files for the application: you have to modify them according to
your application (the initial values filled in apply to the Library firmware).
5/15
Loading...
+ 10 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.