cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

JeBo_4132831
Contributor

Hi,

We want to add the firmware update capability to our high-level software (onto our FX2LP18 based board). 

Is it possible to use the LoadEEPROM fct in a C/C++ project ? I'm currently using it in a C# test project (it works), but the final application will be developped in C/C++.

Another question : After Firmware Update how can i RESET my device (FX2LP18) to take into account the new firmware ?

Today i use a hardware RESET button of my board (it works), but i would like to do it by software (without any Hardware action). 

Possible ?  

 

Thanks.

 

0 Likes
1 Solution
MallikaK_22
Moderator
Moderator

Hi,

>> Could you please confirm if there is no I2C transaction going on when you are attempting to reset the CPU? If the CPU gets reset while it is in the middle of a transaction, it could result in lockup.

>> Also, please ensure the vendor command is in correct format, i.e. the length should be 1, value-0xE600, data element-01 for reset & 00 for reset release.

>> You could also try doing any other function/transfer to check if the CPU is going into reset. No other transfer should occur if the CPU is in reset.

Regards,

Mallika

 

Mallika

View solution in original post

0 Likes
13 Replies
MallikaK_22
Moderator
Moderator

Hi,

>> Since the LoadEEPROM API is provided by the CyUSB library (C#), it might not be possible to use it in C++ project. Please check the DownloadFW() API present in the CCyFX3Device section of the CyAPI guide (C++ interface) and confirm if it meets your requirements.

>> You can try to reset the chip through vendor command. 

Please refer to a similar thread which talks about the same in fx2lp: https://community.cypress.com/t5/USB-Low-Full-High-Speed/How-to-reset-the-cy7c68013a-through-vendor-... 

Regards,

Mallika

Mallika
0 Likes
JeBo_4132831
Contributor


Hi, Thanks.

Unfortunately it does not work.

So sum up the flow :

Finally we do not use the LoadEEPROM. We use our own Vendor Command for I2C EEPROM update..

The FX2LP18 is running. Our host updates the EEPROM with the new Firmware using our own Vendor Command (I2C WRITE). The writing is correct.

Then we want to RESET the FX2LP18, then it can download the new EEPROM content, before enumerate again.

We code the VC RENUM as explained in your message. But it does not RESET the chip completely (The EEPROM is not reloaded - no I2C reading - into the FX2LP18 as it is done after a TRUE Hardware Push-Button RESET ...).

Any other solution ?

To be honest, we are a bit lost in all type of possible RESET offered by the CyAPI.DLL/FX2LP18/USB Spec.

If you can indicate us, each time of RESET and what is doing exactly from FX2LP18 side ?

 

Regards

0 Likes
MallikaK_22
Moderator
Moderator

Hi,

Please refer to FX2LP TRM for details on DISCON bit: https://www.cypress.com/file/126446/download 

The default value in the DISCON bit is 0, which corresponds to "connected". Setting the DISCON bit to 1 allows EZ USB to come up " disconnected". This way it should re enumerate with the firmware loaded in EEPROM (C2 format). 

Ideally, the method to re enumerate the device is: EZUSB_Discon(TRUE) as mentioned in the KBA: https://community.cypress.com/t5/Knowledge-Base-Articles/Renumeration-in-firmware-for-FX1-FX2LP/ta-p... 

You can refer to the FX2LP TRM, Chapter 7 to understand the Reset mechanism.

Regards,

Mallika

Mallika
0 Likes
JeBo_4132831
Contributor


Hi, i Tried the EZUSB_Discon(TRUE) "method" using our own VC.

But it does not work as a true hard reset using the RESET input.

I can see that the product is disconnected from USB, and then connected again, BUT there is no C2 load from EEPROM. No I2C activity onto I2C ... So the new firmware, freshly update in EEPROM, is not taken into account.

What i'm doing wrong ?

0 Likes
MallikaK_22
Moderator
Moderator

Hi, 

>> Could you please let me know how is the device enumerating? What do you see in the device manager?

>> Also, how did you load the firmware to EEPROM?

 

 

Mallika
0 Likes
JeBo_4132831
Contributor

Hi,

 

The Device enumerates with our PID/VID.

The EEPROM load is finally done using our own Vendor Command (I2C Write I2C).

Then we use another Vendor Command that produexecutes the EZUSB_Discon(TRUE) .

 

I cannot see any C2 Loading done by the FX2LP18. The C2 loading is only done after releasing the true RESET pin.

 

0 Likes
MallikaK_22
Moderator
Moderator

Hi,

Apologies for the delay in response.

Kindly refer to this KBA: https://community.cypress.com/t5/Knowledge-Base-Articles/Rebooting-After-On-The-Fly-Firmware-Updatio... 

This discusses about rebooting FX2LP without a hardware reset.

Regards,

Mallika

Mallika
0 Likes
JeBo_4132831
Contributor

OK, this is indeed what i 've imagined (the first solution : writing the firmware in RAM).

The binary .IIC file is written in the EEPROM byte/byte.

But, for RAM firmware loading, which data in the .IIC file need to be wriiten ?

I assume that the .IIC contains somes configuration bytes that do not need to be written in the RAM.

Do we need to have ALSO the .HEX file for RAM loading ? (used to create the .IIC file).

TO sum-up : HOW Can we use the .IIC file to use 0xA0 vendor command and RAM loading ?

 

THANKS

 

0 Likes
MallikaK_22
Moderator
Moderator

Hi,

As mentioned in the KBA, after making modifications in the firmware, the same firmware can be updated in RAM. You need .HEX file for loading into RAM.

Keil uVision generates the .HEX file on building the project which can be loaded into RAM.

 

Mallika
0 Likes
JeBo_4132831
Contributor

Hi, I'm with SDCC and Eclipse but no problem .HEX is also present.

I've transformed the .HEX file in a BINARY file to facilitate the downloading using 0xA0 vendor command.

The binary is padded with 0x00 each time an adress is not available within the .HEX (from 0/3FFF).

I tried the following sequence :

1) Vendor Command 0xA0 with address = 0xE600 / Len = 1 / Data = 1 => CPU at RESET (i can verify that the CPU is at RESET cause no more activities onto I2C).

