News:

Attention: For security reasons,please choose a user name *different* from your login name.
Also make sure to choose a secure password and change it regularly.

Main Menu

On TE0630, FX2 "renumerate" doesn't seem to work.

Started by nburkitt, September 03, 2014, 03:03:09 AM

Previous topic - Next topic

nburkitt

Hi.

If I load (via the Cypress USB Console) the TE reference firmware (v3.2, from "TE_USB_FX2.firmware\te_usb_api.ver.3.2"), a subsequent call to TE_USB_FX2.TE_USB_FX2_ScanCards() returns a value of 0, meaning no cards found. The Cypress USB console shows no change of VID or PID.
If I disconnect and reconnect the USB cable, the board is then recognized as a Cypress EZ-USB board (VID: 0x04B4, PID: 0x1004), but of course the TE USB library doesn't want to talk to it.
If I then cycle power on the 0630, the board is recognized with the expected IDs, VID: 0x0BD0, PID: 0x0300, and all is well again.
I really want to be able to change the 8051 firmware to alter the capabilities of the device without having to touch the device as part of the process. Is this possible?
Thanks,

-Nick

Oleksandr Kiyenko

Hi Nick,

To update FX2 firmware you sould:
- Switch S1A to OFF (disconnect EEPROM from FX2)
- Connect USB cable (Board should be visible ad Cypress EZ-USB)
- Switch S1A to ON
- Run Cypress USB console and update large EEPROM with TE iic file
- Reconnect USB cable

If Cypress chip see EEPROM during boot, custom firmware will be loaded to 8051, if not standard bootloader from ROM.
Please clarify what exactly and how you want to do.


Best regards
Oleksandr Kiyenko

nburkitt

Hi Oleksandr.

Thanks very much for your reply. The issue I have is not with programming the 8051 EEPROM, which is working fine. The problem is that I am expecting the behavior described in this Cypress knowledge base article: http://www.cypress.com/?id=4&rID=26981, particularly steps 8-14:

Quote8. Your EZ-USB AN21xx  firmware electrically disconnects the chip from the USB bus.

9. The host, seeing the original device disappear, discards the Loader Driver from host memory.

10. Your EZ-USB AN21xx  firmware reconnects the EZ-USB to the USB bus.

11. The Host detects that your device is plugged in and asks the device for its IDs.

12. The EZ-USB AN21xx  firmware responds with IDs that represent a your fully downloaded and configured device: (Vendor=XYZ Corp, Product=GIZMO).

13. The Host PC sees these IDs and knows to load a Class Driver or your Custom Device Driver (based on the Generic Driver example).

14. The Host Driver and EZ-USB AN21xx firmware are now loaded and running and perform the data transfers and control functions necessary for your application.

The TE reference firmware includes a call to the function fx2_renumerate() early in main(). It is my understanding that fx2_renumerate() will cause the FX2 to disconnect itself from the USB, and then reconnect, which should cause the host to request the board's new ID. It is this "renumeration" that seems not to be occurring.
This is the case whether I use the Cypress USB Console, or call CyUSB.CyFX2Device.LoadEEPROM() from my firmware loader application.
Please let me know if you need any further details.
Thanks again,

-Nick

Horsa

#3
Hello Nick,

the EZ-USBĀ® Technical Reference Manual describes

  • four "start-up modes" (3.2 EZ-USB Startup Modes);
  • three "EEPROM boot-load scenarios" (3.4 EEPROM Boot-load Data Formats).
The 2nd "start-up mode" corresponds to the 2nd "EEPROM boot-load scenario" ("'C0 Load' Format", "Serial EEPROM Present, First Byte is 0xC0"). => Cypress knowledge base article http://www.cypress.com/?id=4&rID=26981 seems to belong to this start-up mode/scenario/format.
The 3rd "start-up mode" corresponds to the 3rd  "EEPROM boot-load scenario" ("'C2 Load' Format", "Serial EEPROM Present, First Byte is 0xC2"). => TE0630 board belongs to this start-up mode/scenario/format.




Your description seems correct only for the 2nd "start-up mode" = the 2nd "EEPROM boot-load scenario" = "'C0' EEPROM (load custom VID / PID / DID only)" start-up mode/scenario/format.
The external EEPROM contains only custom VID/PID/DID values; the new EZ-USB firmware is directly downloaded from the host into the EZ-USB RAM; the external EEPROM content is not changed.

