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

USB superspeed peripherals Forum Discussions

hola_4724651
Level 2
Level 2

Hi, there!

I've tried demo of <1.3\firmware\serialif_examples\cyfxusbspiregmode> with pmode[2:0]=z11 and download img to spi flash by "usb control center". it looks like programming very fast and shows "succeeded". however, with pmode[2:0]=0z1 , reset the board and usb control center shows BcdUSB = 02 00.

does anyone can tell me which part of code should i modify and/or show me a demo uboot img for s25fs128s? thanks.

0 Likes
1 Solution

EDITTED

Hello,

Your understanding is correct. By default the flash s25fs128s makes use of hybrid sectors. So the command D8 cannot be used to erase the first sector. In order to confirm this, we recommended you to read the second sector in the previous response. According to my understanding you changed this hybrid sectors to uniform sectors by the firmware modifications mentioned in your previous response. This is a correct approach.

Now, according to my understanding, you are able to write and read data from the first sector without any issues.

Please note that the firmware flashprog is internally called by the control center for downloading the firmware. The flashprog need to be modified depending on the flash that is used on the board. Please share the source code of the firmware with the fix for us to inspect. If the firmware is proper, then you can go ahead and add the modified firmware image to the following location:

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\c_sharp\controlcenter

While doing so, please make sure that the .img built by the modified firmware has the same name as that present in the path mentioned above.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

0 Likes
36 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please let me know the following details:

1. Are you able to download the firmware image to RAM and enumerate the device properly?

2. According to my understanding, when you try to download the firmware to flash, the firmware download is proper but the boot from flash is failing and the device re-enumerates as USB Bootloader Device. Please correct me if Iam wrong.

3. Please probe the PMODE[2:0] lines when you set it to 0z1 and verify if it is the same or not.

When the you set the PMODE[2:0] as z11 and use control center to download the image to flash, the flash is updated with the new firmware image. Now, when the PMODE[2:0] is changed to 0z1, the bootloader looks for the image in flash. If the boot fails, then the device will re-enumerate as USB Bootloader device.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

thanks for replying~

1, yes, it works ok by downloading img to ram and enumerating the device usb3.0;

2, yes, it shows that downloading to spi flash was succeed, but after reset, the board boots from flash failing;

3, i am quit sure i have changed pmode to 0z1 and then reseted the board.

by the way, last night i tried another device w25q32fw with the same steps and it works ok.

0 Likes

and maybe i need to stress that here we use 1.8v spi flash device.

0 Likes

Hello,

Please confirm that you used the device w25q32fw by replacing s25fs128s on the same board. This is to understand that the PMODE was proper as you confirmed that everything works fine with w25q32fw.

In addition to this, please let me know if any other SPI devices are connected to FX3.

Also, please try the following test:

1. Use the flash s25fs128s on your device,

2. Download the firmware to flash using control center.

3. Now do not change the PMODE setting to 0z1. Instead, load the firmware cyfxflashprog to RAM. This project comes along FX3 SDK and can be found in the following location:

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxflashprog

4. Refer to the readme file of this project which includes a vendor command to read data from the flash (0xC3).

5. Use this vendor command and read back the contents of the flash.

6. Compare the data that is read back and let me know if there are any changes between the data written to flash and data read back from the flash.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
hola_4724651
Level 2
Level 2

yes,  replacing the device  taked place on the same board and there is no another spi device connecting to fx3.

using s25fs128s as spi flash and keeping pmod = 0z1, after downloading the firmware to flash, control center rejects action of download to ram, noticing "please reset your device to download the firmware"

0 Likes

Hello,

Sorry for not being clear in my previous response. Please find the detailed response below:

1. Use the flash s25fs128s on your device. Keep the PMODE setting as z11.

2. Download the test firmware to flash using control center.

3. Now, keep PMODE setting as z11 itself (do not change the PMODE setting to 0z1). Load the firmware cyfxflashprog to RAM. This project comes along FX3 SDK and can be found in the following location:

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxflashprog

4. Refer to the readme file of this project which includes a vendor command to read data from the flash (0xC3).

5. Use this vendor command and read back the contents of the flash.

6. Compare the data that is read back and let me know if there are any changes between the data written to flash and data read back from the flash.

