How to reload from EEPROM without fysical reconnect device

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I use the Cypress Vend_Ax.hex firmware file (loaded in RAM) to write our own firmware to the EEPROM.

   

Our own firmware is converted to IIC format using the Hex2bix tool and contains a dummy string for the serial number.

   

Upon write to the EEPROM, this dummy string will be replaced by an unique serial number.

   

 

   

This is working fine, but the device must be disconnected (or power-down) in order to start with the newly written firmware.

   

Is it possible to trigger the FX2LP to load the EEPROM by itself? (a sort of hard reset/reboot)

   

Another possibility I could think of was to load our firmware also to the RAM (using vendor-request 0xA0) after writing to the EEPROM. But then I need to have the hex-format again and change the serial in that version also. Problem is that the characters of the dummy serial doesn't have to be in one consecutive row, which makes the replacement a bit more difficult.

   

Is it possible to convert the IIC format back to a format I can program to the RAM directly?

   

What has to be done to do this?

0 Likes
3 Replies
Anonymous
Not applicable

 Hi,

   

 

   

You can find the source for Hex2bix utility at the location: C:\Cypress\USB\Util after installing FX2LP DVK. From that you can get to see what is being done to convert hex to an iic. If you can do the reverse of the same, you can convert iic to a hex file. 

   

 

   

Regards,

   

Gayathri

0 Likes
Anonymous
Not applicable

Hi,

   

       It is not  possible to trigger (a sort of hard reset/reboot)  FX2LP by itself.

0 Likes
Anonymous
Not applicable

Just for future reference, might someone encounter the same problem.

   

 

   

I've managed to get it working, It's done as follows:

   

I've written a HexData object which can read .hex (see description of HEX-format here: http://www.keil.com/support/docs/1584.htm ) and IIC-format (see section 3.4.3  "Serial EEPROM Present, First Byte is 0xC2" in EZ-USB_TRM.pdf). Note that the end of an IIC-file is marked by a "1" as most significant bit in the length-field. (I missed that at first)

   

This is stored internally as a list of std::vectors to keep the information about the gaps between the data-blocks. (along with each vector I store the address of the 1st item)

   

This can be "Compressed" by searching for blocks which occupy the "next" address after a block and then concatenate them. When you compress the information, you can search for strings to replace (note the indianess of the strings, which is little-endian, while the length- and address-fields in the hex- and iic-format are big-endian) because they will not be interrupted by an end-of-vector.

   

After "compression" and replacing the appropriate (wide)strings you'll have to regenerate a IIC-file again to upload to the EEPROM starting at address 0.

   

The HEX-file must be "interpreted" when writing to RAM. So writing a number of bytes starting at address X must really write at those addresses in RAM. Write to RAM is done using Vendor Request 0xA0.

   

- first put the 8051 to reset (write '1' to RAM address 0xE600 for the FX2LP).

   

- write Vend_Ax.hex to the RAM

   

- clear reset (write '0' to RAM address 0xE600

   

- write entire IIC-file with own firmware to EEPROM using Vendor Request 0xA9 (for small (<= 256 bytes) EEPROM use 0xA2) starting at address 0

   

- put 8051 to reset

   

- write hex of own firmware to RAM using 0xA0

   

- clear 8051 reset

   

- cycle port (see CyUSB.pdf "IOCTL_ADAPT_CYCLE_PORT")

   

 

   

Now Windows will find a new device and install a driver for it. This will be an entire new entry when a serial number is being used which is never been seen on that PC.

   

 

   

This can also be used for other purposes which require a temporary firmware, like updating the firmware of a connected FPGA or write to the (or another) EEPROM without write EEPROM-support in your own firmware.

0 Likes