CY3687 MoBL-USB® FX2LP18 Development Kit User Guide Doc. # 001-68582 Rev. *B Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone (USA): 800.858.1810 Phone (Intnl): 408.943.2600 www.cypress.
Copyrights Copyrights © Cypress Semiconductor Corporation, 2011-2012. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights.
Contents 1. Introduction 1.1 1.2 1.3 1.4 Introduction ..................................................................................................................7 Kit Contents .................................................................................................................7 1.2.1 Hardware..........................................................................................................7 1.2.2 Software on CD-ROM ................................................................
Contents 5.4 5.3.1.2 TD_Poll() ......................................................................................... 36 5.3.1.3 TD_Suspend() ................................................................................. 36 5.3.1.4 TD_Resume() .................................................................................. 36 5.3.2 Device Request Functions ............................................................................. 36 5.3.2.1 DR_GetDescriptor() ...................................
Contents 8. MoBL-USB Development Kit Firmware Examples 8.1 8.2 8.3 8.4 8.5 8.6 8.7 59 Method to Verify the Code Example Functionality .....................................................60 hid_kb Code Example................................................................................................60 8.2.1 Building Firmware Example Code for MoBL-USB FX2LP18 Internal RAM and External EEPROM. .......................................................................61 8.2.
Contents 8.8 8.9 8.10 8.11 8.12 8.13 EP_Interrupts Example..............................................................................................82 8.8.1 Description ..................................................................................................... 82 8.8.2 Building EP_Interrupts Firmware Example Code for MoBL-USB FX2LP Internal RAM and EEPROM .......................................................................... 82 8.8.
1. 1.1 Introduction Introduction The CY3687 MoBL-USB™ FX2LP18 Development Kit (DVK) is the best starting point for developing a MoBL-USB based product. The DVK includes a development board, code example, a generic device driver, documentation, and assorted tools. This guide provides a general overview and installation help for the DVK. The software installation of the kit includes additional help files and documentation more specific to the various components in the kit. 1.
Introduction 1.2.3 1.2.4 Required Tools Not Included ■ Full retail Keil Development System (Keil uVision2) ■ Microsoft Visual C++ (all PC sample codes are developed on this platform) ■ USB capable PC running Windows XP or 2000 Other Suggested Tools ■ 1.3 CATC USB Protocol Analyzer. Document Revision History Table 1-1. Revision History Revision ** *A *B 1.
2. Getting Started This chapter describes the installation of the CY3687 MoBL-USB FX2LP18 development Kit CD/ DVD Software. 2.1 Kit Installation To install the kit software, follow these steps: 1. Insert the kit CD/DVD into the CD/DVD drive of your PC. The CD/DVD is designed to auto-run and the kit installer startup screen appears. You can also download the latest kit installer ISO file for CY3687 Create an installer CD/DVD or extract the ISO using WinRar and install the executables. 2.
Getting Started 3. The InstallShield Wizard screen appears. The default location for setup is shown on the InstallShield Wizard screen. You can change the location for setup using Change, as shown in Figure 2-2. Click Next to launch the kit installer. Figure 2-2. InstallShield Wizard 4. On the Product Installation Overview screen, select the installation type that best suits your requirement. The drop-down menu has three options - Typical, Complete, and Custom, as shown in Figure 2-3.
Getting Started 5. When the installation begins, all packages are listed on the Installation page. A green check mark appears adjacent to every package that is downloaded and installed, as shown in Figure 2-4. Wait until all the packages are downloaded and installed successfully. Figure 2-4. Installation Page 6. Keil uVision2 trial version IDE triggers at this stage. If the PC already has the software installed then the installer will not trigger the installation.
Getting Started 7. Enter the User name and company Name credentials as shown in Figure 2-6 to proceed further with the installation. Figure 2-6. Keil User Information lnput Window 8. The keil software proceeds with the installation and copies necessary packages at default directory C:\Keil. After completion click on Finish as shown in Figure 2-7. Figure 2-7. Keil User Information lnput Window 12 CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
Getting Started 9. GPIF designer software is triggered after keil installation.This software is used to create State machine waveforms to communicate between MoBL-USB FX2LP device and devices such as FPGA, Image sensors, FIFO, and so on. If the PC already has the software installed then the installer will not trigger the installation. If the PC does not contain the software then GPIF designer welcome screen appears as shown in Figure 2-8. Click Next. Figure 2-8. GPIF Designer Welcome Window 10.
Getting Started 11. SuiteUSB 3.4.7 package install shield gets triggered after GPIF designer software installation. If the PC already has the software installed then the installer will not trigger the installation. If the PC does not contain the software then SuiteUSB welcome screen appears as shown in Figure 2-10. Click Next and accept Cypress Software license agreement as shown in Figure 2-11. Figure 2-10. SuiteUSB Welcome Window Figure 2-11.
Getting Started 12.Enter User credentials in the SuiteUSB window as shown in Figure 2-12. Click Next. The default directory of the SuiteUSB is C:\Cypress\Cypress Suite USB 3.4.7. The default directory can be changed at this stage. Click Next after selecting the directory. Click Install button in the subsequent window. The SuiteUSB package installation progress is shown in the next window. Finally the SuiteUSB Finish window appears. Click Finish button to complete the installation process of SuiteUSB.
Getting Started Figure 2-13. CY3687 Finish Window 2.2 Install Hardware Refer to section Binding Cypress USB Driver to MoBL-USB Development Board on page 43 for hardware installation for this kit. 16 CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
3. 3.1 Development Board Introduction The Cypress Semiconductor MoBL-USB Development Board provides expansion and interface signals on six 20-pin headers. A mating prototype board allows quick construction and testing of USB designs. The board may be powered from the USB connector or an external power supply. Note that some of the signals driven by the MoBL-USB FX2LP18 device on the Advanced Development board have been replaced by VCC-IO and 1.8 V supplies.
Development Board U11 is used only for converting the I2C signals to RS-232 for running the Keil debugger. It is not used for USB access. U12 converts the 3.3 V 8051 serial port signals to bipolar RS-232 levels. U13 contains the I2C to RS-232 conversion program. U13 is not intended to be user-programmable. Six 20-pin headers, P1-P6, provide interface signals to the plug-in prototyping board supplied in this kit, as well as serving as connection points for HP(Agilent) logic analyzer pods.
Development Board Table 3-1. Jumper Settings Jumper 3.4 Function Default Notes JP9 Current measurement point or alter-nate power input for 2.5V supply IN (1-2) JP10 Voltage selection for VCCIO 1.8V (5-6) Selects the input voltage for VCCIO. JP11 Current measurement point or alter-nate power input for 1.8V supply IN (1-2) This jumper may be removed and replaced with ammeter probes in series to measure current for this supply. This point may be used to provide an external source for the 1.
Development Board The MoBL-USB loader determines the EEPROM size by first initiating an I2C transfer to address Alignment not proper between these 2 lines. If the above transfer does not return an ACK pulse, the MoBL-USB loader initiates a second I2C transfer, this time to address 10100001 (1010=EEPROM, sub-address 001). If an ACK is returned by the I2C device, the MoBL-USB loader writes two EEPROM address bytes to initialize the internal EEPROM address pointer to ‘0’.
Development Board 3.5 Interface Connectors Table 3-3. Logic Analyzer Pinout Agilent 01650-63203 Pod Pins CLK1 3 4 D15 D14 5 6 D13 D12 7 8 D11 D10 9 10 D9 D8 11 12 D7 D6 13 14 D5 D4 15 16 D3 D2 17 18 D1 D0 19 20 GND Six 20-pin headers P1-P6 on the MoBL-USB FX2LP18 Development Board have pins assigned to be compatible with HP (Agilent) logic analyzers, as shown in Table 3-3. The slight bulge in the middle rows of the table (pins 9 and 11) indicates the connector key.
Development Board Table 3-4. P1 Pin Designations (continued) Alternate Default P1 Default Alternate FD[6] PB6 13 FD[4] PB4 15 14 PB5 FD[5] 16 PB3 FD[3] FD[2] PB2 17 18 PB1 FD[1] FD[0] PB0 19 20 GND Table 3-5. P2 Pin Designations Alternate SLRD Default P2 Default NC 1 2 3.3 V NC 3 4 RDY1 RDY0 5 6 N.C. NC 7 8 N.C.
Development Board Table 3-7. P4 Pin Designations (continued) Alternate Default P4 Default NC 13 14 NC NC 15 16 NC NC 17 18 NC NC 19 20 GND Alternate Table 3-8. P5 Pin Designations Alternate Default P5 Default NC 1 2 3.3 V IFCLK 3 4 NC NC 5 6 NC NC 7 8 NC NC 9 10 NC NC 11 12 NC NC 13 14 NC NC 15 16 NC 1.8 V 17 18 1.8 V 1.8 V 19 20 GND Alternate Table 3-9.
Development Board 3.6 ATA Connector P7 Table 3-10 shows the pinout for P7, a 40-pin connector that interfaces with a standard ATA cable. Note This is for ATA use only. SP1, 2, 3, and 4 should be bridged with solder to connect the appropriate pull-up or pull-down resistors required for ATA. An 80-pin cable is required for UDMA transfer modes and recommended for all transfer modes. Table 3-10. ATA Connector Pinout P7 (ATA) 3.
Development Board U4 has the group address 0100 and is strapped to unit address 001. Therefore to write a value to the 7-segment readout, 8051 firmware sends a control byte of 01000010 (the LSB indicates a write operation), followed by the data byte. U2 uses its I/O pins as inputs connected to S1-S4 according to the following table: Bit Switch 0 S1 1 S2 2 S3 3 S4 U2 has the group address 0100, and is strapped to unit address 000.
Development Board 26 CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
4. Development Kit Contents This section provides a detailed description of the structure and content of the MoBL-USB FX2LP18 as it exists on a user PC after installation. The DVK installer installs several development board related files in the Windows directory tree as shown in Figure 4-1. The default directory of CY3687 kit is C:\Cypress\USB\CY3687_MoBL-USB_FX2LP18_DVK. In further sections the default installation directory is referred to as . Figure 4-1.
Development Kit Contents 4.2 Documentation This directory contains documentation, which explains in detail about the CY3687 MoBL-USB DVK. Following is the summary of the documents in CY3687 MoBL-USB development kit as shown in Table 4-1. Table 4-1. Documents Summary for MOBL-USB FX2LP18 Development Kit S.No 4.3 Document Description 1 CY3687 MoBL-USB™ FX2LP18 Quick Start Guide.pdf The document assists user to quickly install USB drivers for MoBL-USB FX2LP18 development kit board.
Development Kit Contents 4.4 Firmware The CY3687 MoBL-USB development kit contains several firmware examples to validate different interfaces of MoBL-USB FX2LP18 device. Following is the list of firmware examples. Table 4-3. List of Firmware Example in MoBL-USB FX2LP18 Development Kits Firmware S.
Development Kit Contents 4.6 Hardware The directory contains MoBL-USB hardware schematic, PCB, Layout, gerber and PCB BOM files. Following are the files in this directory. Table 4-4. List of Hardware Files in MoBL-USB FX2LP18 Development Kits S.No: Files 1 CY3687_MoBLUSB_FX2LP18_DVK_schematic.pdf/ CY3687_MoBLUSB_FX2LP18_DVK_Schematic.DSN This file is Non-editable (pdf) and editable (.DSN) version of the schematic source file. The .DSN file can be viewed using Orcad software.
Development Kit Contents 4.8 Target This directory contains MoBL-USB FX2LP18 register definition header files, Keil debug monitor, and so on. Following are the list of files. Table 4-5. List of Files in Target Directory S.No 1 2 Sub-directory FW/Lp Monitor File Fw.c, periph.c ,dscr.a51,fw.uv2 Description This directory contains basic framework project source files used to develop the firmware examples in the MOBL-USB FX2LP18 development kit mon-int-sio1-c0.
Development Kit Contents 32 CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
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 framework. 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.
MoBL-USB FX2LP18 Firmware Frameworks Figure 5-1. Firmware Frameworks Flow Chart 34 CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
MoBL-USB FX2LP18 Firmware Frameworks 5.2 Building FrameWorks The frameworks is written using the Keil uVision2 Compiler. It has been tested only with these tools. The source uses several Keil C extensions, so compatibility with other compilers is not guaranteed. For your custom device firmware, you can either start with one of the firmware examples or start with the "clean" frameworks code. This code is located in the \\Target\fw directory.
MoBL-USB FX2LP18 Firmware Frameworks 5.3 Function Hooks The frameworks provides function hooks to simplify the addition of user code. The functions are divided into three categories: those called by the task dispatcher, the standard device request parser, and the USB interrupt handler. The following sections contain a complete list of functions and their descriptions. 5.3.1 Task Dispatcher Functions The following functions are called by the task dispatcher located in main(). 5.3.1.
MoBL-USB FX2LP18 Firmware Frameworks 5.3.2.2 DR_GetInterface() BOOL DR_GetInterface() This function is called before the frameworks implement the Get Interface device request. The register array SETUPDAT contains the current eight byte setup command. If TRUE is returned, the frameworks will implement the command. If FALSE is returned, it will do nothing. 5.3.2.3 DR_SetInterface() BOOL DR_SetInterface() This function is called before the frameworks implement the Set Interface device request.
MoBL-USB FX2LP18 Firmware Frameworks 5.3.2.9 DR_VendorCmnd() void DR_VendorCmnd() This function is called when the frameworks determine a vendor specific command has been issued. The register array SETUPDAT contains the current eight byte setup command. This function has no return value. The frameworks does not implement any vendor specific commands. However, the EZUSB serial interface engine (SIE) uses vendor specific command 0xA0 to implement software uploads and downloads.
MoBL-USB FX2LP18 Firmware Frameworks descriptor in response to a get configuration descriptor request and must return its full-speed configuration descriptor in response to a get other-speed descriptor request. 5.4 EZ-USB Library The EZ-USB library is an 8051 .LIB file that implements functions that are common to many firmware projects. These functions need not be modified and are therefore provided in library form.
MoBL-USB FX2LP18 Firmware Frameworks This function suspends the processor in response to a USB suspend event. This function will not return until the suspend is cleared by a USB bus resume or a wake-up event on the EZUSB wake-up pin. If a suspend event is not pending, this function will return immediately. 5.4.2.5 EZUSB_Resume() void EZUSB_Resume(void) This function generates the K-state on the USB bus required for a USB device remote wake-up. This function should be called following a USB suspend.
6. Cypress USB Drivers for MoBL-USB FX2LP18 Kit This chapter explains in brief about the Cypress USB drivers provided along with the kits. The USB Signed driver package consists of several files to test different features of MoBL-USB FX2LP18 kits. Additionally SuiteUSB installer is provided which supports a collection of USB Host application tools designed in C++ and C# .NET framework. These tools are useful to communicate with any cypress USB 2.0 device. 6.
Cypress USB Drivers for MoBL-USB FX2LP18 Kit Figure 6-3. Sample Signed Driver Package The basic set of files in a signed package is ■ Cyxxx.cat - These are Windows Catalog files which contain Digital Signature. This file indicates that this driver-cyusb.sys passed Microsoft driver Certification process (WHQL) process. ■ Cyusb.sys - This is the cypress provided generic USB driver for all USB 2.0 products.The driver version 3.4.5 was used in the driver certification process. ■ Cyxx.
Cypress USB Drivers for MoBL-USB FX2LP18 Kit Table 6-1. List of VID/PID used in MoBL-USB FX2LP18 Kits S.No 6.2.1 VID/PID 1 0x04B4/0x8614 2 0x04B4/0x1004 3 0x04B4/0x1003 Functional description MOBL-USB FX2LP18 Connect Mode. After Reset MoBL-USB FX2LP18 device uses LP18_dvk.iic image is U5 Safe EEPROM. The image enables DPTR register and enumerate with this VID/PID Firmware examples in MoBL-USB FX2LP18 kit use this combination except for hid_kb example that uses 0x04B4/1005.
Cypress USB Drivers for MoBL-USB FX2LP18 Kit Figure 6-4. Windows Hardware Wizard for Driver Update 7. Select No, not this time and click Next. Select Install from a specific location and click Next. 8. In the subsequent window select Don't search. I will choose driver to install and select Next.In the list of Hardware devices select Universal Serial Bus Controllers and click on Have Disk button. A new Window pops up for locating USB driver.
Cypress USB Drivers for MoBL-USB FX2LP18 Kit d. Windows-7(64-bit): wlh-win7\x64 11. Open device manager as mentioned in step-9 and expand the list of USB Controllers. 12.Observe the MoBL-USB devices in the list of USB device controllers in device manager as mentioned in step-9. The MoBL-USB FX2LP18 device enumerates as “Cypress MOBL-USB FX2LP18 Connect Mode(3.4.5.000)”. This completes the entire binding process for the MoBL-USB FX2LP18 device.
Cypress USB Drivers for MoBL-USB FX2LP18 Kit Figure 6-5. Script File Creation using CyScript Tool Verify if the xx.spt file is located in the destination directory.This tool can only generate a script but cannot play the script. Using Cyconsole or Controlcenter the generated script file can be loaded and played to download the firmware inside the script. 6.3.1.2 Script File Generation and Play using CyConsole Open Cyconsole tool located at C:\Cypress\Cypress Suite USB 3.4.7\CyConsole.
Cypress USB Drivers for MoBL-USB FX2LP18 Kit 5. Select Load script button and choose the xxx.spt file generated in step-4. 6. Click on Play script button. The entire firmware gets downloaded and the MoBL-USB FX2LP18 re-enumerates again with VID/PID -0x04B4/0x1004 defined in the firmware. 7. Open device manager by clicking on Windows start >Run. Type devmgmt.msc in the Run box. In windows Vista/7 the devmgmt.msc can be typed directly into the vacant box at Windows Start. If cyusbfx2lp18.
Cypress USB Drivers for MoBL-USB FX2LP18 Kit 6.3.2 Keil Debug Monitor Download using Script and CyMonfx2lp18 Driver Package The keil debug monitor is used to debug the firmware examples based on MoBL-USB FX2LP18 kit. The keil monitor program is embedded in script file (mon_i2c.spt). The procedure to generate the script file for a .hex file was explained in section. Using Sample keil monitor .hex programs located at \\Target\Monitor the relevant script file can be generated.
7. USB PC Host Utilities and SuiteUSB Applications This chapter explains in brief about the USB PC Host utilities provided with CY3687 MoBL-USB FX2LP18 kit. Additionally SuiteUSB installer is provided which supports a collection of USB Host application tools designed using C++ and C# .NET software design tools. These host applications are used to communicate with Cypress USB 2.0 devices like MoBL-USB FX2LP18 and EZUSB(FX1/FX2LP). 7.
USB PC Host Utilities and SuiteUSB Applications . Table 7-1. List of SuiteUSB C++ and C# Applications S.No 1 2 C++ Application Cyconsole Streamer C#.NET Application Description CyControlCenter Both these applications are used for general purpose tasks like firmware download to MoBL-USB FX2LP18 RAM, Large EEPROM(U8). Additionally Script recording and download options are available. Streamer Both these applications continuously Stream Bulk and Isochronous data in OUT and IN direction.
USB PC Host Utilities and SuiteUSB Applications Figure 7-1. CyConsole Main Window Snapshot As shown in the above figure it displays the connected Cypress USB 2.0 device (e.g MoBL-USB FX2LP18 in this case) and its attributes like USB class and list of endpoints it supports. Prior to firmware download the Record Script button on top left corner is used to record the entire download process including the firmware binary embedded inside it.
USB PC Host Utilities and SuiteUSB Applications Figure 7-2. MoBL-USB Interface Window The functionality of most frequently used buttons are briefly mentioned below 52 ■ Download: This button is used to download the firmware(.hex format) file to MoBL-USB FX2LP18 RAM memory ■ Lg EEPROM: This button is used to store the entire firmware (.iic) in Large EEPROM U7 24AA128. The EEPROM needs to be selected before firmware download using SW1 and SW2 switches.
USB PC Host Utilities and SuiteUSB Applications 7.2.2 ■ BulkTrans: This button is used transfer data over Bulk IN/OUT endpoints. After Bulkloop firmware example is downloaded (Bulkloop.hex) this button is used to send data over Bulk IN/OUT endpoints using Bulk Trans button. A sample demonstration is provided under section Bulkloop Example on page 71. For more details on Cyconsole refer to CyConsole.chm/CyConsole.pdf at C:\Cypress\Cypress Suite USB 3.4.7\CyConsole.
USB PC Host Utilities and SuiteUSB Applications 7.2.3 ■ Script file generation and automatic firmware download: This utility can be used to generate script file for a relevant firmware .hex file and later use the script file to automatically download the firmware using the script. The process of automatic firmware download using scripts is explained in section How to Generate and Play Script Files (.spt) on page 45.
USB PC Host Utilities and SuiteUSB Applications Figure 7-4. Streamer(C++) throughput on Bulk OUT Endpoint Select the relevant Bulk or Isochronous In/OUT endpoint .Vary The Packets per Xfer and Xfers to Queue parameters and verify the throughput for different Bulk and Isochronous endpoints across different Alternate interfaces. 2.Streamer using C# .NET CYUSB.dll: The throughput can also be measured using this utility available at C:\Cypress\Cypress Suite USB 3.4.7\CyUSB.NET\examples\Streamer\bin\Release.
USB PC Host Utilities and SuiteUSB Applications Figure 7-5. Streamer throughput on Iso IN Endpoint Select the relevant Bulk or Isochronous In/OUT endpoint. Vary The Packets per Xfer and Xfers to Queue parameters and verify the throughput for different Bulk and Isochronous endpoints across different Alternate interfaces. Note: The maximum data allowed per transfer is 64KB for Bulk/Isochronous transfers. 7.2.
USB PC Host Utilities and SuiteUSB Applications Figure 7-6. Cydesc Display of MoBL-USB FX2LP18 Device Descriptor CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
USB PC Host Utilities and SuiteUSB Applications 58 CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
8. MoBL-USB Development Kit Firmware Examples This chapter explains in detail about firmware example and how to test each firmware example provided with the kit. The MoBL-USB FX2LP18 contain common set of firmware examples to demonstrate the MoBL-USB FX2LP18 capabilities along with the various components on board (Seven segment LED, Push button, RAM memory, EEPROM, and so on). It also explains how to debug a firmware example using Keil uVision2 IDE.
MoBL-USB Development Kit Firmware Examples 8.1 Method to Verify the Code Example Functionality The code examples provided with the kit can be verified using MoBL-USB FX2LP18 development board provided with the kit. There are different types of firmware download mechanism for MoBLUSB FX2LP18 devices. After firmware was successfully downloaded the MoBL-USB FX2LP18 device re-enumerates and prompts for a relevant windows USB driver. The user needs to bind to the appropriate cyusbxxx.inf and cyusb.
MoBL-USB Development Kit Firmware Examples sets EP1IN and EP1OUT as Interrupt endpoints for data transfers. The following table summarizes the mapping of Push buttons on the MoBL-USB FX2LP18 development board to keyboard buttons. Table 8-2. Function Mapping of Development Board Buttons MoBL-USB FX2LP18 Development Board Push Button Function f1 Shift f2 Send ‘a’ f3 Send ‘b’ f4 Send ‘c’ The function TD_poll () in the firmware (periph.
MoBL-USB Development Kit Firmware Examples Figure 8-2. Build Window Snapshot of hid_kb Project Note: Observe that the total Code bytes of hid_kb project is less than the 4k code limit of Keil uVision2 IDE provided along with the kit. ■ Firmware for MoBL-USB FX2LP18 RAM memory: The output of the Build Target is hid_kb.hex. It is relevant file for downloading to MoBL-USB FX2LP18 RAM memory. ■ Firmware for external I2C EEPROM: To generate EEPROM compatible firmware Image the Keil IDE invokes hex2bix.
MoBL-USB Development Kit Firmware Examples 2. Connect USB A-to-B cable from J2 connector on board to a Windows PC USB Host controller port. 3. The MoBL-USB FX2LP18 development board should by default bind to cyusbfx2lp18.inf in the / Drivers folder at \\ for corresponding OS. Refer to section Binding Cypress USB Driver to MoBL-USB Development Board on page 43 on how to bind this driver to MoBL-USB FX2LP18 development board.
MoBL-USB Development Kit Firmware Examples Figure 8-4. CyControlCenter dIsplay To Download Image to Large EEPROM Note: To download Image to small EEPROM follow similar steps 1-7.The only changes are onboard EEPROM settings in step-2 (SW2-LG-SM and SW1-SMALL EEPROM) which selects U8 EEPROM.The MOBL-USB FX2LP18 EEPROM accept only Images with 0xC2 as first Byte.This EEPROM is usually programmed during manufacturing with LP18_dvk.iic.This file is used for Keil monitor debugging.
MoBL-USB Development Kit Firmware Examples 8.3 IBN Firmware Example 8.3.1 Description This example illustrates the configuration of MoBL-USB FX2LP18 to accept bulk data from the host and loop it back to the host using an IN-BULK-NAK interrupt. Click on ibn.Uv2 project file at \\Firmware\ibn. In TD_init() function of ibn.c file four endpoints are configured to handle bulk transfer: two OUT endpoints and two IN endpoints.
MoBL-USB Development Kit Firmware Examples and 4 are armed to accept data from the host. This data is transferred to endpoint 6 and endpoint 8 respectively. To implement this, endpoint 2 is first checked to see if it has data. This is done by reading the endpoint 2 empty bit in the endpoint status register (EP2468STAT). If endpoint 2 has data (that is sent from the host), then check if the host has requested data on EP6. This is done by reading the EP6 In-Bulk-Flag bit in the IbnFlag variable.
MoBL-USB Development Kit Firmware Examples // disable IBN for all endpoints IBNIE = 0x00; EZUSB_IRQ_CLEAR(); // clear the global USB IRQ // Find the EP with its IBN bit set for (i=0;i<8;i++) { if (IBNIRQ & (1 << i)) { IbnFlag |= (1 << i); // set the appropriate IBN flag bit IBNIRQ |= (1 << i); // clear the IBN IRQ for this endpoint } } NAKIRQ |= bmBIT0; // clear the global IBN IRQ // re-enable IBN interrupt for any endpoints that don't already have // an IBN pending in IbnFlag IBNIE = (bmEP6IBN | bmEP8IBN)
MoBL-USB Development Kit Firmware Examples using endpoint 4 and 8 can also be tested. Since EP2 and EP4 are double-buffered, they can only contain two packets of data. 3. On sending a packet to these endpoints when both the buffers are full, the endpoints NAK the transfer because there is no space available. If an IN transfer is requested on either EP6 or EP8, the corresponding In-Bulk-NAK interrupt is asserted and data is transferred from EP2 to EP6 or from EP4 to EP8.
MoBL-USB Development Kit Firmware Examples leaves them empty to receive a new packet from the host. It also clears any pending PING-NAK interrupts and enables the PING-NAK interrupt for EP2 and EP4. The loopback is implemented in the TD_Poll() function that is called repeatedly when the device is idle. Endpoints 2 and 4 are armed to accept data from the host. This data is transferred to endpoint 6 and endpoint 8 respectively. To implement this, endpoint 2 is first checked to see if it has data.
MoBL-USB Development Kit Firmware Examples High-speed USB implements a PING-NAK mechanism for (Bulk and Control) OUT transfers. When the host wishes to send an OUT data to an endpoint, and the previous data transfer was responded by a NYET, it first sends a PING token to see if the endpoint is ready (for example, if it has an empty buffer). If a buffer is not available, the FX2LP returns a NAK handshake.
MoBL-USB Development Kit Firmware Examples 8.4.5 Testing the pingnak Firmware Functionality Following are the steps to test the pingnak firmware: 1. After the board has re-enumerated, use CyConsole to send 512 bytes from EP2 to EP6.The data received should be same as the data sent. 512 bytes of user-defined data can be sent from the host to Endpoint 2 using CyConsole.
MoBL-USB Development Kit Firmware Examples w/skip. SYNCDELAY; EP2BCL = 0x80; SYNCDELAY; EP4BCL = 0x80;// arm EP4OUT by writing byte count w/skip. SYNCDELAY; EP4BCL = 0x80; The above lines arm the two OUT endpoints by skipping two packets of data making the buffers available to receive OUT data. AUTOPTRSETUP |= 0x01; This enables the AUTO pointer used for data transfer in the TD_Poll function.The data loopback is implemented in the TD_Poll function that is called repeatedly when the device is idle.
MoBL-USB Development Kit Firmware Examples the host. Endpoint 6 has to be 'committed', that is, make the FIFO buffers available to the host for reading data from endpoint 6. After the data is transferred, endpoint 2 has to be 'rearmed' to accept a new packet from the host. Endpoint 6 has to be 'committed', that is, make the FIFO buffers available to the host for reading data from endpoint 6.
MoBL-USB Development Kit Firmware Examples similar procedure to download bulkloop.hex to RAM memory and bulkloop.iic to Large EEPROM using Cyconsole/CyControlCenter.The bulkloop.hex and bulkloop.iic files located at \\Firmware\Bulkloop must be chosen accordingly for MoBL-USB FX2LP18. After downloading, the firmware re-enumerates with PC using its internal VID/PID0x04B4/0x1004. 8.5.
MoBL-USB Development Kit Firmware Examples Figure 8-6. EP2 OUT Data Transfer using CyConsole 2. Select EP6 IN as pipe near BulkTrans button and enter length as 512 byte. Click on BulkTrans button. The data sent on EP2 is loopbacked through EP6. The following figure summarizes the entire operation. The same sequence can be repeated for EP4-OUT and EP8-IN pair. 8.5.5.2 Test using Cybulk Application The Bulkloop firmware can be tested using this C++ application.
MoBL-USB Development Kit Firmware Examples Figure 8-7. Bulkloop using CyBulk Application 8.5.5.3 Testing Bulkloop Example using Bulkloop C# .NET Application The Bulkloop firmware can be tested using this Bulkloop C# .NET application. The application can be accessed at Windows Start->All programs->Cypress->Cypress SuiteUSB 3.4.7->Bulkloop. Select the Bulkloop OUT/IN endpoint pairs EP2/EP6 or EP4/EP8. Click Start and observe the no of successful Bulk IN/OUT Transfers Figure 8-8.
MoBL-USB Development Kit Firmware Examples 8.6 Bulksrc Firmware Example 8.6.1 Description This project illustrates the configuration of MoBL-USB FX2LP18 device to accept bulk data from the host and loop it back to the host. Click on bulksrc.Uv2 located at \\Firmware\Bulksrc and observe the code. Five endpoints are configured in TD_init() function of bulksrc.c to handle bulk transfer: Two OUT (EP2/EP4) endpoints and two IN (EP6/EP8) endpoint are double buffered pairs.
MoBL-USB Development Kit Firmware Examples SYNCDELAY; EP2BCL = 0x80; // } Endpoint EP6 is armed again with incremental pattern of data starting with 0x2. // if EP6 IN is available, re-arm it If(!(EP2468STAT & bmEP6FULL)) { SYNCDELAY; EP6BCH = 0x02; SYNCDELAY; EP6BCL = 0x00; } The contents received EP4 OUT endpoint are copied to a temporary buffer myBuffer[] and re-armed again.
MoBL-USB Development Kit Firmware Examples SYNCDELAY; EP8BCH = MSB(myBufferCount); SYNCDELAY; EP8BCL = LSB(myBufferCount); // // // arm EP8IN } 8.6.2 Building Bulksrc Firmware Example Code for MoBL-USB FX2LP18 Internal RAM Memory and EEPROM Click on Build Target button at the top right corner of the IDE. The total Code bytes of Bulksrc firmware example is less than 4k code limit Keil uVision2 IDE provided along with the kit. The output of the Build Target is bulksrc.hex and bulksrc.iic files 8.6.
MoBL-USB Development Kit Firmware Examples Figure 8-9. Bulk IN Data Transfer on EP6 Endpoint ■ Select EP4 and EP8 pairs and repeat the same procedure as mentioned above. Observe that the data transferred on EP4 is exactly looped back to EP8.Internally the loopback is performed via a temporary buffer (myBuffer [512]). 8.7 Bulkext Firwmare Example 8.7.1 Description This example is exactly similar to Bulkloop example. Click on Bulkext.
MoBL-USB Development Kit Firmware Examples for( i = 0x0000; i < count; i++ ) { EXTAUTODAT2 = EXTAUTODAT1; } // Source is external RAM APTR1H = 0x28; APTR1L = 0x00; // Destination is EP6IN AUTOPTRH2 = MSB( &EP6FIFOBUF ); AUTOPTRL2 = LSB( &EP6FIFOBUF ); count = (EP2BCH << 8) + EP2BCL; for( i = 0x0000; i < count; i++ ) { EXTAUTODAT2 = EXTAUTODAT1; } EP6BCH = EP2BCH; SYNCDELAY; EP6BCL = EP2BCL; SYNCDELAY; EP2BCL = 0x80; // arm EP6IN // re(arm) EP2OUT } } Similarly endpoint EP4 destination and EP8 source buff
MoBL-USB Development Kit Firmware Examples Cypress USB Driver to MoBL-USB Development Board on page 43 to manually bind the driver using Windows Hardware Wizard. If the binding process is performed for anyone of the previous firmware examples the process can be skipped for this example. 8.7.5 Testing the Bulkext Firmware Functionality The example firmware should be tested in a similar manner as Bulkloop example using Cyconsole or CyControlCenter. 8.8 EP_Interrupts Example 8.8.
MoBL-USB Development Kit Firmware Examples 8.8.5 Testing the EP_Interrupts Firmware Functionality The code example should be tested in a similar manner as Bulkloop example.The Bulk data transfers on EP1 are tested with length of 64 bytes and 512 bytes for the EP2, EP4, EP6 and EP8. The process is similar to the one outlined in section Testing the Bulkloop Firmware Functionality on page 74. 8.
MoBL-USB Development Kit Firmware Examples Notes: 1. IE, EIE, IP, EIP, TCON, EXIF, and EICON are all SFRs. For a description of these SFRs, refer to the MoBL-USB Technical Reference Manual 2. Active low interrupts are falling edge triggered and active high interrupts are rising edge triggered. In the example, the below register configurations are done in "extr_int.c” for setting up the interrupts: //INT0 and INT1 PORTACFG = 0x03; // PA0 and PA1 are pins for INT0 and INT1 respectively.
MoBL-USB Development Kit Firmware Examples Located at \
MoBL-USB Development Kit Firmware Examples tent first valid byte is always 0xC2 and additional bytes contain new VID/PID information.Type the “c2 b4 04 83 00 00 00 00 00 07 00 00 90 e6 80 e4 f0 80 fe 80 01 e6 00 00" in Hex Bytes box. Click on Vend Req. Following figure summarizes the entire operation. To verify the written data read the data in IN direction and observe the same data as shown in following Figure 8-11. Figure 8-11. A2 Vendor Command Write Operation using Cyconsole b.
MoBL-USB Development Kit Firmware Examples Figure 8-13. A2 Vendor Command Write Operation using CyControlCenter 2. 0xA3 command-Download data to RAM memory This command is used to download data to MoBL-USB FX2LP18 internal (0x0000-0x3FFFF) RAM. a. Test using CyControlCenter To write the contents to RAM memory select Direction=OUT Req Type=vendor Target=Device Bytes to Transfer=8 bytes (data to read) wValue=0x1800(RAM address), Req Code=0xA3 and enter data to send. For e.
MoBL-USB Development Kit Firmware Examples Figure 8-15. A3 vendor command read operation using CyControlCenter 3. 0xA6 command-Get Chip Revision To retrieve the current revision of the MoBL-USB FX2LP18) device this command is used. Figure 8-16 of CyControlCenter summarizes the entire operation. Figure 8-16. A6 Vendor Command using CyControlCenter 4. 0xA8 command-Disconnect and re-connect MoBL-USB FX2LP18 This command is used to disconnect and re-connect the MoBL-USB FX2LP18 IC using CPUCS register.
MoBL-USB Development Kit Firmware Examples Figure 8-17. A8 Vendor Command Operation using CyControlCenter 5. 0xA9 command- Read/Write Large EEPROM The Large EEPROM U7 on MoBL-USB FX2LP18 can be Written and Read using 0XA9 command. A sample firmware Image LP18_dvk.iic located at \\Firmware\Connect is used as sample data. Before sending 0xA9 command switch SW2-LG-SM and SW1-LARGE EEPROM settings should be set.Short 2-3 pins of JP7 to enable writes on EEPROM.
MoBL-USB Development Kit Firmware Examples Figure 8-19. AA/AB Vendor Command Operation using CyControlCenter 8.13 Debugging Using Keil Monitor Program The Keil uVision2 IDE supplied with the kit enables user to debug the firmware examples provided with the kit. Using Keil debug monitor program and UART port-SIO-1 on CY3687 MoBL-USB FX2LP18 development board the firmware examples are debugged. Following is the procedure to debug the firmware using Keil IDE. 1.
MoBL-USB Development Kit Firmware Examples a. mon-int-sio1.hex: This keil debug monitor file resides in internal MoBL-USB RAM memory and communicates through SIO-1 UART port. b. mon-int-sio1.spt: This keil debug monitor script file resides in internal MoBL-USB RAM memory and communicates through SIO-1 UART port. Copy latest version Keil debug Monitor DLL (ver 2.40) located at \\Target\Monitor\mon51 to C:\Keil\C51\BIN.The existing DLL can be saved elsewhere if required.
MoBL-USB Development Kit Firmware Examples Figure 8-22. Serial Ports List in Device Manager Window 9. Click on Project->Options for Target 'Target1’ in Keil uVision2 IDE and select Debug Tab in the new pop-up window as shown in Figure 8-23 and Figure 8-24. Figure 8-23. Project Options in Keil uVision2 IDE 92 CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
MoBL-USB Development Kit Firmware Examples Figure 8-24. Debug Tab window in Project options 10. Select Settings under Keil Monitor-51 Driver and select relevant COM port for the UART cable connected to SIO-1 port as shown in Figure 8-25 and Figure 8-26. Figure 8-25. Settings Button for Keil Debug Monitor Figure 8-26. UART Settings for Keil Debug Monitor 11. Click OK to close Target set up Window and then close the Options for Target "Target 1" window. 12.
MoBL-USB Development Kit Firmware Examples Figure 8-27. Debug Session Trigger in Keil uVision2 IDE 13.The IDE switches to Debug mode is seen; a yellow arrow indicates the Program Counter location in the Disassembly window of dev_io project. Figure 8-28. Disassembly View of dev_io.c file in Keil uVision2 IDE 14.Use the Step Over button to step through the code by selecting View > Debug Toolbar. Figure 8-29. Enabling Debug Toolbar View in Keil 15.
MoBL-USB Development Kit Firmware Examples Figure 8-30. Enabling Debug Toolbar View in Keil 17.Set a breakpoint by selecting the first line in the "case KEY_F2" section (which is in file dev_io.c). To set or remove a breakpoint, double-click the line or right-click on the line as and select Insert/Remove Breakpoint shown in Figure 8-31. Figure 8-31. Setting Breakpoint in Keil uVision2 IDE CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
MoBL-USB Development Kit Firmware Examples 18.A red breakpoint indication is seen in the margin next to the new breakpoint as shown in Figure 8-32. Press RUN button as shown in Figure 8-33. Figure 8-32. Breakpoint Indicator in Keil uVision2 IDE Figure 8-33. Run button in Keil 19.Now press F3 on the development board (the KEY_F2 label equates to the F3 button). Program execution halts in the Keil IDE and the LED does not increment. 20.Press Step Over as shown in Figure 8-34.
9. 9.1 Resources Hardware Resources The CY3687 MoBL-USB development kit contains several hardware resources that guide you in designing your own custom board. The documents in the /Hardware directory of the DVK content. ■ CY3687_MOBL-USB_FX2LP18_DVK_BOM.xls: This document lists all the hardware components like resistors,capcacitors,,etc used in designing the development board. ■ CY3687_MOBL-USB_FX2LP18_DVK_schematic.pdf/ CY3687_MOBLUSB_FX2LP18_DVK_Schematic.
Resources Hex2bix is a program used to convert a .hex file to a raw binary, A51, or IIC format. This application note describes how to use the Hex2bix conversion utility for successful file conversion. ■ AN15456 - Guide to Successful EZ-USB(R) FX2LP(TM) and EZ-USB FX1(TM) Hardware Design and Debug This application note outlines a process that isolates many of the most likely causes of EZ-USB® FX2LP™ and EZ-USB FX1™ hardware problems.
Resources This application note explains how to implement an 8-bit parallel MPEG2-TS interface using the Slave FIFO mode. The example code uses the EZ-USB FX2LP™ at the receiver end and a data generator as the source for the data stream. The hardware connections and example code are included along with this application note. ■ AN58170 - Code/Memory Banking Using EZ-USB® The EZ-USB® family of chips has an 8051 core. The 8051 core has a 16-bit address line and is only able to access 64 KB of memory.
Resources This application note demonstrates how to build a host application on Microsoft Visual C++ platform, using the Cypress SuiteUSB C# library, CyUSB.dll, to perform USB BULK IN and OUT transfers with FX2LP and the associated project is tested with FX2LP Development kit. ■ AN74505 - EZ-USB® FX2LP™ - Developing USB Application on MAC OS X using LIBUSB AN74505 describes a host application built on the MAC OS platform that uses libusb.
Resources EZ-USB FX2LP who are switching to the MoBL-USB FX2LP18, as well as engineers starting off with the MoBL-USB FX2LP18. CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
Resources 102 CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
A. A.1 Appendix Board Layout Figure A-1. CY3687 Assembly Development Board Layout CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
TP1 GND TP2 GND TP3 GND 3216 C25 3216 10 uFd 16v C30 10 uFd 16v 3216 10 uFd 16v C19 10K + 5V + 5V + 5V 1 2 3 4 5 6 5V R19 USB B RA VBUS DM DP GND S1 S2 J2 VBUS EXT 1 2 JP5 5 8 5 8 5 8 1A 2A FRAME 3 S6 RESET# 1B 2B nSHDN IN nSHDN IN nSHDN IN BYP SENSE OUTPUT U10 LT1763CS8-1.8 BYP SENSE OUTPUT U9 LT1763CS8-2.5 BYP SENSE OUTPUT U6 LT1763CS8-3.
A.3 PCB BOM CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
CY3687 MoBL-USB FX2LP18 Development Kit User Guide, Doc. # 001-68582 Rev.
Mouser Electronics Authorized Distributor Click to View Pricing, Inventory, Delivery & Lifecycle Information: Cypress Semiconductor: CY3687