Please let me know if you still face any issues.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
hola_4724651
Level 2
Level 2

soryy, upstare there shoud be z11, i meant

using s25fs128s as spi flash and keeping pmod =z11, after downloading the firmware to flash, control center rejects action of download to ram, noticing "please reset your device to download the firmware"

0 Likes

Hello,

After step 2 of my previous response, reset the device once. Then the device will re-enumerate as USB Bootloader device. After this continue the remaining steps.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
hola_4724651
Level 2
Level 2

thanks for info.

yet on windows10 os, i'm not sure how to use command to read back contents. there is no debug port on board

0 Likes

Hello,

After step 3 mentioned in my response 4, the device enumerates as USB Bootprogrammer Device in control center. Now you can use vendor commands to read the contents of flash (this firmware has implemented this feature).

Please refer to the following snapshot:

pastedImage_0.png

Expand the device tree in control center and choose Control Endpoint. Now set the different settings as shown in the snapshot. If you hit on Transfer Data, then you can see the data read back from flash as shown in the snapshot. Another option is to select Transfer File which saves the data read into a file. This file can be viewed by using Hex Editor.

Please keep the Bytes to transfer field as a multiple of 256 and less than or equal to 4096.

The page size of the flash is assumed to be 256 bytes and byte address is computed by multiplying wIndex by 256.

By changing the Bytes to Transfer and wIndex field, you can read the contents of the flash completely. Please try this and compare with your firmware image and let me know if they are different or same.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
hola_4724651
Level 2
Level 2

yes, they are different! as showing, left one is readout from flash and right on is img of <cyfxusbspiregmode>.

the first difference appears at position of 10h*c, there should be 2c but 24 instead.

how it happens?

pastedImage_0.png  pastedImage_1.png

0 Likes
hola_4724651
Level 2
Level 2

i just wonder if it is because of special section of s25fs-l for high density and want to know how to deal with it. thanks.

pastedImage_0.png

0 Likes

Hello,

Please try the test that I mentioned in my response 6 multiple times and let me know if the error is happening again and at the same locations.

If it is happening again, please try the following test:

1. Do not program the flash using control center.

2. Erase the flash content by using the vendor command 0xC4 and the settings shown in the following snapshot:

pastedImage_0.png

3. Now use the vendor command 0xC4 again with the following settings to check if the erase is complete or not.

pastedImage_0.png

The data should be 00 as shown in the snapshot if it is success.

You can try to read back the contents of flash once to verify if the erase was successful. Please share a snapshot of the same.

4. After this, write some data to flash using the vendor command 0xC2. In the Data to send field, use incremental data so that it will be easy to test. The bytes to transfer field will be automatically changed based on the data that you enter in the data to send field. Please refer to the following snapshot for the other settings.

pastedImage_3.png

5. Now read back the contents of flash by using the vendor command 0xC3. The settings is shown in the following snapshot.

pastedImage_4.png

Please use the direction field as mentioned in the snapshots. If that is not correct, then the transfers will fail. Please try this and let me know if the received data is incremental or not.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

more agin, the data readout are different from the ones writein.

pastedImage_0.png

0 Likes

Hello,

Can you read back the contents of flash after erasing the sector is successful (i.e after step 3 of my previous response)? Please share the snapshot of the same also.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

reset the device and then download cyfxflashprog.img to ram, coming with erase and read.

pastedImage_0.pngpastedImage_0.png

0 Likes

Hello,

No, this is not what I want. Sorry again for not being clear in my previous response. Please follow the steps that I describe below. Also, share the snapshot for each step from step 2:

1. Program RAM with flashprog firmware. Do not program flash with any firmware.

2. Erase the flash content by using the vendor command 0xC4. The setting is shown as a snapshot below:

pastedImage_1.png

3. Read the status by again using vendor command 0xC4. The snapshot of the settings is shown below:

pastedImage_2.png

If the status is 0 then it indicates that the erase is sucessfull.

4. Read back the 4096 bytes of data from the SPI flash and check if all of them are FFs. The settings is shown below:

pastedImage_2.png

5. Now write one byte of data to the flash. The settings is shown below:

pastedImage_4.png

6. Now read back the data that was written and check if it is same as that was written in step 5.

pastedImage_3.png

Please note that if you change any of the settings other than what I have mentioned in this response, then it may not work properly and report errors.

