User guide

CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev. *B 33
5. MoBL-USB FX2LP18 Firmware Frameworks
The firmware frameworks simplify and accelerate USB peripheral development using the MoBL-USB
chip. The MoBL-USB firmware framework library is similar to EZ-USB FX1/FX2LP device frame-
work. The term EZ-USB framework referenced throughout this chapter also means MoBL-USB
FX2LP18 device framework. The frameworks implement 8051 code for EZ-USB chip initialization,
USB standard device request handling, and USB suspend power management services. The user
provides a USB descriptor table and code to implement the peripheral function to complete a fully
compliant USB device. The frameworks provide function hooks and example code to help with this
process. The frameworks use the EZ-USB library to carry out common functions and for MoBL-USB
FX2LP18 register definitions. Most of the firmware examples in the MoBL-USB FX2LP18 DVK are
based on the frameworks.
5.1 Frameworks Overview
The frameworks implement the basic functionality required of a USB compliant peripheral device. By
linking a minimal descriptor table, it is possible to build a fully compliant Device Framework (Chap-
ter-9 of USB 2.0 specification at http://www.usb.org/developers/docs/).
At startup, the frameworks initialize all its internal state variables. It then calls the user initialization
function TD_Init(). Upon return, the frameworks initialize the USB interface to the unconfigured state
and enable interrupts. The firmware then Re-enumerates and starts the co-operative task dispatcher.
The task dispatcher repeatedly performs the following tasks in the given order.
1. Calls user function TD_Poll().
2. Determines if a standard device request is pending. If so, it parses the received command and
responds accordingly. The frameworks automatically handle the standard USB requests, but
allow the user to override the default behavior for all requests.
3. Determines if the USB core has reported a USB suspend event. If so, it calls the user function
TD_Suspend().
MoBL-USB FX2LP18 device interrupts are handled by the frameworks. It provides hooks for user
code notification of USB events.