EZ-USB FX1 - FX2LP Boot Options
EZ-USB FX1 - FX2LP Boot Options
To get the latest version of this application note, or the associated project file, please
visit http://cypress.com/an50963.
More code examples? We heard you.
To access a variety of FX2LP code examples, please visit our USB High-Speed Code Examples webpage.
Are you looking for USB 3.0 peripheral controllers?
To access USB 3.0 product family, please visit our USB 3.0 Product Family webpage.
AN50963 describes in detail the boot options available in Cypress’s EZ-USB® FX1™/FX2LP™ USB 2.0 peripheral
controllers.
Contents
1 Introduction ...............................................................1 3.2 Automated Firmware Download
1.1 Bootloader Sequence ......................................2 Using the Script File .......................................... 11
2 I2C Boot ....................................................................2 4 Boot from External Parallel Memory ....................... 13
2.1 C0 Load: Loading USB IDs from I2C Device ....2 4.1 Boot Requirements ........................................ 13
2.2 C2 Load: Loading Firmware from I2C Device...3 4.2 Firmware Modifications .................................. 14
2.3 EEPROM Hardware Connection......................4 4.3 Hardware Modifications ................................. 15
2.4 Programming I2C EEPROM .............................5 5 Summary ................................................................ 15
3 USB Boot ..................................................................8 Document History............................................................ 16
3.1 Example Host Application GUI.........................8 Worldwide Sales and Design Support ............................. 17
1 Introduction
Cypress’ EZ-USB FX1/FX2LP offers a highly integrated solution for USB 2.0 peripheral devices. It comes with an
integrated and high-performance CPU based on the industry-standard 8051 microcontroller. A soft (RAM-based)
architecture allows flexible configuration and upgrades.
FX1/FX2LP offers the following boot options:
▪ I2C boot: Use an I2C EEPROM to download the complete firmware with Vendor ID (VID)/Product ID (PID) or only
VID/PID/Device ID (DID) information to FX2LP internal RAM.
Note: You must use a VID assigned to you by the USB Implementers Forum. It is not acceptable to use the Cypress
VID and, in particular, the Cypress default VID/PID other than for testing purposes. That rule applies to your
firmware VID/PID and EEPROM VID/PID.
▪ USB boot: Use the Control Center utility provided with the FX2LP Development Kit (DVK) to download the firmware
image into FX2LP internal RAM. After the FX2LP device has enumerated, you can download the firmware to FX2LP
from the USB Host. FX2LP can enumerate with the default Cypress VID/PID or with a custom VID/PID. If an I2C
EEPROM with only VID/PID information is connected to FX2LP, that VID/PID will be used to enumerate. Then you
can use a host application to download the firmware to FX2LP.
▪ Boot from external parallel memory: The EZ-USB FX2LP/FX1 chip executes the firmware from an external parallel
memory connected to the address/data bus. Only 128-pin EZ-USB parts allow you to add off-chip data and program
memory—100-pin and 56-pin EZ-USB chips do not support external parallel memory.
The EZ-USB FX2LP device (CY7C68013A/14A/15A/16A) supports both full- and high-speed modes. The EZ-USB FX1
device (CY7C64713) supports only the full-speed mode. The FX1/FX2LP CPU is an enhanced 8051 with fast execution
and added features.
Note: In this application note, features described for FX2LP also apply to FX1, unless otherwise noted.
2 I2C Boot
Use an I2C interface to download the firmware or VID/PID/DID information to FX2LP. If an EEPROM containing FX2LP
firmware or VID/PID/DID information is attached to the I2C bus, it is automatically loaded from the EEPROM to FX2LP.
If it is firmware, it is loaded to on-chip RAM. Then the CPU is taken out of reset to execute the bootloaded code. There
are two types of loads through the I2C bus. Refer to the TRM, section 3.2, “EZ-USB Startup Modes,” for more details.
0 0xC0
1 Vendor ID (VID) L
2 Vendor ID (VID) H
3 Product ID (PID) L
4 Product ID (PID) H
5 Device ID(DID) L
6 Device ID(DID) H
7 Configuration Byte
The eighth EEPROM byte contains configuration bits that control the following:
▪ Disconnect state: Default is for EZ-USB to come out of reset connected to USB.
The TRM, section 3.4.2, “Serial EEPROM Present, First Byte is 0xC0,” contains a full description of the configuration
bits.
FX2LP then supplies the EEPROM bytes to the host as part of its response to the host’s Get Descriptor-Device request.
These six bytes replace only the VID/PID/DID bytes in the default USB Device descriptor. This causes a host driver
matched to the VID/PID/DID values in the EEPROM to be loaded by the host OS.
EZ-USB uses the EEPROM address pins A2, A1, and A0 to determine whether it is connected to a small EEPROM or
large EEPROM. Single-byte-address EEPROMs (small EEPROMs) must be strapped to address 000, while double-
byte-address EEPROMs (large EEPROMs) must be strapped to address 001. Generally, a double-byte-addressed
EEPROM is used for C2 load. See Section 13.6, “EEPROM Boot Loader” of the Technical Reference Manual (TRM)
for further details on how the EZ-USB device determines if it is connected to small or large EEPROM.
Note: Although FX2LP can perform C2 load from EEPROMs as large as 64 KB, code can be downloaded only to on-
chip RAM (16 KB) by the hardware bootloader. Using a bootloader, the firmware allows you to download to external
RAM through a two-stage bootload. The Hex2bix utility has the bootloader embedded and can be invoked using the -e
option. The -e option is used to create a file for the external RAM in IIC format.
A schematic of the DVK shows a sample EEPROM connection to FX2LP. The parts used for large and small EEPROMs
are the 24LC128-I/P and 24LC00/P, respectively.
▪ Ensure that the pull-up resistor is on the FX2LP side of the connection.
▪ Enable the SDA pin to be disconnected from FX2LP by adding a switch or jumper. This disables the EEPROM
boot so that the EEPROM can be programmed in-system.
For C0 load, use the EEPROM address pins A2, A1, and A0 to indicate that the EEPROM is single-byte addressed
(000).
Note: The format of the data transferred should follow the C0 load format as in Table 3.
Table 3. C0 Load Bytes
The following steps demonstrate how to perform a C2 load in the FX2LP DVK using Control Center:
1. On the FX2LP DVK board, select “SW2-NO EEPROM” and connect a USB A-to-B cable from the J1 connector on
the board to a Windows PC USB Host controller port. The EZ-USB device enumerates with the default VID/PID.
2. Before programming the EEPROM image file (.iic), select “SW2-EEPROM” and “SW1-LARGE EEPROM” as switch
settings to select the large EEPROM U5 on board.
3. Open Control Center from Windows: Start > All Programs > Cypress > Cypress USBSuite > Control Center
(see Figure 4). Observe that EZ-USB FX2LP is listed as “Cypress FX2LP No EEPROM Device.”
4. Choose Program > FX2 > 64KB EEPROM in the EZ-USB interface window and browse to the project folder, as
shown in Figure 4. Select the bulkloop.iic image at C:\Cypress\USB\CY3684_EZ-
USB_FX2LP_DVK\1.1\Firmware\Bulkloop or the corresponding installation path.
5. Press RESET button S1. The device will enumerate with the new VID/PID and will prompt the driver. To access
the device through Control Center for testing bulk loop operation, it needs to be bound to CyUSB3.sys.
Note: Cypress has migrated from CyUSB.sys to CyUSB3.sys for FX1/FX2. Cypress has stopped supporting
CyUSB.sys.
Figure 4. C2 Load
3 USB Boot
A host application can use vendor commands to download the firmware to FX2LP. The USB endpoint zero protocol
provides a mechanism for vendor-specific requests. Bits 6:5 of the bmRequestType field are set to “10” for a vendor
request.
FX2LP provides native support for the 0xA0 vendor request to write/read the FX2LP internal memory. The host
application can use the 0xA0 vendor request to download the firmware to FX2LP. In the 0xA0 vendor request, the
wValue field specifies the address of the memory location to be accessed. The data phase of the 0xA0 vendor request
is used to send the data to write the memory. The A0 vendor request format is shown in Table 4. For more details, refer
to the TRM, section 3.8, “EZ-USB Vendor Request for Firmware Load.”
Table 4. A0 Vendor Request Format
Note: This example host application works only with the CyUSB3.sys driver.
3.1.1 Implementing EZ -USB Firmware Download Utility
The host application that comes with this application note demonstrates firmware download to FX2LP from the USB
Host. This method eliminates the need to store the firmware on a large EEPROM, enabling you to use a smaller, less
expensive EEPROM.
In this case, the host first holds the CPU in reset and uses the EZ-USB default USB Device to download the firmware.
Then the host takes the CPU out of reset so that it can execute the downloaded code. Firmware download to FX2LP
is done using A0 vendor commands. The host must write to the CPUCS register to put the CPU in or take it out of reset.
Use the 8051RES bit (bit 0) of the CPUCS register of FX2LP to reset or run the 8051. The USB Host can write to this
bit through the 0xA0 vendor request. The host writes ‘1’ to reset the 8051 and ‘0’ to run the 8051.
The 0xA0 firmware load request may be used even after ReNumeration, but the request is valid only while the 8051 is
held in reset.
If the application implements vendor-specific USB requests and the firmware load feature is not required, then do not
use the bRequest value 0xA0 for your custom requests. To avoid future incompatibilities, vendor requests 0xA0 to
0xAF are reserved by Cypress.
Keil µVision2 is used to develop the firmware for FX2LP. It outputs the firmware in the Intel hex format
(http://microsym.com/editor/assets/intelhex.pdf). This firmware file is parsed to obtain the firmware image, which is
downloaded to FX2LP. The EZ-USB Firmware download utility parses the firmware file and downloads the firmware
image to FX2LP.
Note: Because of the difference in address of CPUCS (0x1F92 for AN21xx, FX, FX1 and 0xE600 for FX2LP) and
register addresses between the AN21xx, FX and FX1, and FX2LP series of chips, the Vend_ax firmware to be used
differs between the two. The host application demonstrates firmware download to AN21xx and FX as well to expose
the Vend_ax firmware in an easily usable ArrayList format. AN45471 – Create Your Own USB Vendor Commands
Using FX2LP provides more details on vendor commands and how to test the ones included in Vend_ax, which defines
several vendor commands.
3.1.2 Algorithm
A 0xA0 vendor request can access only the internal memory of FX2LP. When part of the firmware resides in external
memory, then you need a method to access external memory. The Vend_ax example, which is part of the DVK, is used
for this purpose. You can find it at C:\Cypress\USB\CY3684_EZ-USB_FX2LP_DVK\1.1\Firmware\Vend_ax (location
may vary based on installation) after installing the DVK. This firmware implements the 0xA3 vendor request for
read/write to the FX2LP external memory. This vendor request can access internal memory as well.
▪ Byte count: Two hex digits, a number of bytes (hex digit pairs) in the data field
▪ Address: Four hex digits, a 16-bit address of the beginning of the memory position for the data
▪ Record type: Two hex digits, 00 to 05, defining the type of data field
▪ Checksum: Two hex digits, the least significant byte of the two's complement of the sum of the values of all fields
except fields 1 and 6 (start code ":" byte and two hex digits of the checksum)
Note: For more details on the hex file format, read the specification.
Figure 6 shows the algorithm used to download the firmware to FX2LP through the host application.
START
Parse Firmware
YES NO
External Memory
Component?
Download Vend_ax
firmware
STOP
▪ CPU_Reset(bool ON): This function resets or runs the FX2LP CPU based on a Boolean input. If input is true, then
the CPU is placed in Reset; if input is false, the CPU is allowed to run.
▪ GetDevice(): This function populates the Device_List drop-down list with the devices bound to CyUSB.sys and
gets a handle on them.
▪ InitVendAX(bool FX2LP): This function is used to initialize an array (VendAX) that contains the Vend_ax firmware.
A Boolean input to this function specifies whether the firmware contains an external memory component. The
VendAX array is used to download the Vend_ax firmware to FX2LP.
▪ Firmware_Download(String^ file): This function uses the path of the firmware file as input to parse and downloads
the firmware to FX2LP. When “VendAX” is passed as input, this function downloads the Vend_ax firmware to
FX2LP. If the firmware has an external memory component, then this function is called recursively for downloading
the Vend_ax firmware. The FX2LP internal RAM is 16 KB. It is 8 KB for the predecessors of FX2LP (AN21xx, FX,
and so on). Because 0xA3 can access internal and external memory, the host application uses 0x2000 as the start
location of external memory to simplify the algorithm.
6. Choose Program > FX2 > RAM and select the firmware (hex file) for which the script is to be generated.
7. Once the program is successfully loaded into RAM, click the “Stop recording” button adjacent to the “Start recording
button,” shown in Figure 8. Save the script with an .spt extension.
8. Name your file “MyDevice.spt” and save it. The script is now created.
Note: Sometimes script generation will fail because of an error generated by Control Center. If this occurs, close
and open Control Center in admin mode and repeat the steps to create the script.
Figure 8. Stop Recording the Script
2. EZ-USB first tries to boot from the serial EEPROM on the I 2C bus. It checks for 0xC0 and 0xC2 as first bytes to
determine which boot method to use. To avoid a serial EEPROM bootload, there should be no serial EEPROM on
the I2C bus. If an external serial EEPROM is connected, the first byte must not have the values 0xC0 or 0xC2.
3. Satisfying these two requirements ensures that EZ-USB looks for firmware in the external memory on the
address/data bus and starts executing code from address 0x0000 on power-on reset if the jumper setting on the
FX2LP DVK is MM0=IN and MM1=OUT. Refer to section 4.8, “Memory Maps,” of the EZ-USB DVK User Guide
for details on the memory map on the FX2LP DVK.
4. The WinBond W27C512-45Z parallel EEPROM used for testing has an access time of 45 ns. For more information
on the W27C512-45Z, see the W27C512 datasheet. A possible replacement part is the Atmel AT27C512R. For
more information, see the AT27C512R datasheet. Figure 9 shows the connection details. Make certain that the
chip has sufficient power; some chips may require more power than that which the DVK supports.1
1
Cypress has not tested the Atmel AT27C512R. The AT27C512R is a possible replacement part based only on datasheet review.
This is an OTP part. Reprogrammable parts with slower access times work with FX2LP running at 24 MHz.
3. Include class-specific descriptors in the external-to-internal copying for applications in which class-specific
descriptors are defined. For the HID KB example, three descriptor pointers—pHIDDscr, pReportDscr, and
pReportDscrEnd—are now updated in the main function. Updated offsets are applied to them and in the main
function. Their re-evaluation in the DR_GetDescriptor function (function in periph.c) is removed.
5 Summary
This document described the boot options available in FX1/FX2LP, their significance, advantages, and disadvantages.
Using this information, you will be able to choose the best boot option to use for your end application.
Document History
Document Title:AN50963 - EZ-USB FX1/FX2LP Boot Options
Document Number: 001-50963
All other trademarks or registered trademarks referenced herein are the property of their respective owners.
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
© Cypress Semiconductor Corporation, 2009-2018. This document is the property of Cypress Semiconductor Corporation and its subsidiaries, including
Spansion LLC (“Cypress”). This document, including any software or firmware included or referenced in this document (“Software”), is owned by Cypress
under the intellectual property laws and treaties of the United States and other countries worldwide. Cypress reserves all rights under such laws and
treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other intellectual
property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with Cypress governing
the use of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to sublicense) (1) under its
copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for use with Cypress hardware
products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end users (either directly or indirectly
through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of Cypress’s patents that are infringed
by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for use with Cypress hardware products.
Any other use, reproduction, modification, translation, or compilation of the Software is prohibited.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD
TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. No computing device can be absolutely secure. Therefore, despite security
measures implemented in Cypress hardware or software products, Cypress does not assume any liability arising out of any security breach, such as
unauthorized access to or use of a Cypress product. In addition, the products described in these materials may contain design defects or errors known
as errata which may cause the product to deviate from published specifications. To the extent permitted by applicable law, Cypress reserves the right to
make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or circuit
described in this document. Any information provided in this document, including any sample design information or programming code, is provided only
for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality and safety of any
application made of this information and any resulting product. Cypress products are not designed, intended, or authorized for use as critical components
in systems designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or systems, other medical
devices or systems (including resuscitation equipment and surgical implants), pollution control or hazardous substances management, or other uses
where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”). A critical component is any
component of a device or system whose failure to perform can be reasonably expected to cause the failure of the device or system, or to affect its safety
or effectiveness. Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim, damage, or other liability arising
from or related to all Unintended Uses of Cypress products. You shall indemnify and hold Cypress harmless from and against all claims, costs, damages,
and other liabilities, including claims for personal injury or death, arising from or related to any Unintended Uses of Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, WICED, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are
trademarks or registered trademarks of Cypress in the United States and other countries. For a more complete list of Cypress trademarks, visit
cypress.com. Other names and brands may be claimed as property of their respective owners.