Please share snapshots after each step.

If the data written in step 5 and data read back in step 6 are identical, then please reset the device and do the step 1-4 in this response again. This is because before writing new data into flash, you need to erase the sector again. Now, instead of sending 1 byte of data as is done in this response, try sending 256 bytes. Now read back the same and check if they are same.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

i am sorry for my late and thanks a lot for your patience.

there is something wrong at step 4,when i tried to read back data from flash, it shows that erase is not finished.

pastedImage_0.png

0 Likes

Hello,

As mentioned in my previous response, please share the snapshot of each step so that I can cross check if the commands are proper or not.

Also, please let me know if the flash used on this board is fresh or is being reused for a long time. Do you have an extra s25fs128s with you?

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

step1

pastedImage_0.png

step2

pastedImage_1.png

step3

pastedImage_2.png

step4

pastedImage_3.png

the deivices f25fs128s i used just have been programmed some times for triing differnt firmware , thus they are not fresh chips.

i will try some fresh devices 2 days latter for i'm now on vacation.

thanks.

0 Likes

Hello,

You can test the previous steps with a fresh flash after your vacation.

In addition to that, please test the following steps with the existing flash.

1. Load the attached firmware into RAM.

2. Use the vendor command as shown in the following snapshot.

pastedImage_1.png

Note that this will read device ID of the flash. I have tested this with another flash and not the one which you are using. Hence the values will be different.

3. Share the snapshot of your control center so that I can check if the values returned are proper or not.

Please let me know if you face any issues.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

with a fresh one, its readout vendor id likes this:

pastedImage_0.png

0 Likes

can i ask which device do you test, please? thanks.

0 Likes

with this new chip, when i test writing something to flash and read them out, it shows the first date changed.

pastedImage_1.png

0 Likes

Hello,

Please let me know what was the device ID obtained with the old flash by following the steps mentioned in response 21. This test is done to check if the problem is related to flash or not.

Also, with the new flash can you please try the test that I mentioned in response 6 and share the results as you did earlier in response 11. The test is to program the flash using control center and read back the contents using flash prog firmware loaded in RAM. Please try this and share the snapshot of the result.

Also, Iam using Denebola kit for testing. This kit makes use of the flash part M25P40-VMN6TPB.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

With a fresh w25q32fw chip, using the attacked firmware in your response 21:

pastedImage_0.png

1, program ram and read out Vendor id(0000 EF 60 16 00):

pastedImage_2.png

2, erase flash

pastedImage_3.png

3, read the status

pastedImage_4.png

4, read back the 4096 bytes of data from the spi flash and check them

pastedImage_5.png

It is quit sure they are all FFs

5, write one bytes of data to the flash

pastedImage_6.png

6, read back the data and check it

pastedImage_7.png

It is same as written

As the data written in step 5 and data read back in step 6 are identical, i will try 256 bytes data:

1, reset the device and program ram with flashprog you supply in response 21.

pastedImage_8.png

2, erase the flash

pastedImage_9.png

3, read the status

pastedImage_10.png

4, read back the 4096 bytes of data from the spi flash

pastedImage_11.png

5, write 256 bytes of date to flash

pastedImage_12.png

6, read back the data

pastedImage_13.png

Yes, its same as written in

0 Likes

Hello,

It seems like there is a problem in the sector erase command. To confirm if this is happening only to the first sector or not, can you try writing and reading data into the second sector of s25fs128s? The steps to be followed are mentioned below:

1. Program the RAM with the flashprog image.

2. Use the vendor command to erase the second sector. Screenshot is shown below:

pastedImage_0.png

3. Check if the erase was successful by using the settings shown below:

pastedImage_1.png

4. Now read back the data from the page address 0x0100. The snapshot is shown below:

pastedImage_2.png

5. Write 1 byte of data into the flash. The screenshot is shown below:

pastedImage_3.png

6. Read back the data that was written as shown below:

pastedImage_4.png

If the data written in step 5 and data read back in step 6 are the same, then please erase the second sector and read data to check if all the locations are FF's. Then you can try sending multiple bytes. Please note that the commands should be used as mentioned in the screenshot. Otherwise it will give errors. Also, please share the snapshot after each step.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