<<After initial enumeration, that host driver holds the CPU in reset, downloads the firmware and USB descriptor data into the EZ-USB's RAM, then releases the CPU reset. >>

== 3.4.2 Serial EEPROM Present, First Byte is 0xC0 ==
Quote
If, at power-on reset, the EZ-USB detects an EEPROM connected to its I2C bus with the value 0xC0 at address 0, the EZ-USB automatically copies the Vendor ID (VID), Product ID (PID), and Device ID (DID) from the EEPROM into  internal  storage.  The  EZ-USB  then  supplies  these 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.

After initial enumeration, that host driver holds the CPU in reset, downloads the firmware and USB descriptor data into the EZ-USB's RAM, then releases the CPU reset.

The EZ-USB then ReNumerates as a custom device. At that point, the host may load a new driver, bound to the VID / PID / DID contained in the firmware.




The TE0630 module uses instead the 3rd "start-up mode" = the 3rd "EEPROM boot-load scenario" = "'C2' EEPROM (load firmware to on-chip RAM)" start-up mode/scenario/format.
The external EEPROM contains both custom VID/PID/DID values and the EZ-USB firmware; the VID/PID/DID are defined "inside" the EZ-USB firmware's C2 format/file. If the user runs a CyUSB.CyFX2Device.LoadEEPROM() directly or through CySuiteUSB.Net Control Center's "64KB EEPROM" button, the EZ-USB firmware is written into the external EEPROM but not into the RAM of the FX2 microncotroller. A reset is required to move the EEPROM content into the EZ-USB RAM. To load the new EZ-USB firmware into the RAM without using a reset procedure, the user should run a CyUSB.CyFX2Device.LoadRAM() directly or through CySuiteUSB.Net Control Center's "RAM" button.

Reset:
- https://wiki.trenz-electronic.de/pages/viewpage.action?pageId=10623245

== 3.4.3 Serial EEPROM Present, First Byte is 0xC2 ==
Quote
If, at power-on reset, the EZ-USB detects an EEPROM connected to its I2C with the value 0xC2 at address zero, the EZ-USB loads the EEPROM data into on-chip RAM. It also sets  the  RENUM  bit  to  '1',  causing  device  requests  to  be handled by the firmware instead of the Default USB Device.




For further insights, please read:
- https://wiki.trenz-electronic.de/display/TEUSB/Firmware+configuration
- https://wiki.trenz-electronic.de/display/TEUSB/Recovery+boot%3A+procedures+to+use+if+USB+connection+is+unresponsive
- https://wiki.trenz-electronic.de/pages/viewpage.action?pageId=10619311
- https://wiki.trenz-electronic.de/display/TEUSB/Custom+firmware
-
- https://github.com/makestuff/fx2loader
- https://github.com/makestuff/fx2tools/tree/master/fx2loader
-
- http://www.triplespark.net/elec/periph/USB-FX2/eeprom/
- http://manpages.ubuntu.com/manpages/precise/man8/fxload.8.html
-
- http://www.cypress.com/?id=4&rID=34127

The reference (i.e. preloaded inside the EEPROM) EZ-USB firmware for TE0630 board is (currently) TE-USB-FX2_v03.02_TE.iic.
Please read also:
- https://github.com/Trenz-Electronic/TE-USB-Suite/tree/master/TE_USB_FX2.firmware
- https://github.com/Trenz-Electronic/TE-USB-Suite/tree/master/TE_USB_FX2.firmware/te_usb_api.ver.3.2
- https://github.com/Trenz-Electronic/TE-USB-Suite/tree/master/TE_USB_FX2.firmware/ready_for_download/gen_3
- https://wiki.trenz-electronic.de/pages/viewpage.action?pageId=10624490
- https://wiki.trenz-electronic.de/pages/viewpage.action?pageId=3834296


Regards,
- Horsa

nburkitt

Hi Horsa.

Thank you! It should have occurred to me that what I really wanted to do was change the firmware in RAM, rather than in the EEPROM. My understanding has taken another small step forward.  :)
Thank you again for helping to solve my problem.

-Nick