How do we configure FX3 as a custom USB bootloader device?
The boot options and bootable image formats for FX3 are documented in AN76405. It is recommended that you go through the application note, if you are new to the FX3 device.
The following table shows the possible boot options in FX3, which are explained in detail in AN76405.
In the design stage, users prefer the USB Boot option for ease of firmware loading and testing. In general, when FX3 is configured for the USB Boot option (PMODE [2:0] = Z11) and connected, it enumerates as a Cypress bootloader device with default VID as 0x04B4 and PID as 0x00F3. This is the default USB bootloader. However, some users may want to see the FX3 enumerate with custom name, VID, and PID, when it is configured for the USB Boot option. This is called a custom USB bootloader.
Follow this procedure for successful enumeration of the custom USB bootloader.
1. Update the .inf file of the driver with the custom name, VID, and PID. This is documented in the CyUsb3.sys Programmer's Reference Manual (CYUSB.pdf), which is available in the documentation folder of the FX3 SDK. The default SDK installation path is:
64-bit Windows: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\doc\SuiteUSB
32-bit Windows: C:\Program Files\Cypress\EZ-USB FX3 SDK\1.3\doc\SuiteUSB
2. There are two methods of implementing the changes required for the custom bootloader on the FX3 device. Either of the following two methods can be used.
a. Using 0xB2 image and setting PMODE in USB fallback
0xB2 image is a special image type, consisting of 8 bytes, used to denote that instead of the FX3 firmware image, data on the EEPROM or SPI Flash is the VID and PID for a custom USB boot. This helps in having a new VID and PID for the custom USB bootloader.
An example 0xB2 image is as follows:
Location1: 0xB2 0x1A ’Y’ ’C’ //CY Signature,32k EEPROM,400Khz,0xB2 Image
Location2: 0x04B40008 // VID = 0x04B4 | PID=0x0008
The PMODE settings used for the 0xB2 image are as follows:
1. PMODE [2:0] = Z1Z, I2C Boot with USB Fallback
2. PMODE [2:0] = 0Z1, SPI Boot with USB Fallback
Note: If there is any error in I2C or SPI communication, the FX3 will appear as a Cypress bootloader device instead of a custom bootloader device.
The I2C EEPROM boot fails under the following conditions:
- I2C address cycle or data cycle error
- Invalid signature in FX3 firmware image
- Invalid image type
SPI boot fails under the following conditions:
- SPI address cycle or data cycle error
- Invalid signature on FX3 firmware
- Invalid image type
b. Using Second Stage Bootloader
The second stage bootloader example firmware is provided in the following directory C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\boot_fw\src (the default EZ-USB FX3 SDK installation path). Macros are defined in the main.c file for three possible boot options:
- USB Boot
- I2C EEPROM
- SPI Flash/EEPROM
To enumerate FX3 as a custom USB bootloader, provide the custom VID and PID in the USB descriptors, define USB boot macro, and comment others in the main.c file in the second stage bootloader. Then, load the second stage bootloader image file in EEPROM/Flash and set the PMODE lines to PMODE[2:0] = Z1Z or 1ZZ for I2C EEPROM and PMODE[2:0] = 0Z1 for SPI Flash. When FX3 is connected to the host, the ROM bootloader will load the second stage bootloader according to the PMODE settings, which configures FX3 as custom bootloader with the custom VID/PID.