thanks for you helping and maybe we have fixed it

i think it's because that the spi flash device s25fs128s is newer than cypress  fx3 sdk 1.3.4,  some change has to take place in sdk :

since s25fs128s as a new dive, only in 64K-uniform the flash can be erased correctly by command D8h and so setting the register CR3NV[3] value to 1 is need in document of cyfxflashprog.c.

pastedImage_1.png

and now no matter how many times erase we try, the data read out are all same as the ones we written in.

i'm not quit sure if what we've done is completely correct, but it does work good.

will you please check it up? thanks.

0 Likes

EDITTED

Hello,

Your understanding is correct. By default the flash s25fs128s makes use of hybrid sectors. So the command D8 cannot be used to erase the first sector. In order to confirm this, we recommended you to read the second sector in the previous response. According to my understanding you changed this hybrid sectors to uniform sectors by the firmware modifications mentioned in your previous response. This is a correct approach.

Now, according to my understanding, you are able to write and read data from the first sector without any issues.

Please note that the firmware flashprog is internally called by the control center for downloading the firmware. The flashprog need to be modified depending on the flash that is used on the board. Please share the source code of the firmware with the fix for us to inspect. If the firmware is proper, then you can go ahead and add the modified firmware image to the following location:

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\c_sharp\controlcenter

While doing so, please make sure that the .img built by the modified firmware has the same name as that present in the path mentioned above.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

we have tested the second section many times and it works good too.

here is source code. !

and i just wonder how the other persons deal with s25fs128s and s25fs256s. is there a better way to solve this problem? or are there no problems at their work by using these devices?

unless we are the first ones to face this problem

0 Likes

Hello,

The source code looks fine. Please replace the flash prog .img present in the following location with the one that was generated by building your firmware.

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\c_sharp\controlcenter

Note: This path depends on the installation directory of FX3 SDK.

You can make a backup of the existing .img file if required. Please make sure that the .img built by the modified firmware has the same name as that present in the path mentioned above.

After this, open the control center and check if you are able to program the flash using control center and boot by setting the PMODE pins to 0z1.

Also, please note that this new version of control center may not work as desired for a different flash.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

by steps you ordered, i replaced the firmware in C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\application\c_sharp\controlcenter by the one i generated before, and then chosed some example firmware projects:

1,keep pmode = z11 and reset the device;

2,programed spi flash;

3,set pmode = 0z1 and reser the device

and so on.

yes, many different firmware programmed, and many times reset , still the info shows that device works at usb3.0, which i think boot from flash.

pastedImage_0.png

pastedImage_2.png

0 Likes

Hello,

I find that the boot is proper right now. Please let me know if you have anymore questions on this thread.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

up to now, there is no other question on the thread.

thank you very much for focusing on this topic!

0 Likes

Hello,

In addition to my previous response, please use the new flash and perform the steps mentioned in my response 17. The steps are:

1. Erase the flash contents.

2. Check if erase is successful.

3. Read the contents of flash before writing data into it.

4. Write data into flash.

5. Read back the data from the flash.

The detailed steps to be followed is already elaborated in my response 17. Please provide the snapshot of each step. This is essential to debug the problem. In your response 24, you have provided the snapshot for writing data into flash and reading data from flash only. Please provide the remaining snapshots also so that we can debug this issue.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes

With another fresh s25fs128s chip, using the attacked firmware in your response 21:

pastedImage_0.png

1, program ram

pastedImage_1.png

2, erase flash

pastedImage_2.png

3, read the status

pastedImage_3.png

4, read back the 4096 bytes of data from the spi flash and check them

pastedImage_4.png

It is quit sure that they are all FFs.

5, write one bytes of data to the flash

pastedImage_5.png

6, read back the data and check it

pastedImage_6.png

It is same as written

-------------------------------------------------------

As the data written in step 5 and data read back in step 6 are identical, i will try 256 bytes data:

1, reset the device and program ram with flashprog you supplied in response 21.

pastedImage_7.png

2, erase the flash

pastedImage_8.png

3, read the status

pastedImage_9.png

4, read back the 4096 bytes of data from the spi flash

pastedImage_10.png

Here i find that the first data has been changed to 00, and the rest ones are FFs;

Then i think there is no need to continue trying rest steps 5 and 6...

0 Likes