2) Vendor Command 0xA0 with adress = 0x000 and Len = Size of BINARY FILE / DAta = Binary File

3) Vendor Command 0xA0 with address = 0xE600 / Len = 1 / Data = 0 => CPU Should start ... 

but up to now, it does not work.  CPU does not seems to start  ... I'm on it ...

 

0 Likes
JeBo_4132831
Contributor

Hi,

I tried one basic thing to test the 0xA0 command.

I just sent 1) and 2)

1) Vendor Command 0xA0 with address = 0xE600 / Len = 1 / Data = 1 => CPU at RESET (i can verify that the CPU is at RESET cause no more activities onto I2C).

2) Just sent another Vendor Command 0xA0 with address = 0xE600 / Len = 1 / Data = 0 to Re-start the CPU ...

I change nothing in RAM. FX2LP18 is powered.

But the CPU does not start ...Or something goes wrong cause there is no more activities onto the I2C bus saying that my FX2LP18 is always at RESET or blocked somewhere ... And no other Vendor Command Works.

Any idea ? I'm stuck ... like the CPU 🙂

0 Likes
MallikaK_22
Moderator
Moderator

Hi,

>> Could you please confirm if there is no I2C transaction going on when you are attempting to reset the CPU? If the CPU gets reset while it is in the middle of a transaction, it could result in lockup.

>> Also, please ensure the vendor command is in correct format, i.e. the length should be 1, value-0xE600, data element-01 for reset & 00 for reset release.

>> You could also try doing any other function/transfer to check if the CPU is going into reset. No other transfer should occur if the CPU is in reset.

Regards,

Mallika

 

Mallika

View solution in original post

0 Likes
JeBo_4132831
Contributor

Hi, 

 

Good news. After stopping any I2C transaction no more issue. I can see the CPU re-starting after RESEt relase.

Thanks for your support.

 

0 Likes