Could you please let us know the Cypress device that you use in your application?
Also, please let us know more details about how you are testing and observing this issue.
Thanks and Regards,
Sorry, forget it. It is CYUSB3014, FX3.
I am writing a MFC demo now, and tried to download the file into SPI flash. So I can check the start time and finish time. Then I found this problem, it need about 2 minutes to download the 2M file. I also checked the data written in flash, they are right with the original data. Only the speed it not right.
For my spi config, its clock is 10,000,000. Wordlen is 8. DMA also is enable.
As per my understanding, the FX3's SPI lines are connected to the flash only. If my understanding is correct, then please perform the following test and let us know if the same amount of time is taken for downloading the file to the flash.
1. Set the PMODE pins to Z11 and connect the FX3 device to the host.
2. The device will enumerate as FX3 Bootloader Device in Control Center Application.
3. Click Program->FX3->SPI Flash. Choose the file that you plan to write to the flash.
4. Wait until control center shows Programming SPI flash succeeded.
Please do the test mentioned above and let us know if you still see 2 minutes to load the file to the flash.
In addition to this, please let us know the following:
1. Which example project was referred for implementing the code for writing into SPI flash?
2. How are you transferring the file that is to be written to SPI flash to FX3? Is it through the USB? If yes, please let us know more details on the implementation of the host application.
Thanks for your reply.
I followed your suggestion and downloaded the file through control center.
Now I use the bushound to capture the time. Then it start to erase the flash at 14:09:38. And the eraser is finished at 14:10:36, it taked about 1 minutes to erase. After erase, it begins to download, and download is finished at 14:12:10. So it takes about 90 seconds to download.
Compared with my demo, it saves about 30 seconds。Considering that there are some pre-download verifications in my demo, so I need a longer time to download.
Now for firmware, I am using USB streamer example as the basic project, and add the SPI part from USBFlashProg example, changed the clock to 10,000,000.
Yes, I am using USB to transfer the file. And the USB is recognized as USB3.0 now.
And for my demo, it use CCyUSBDevice from CYAPI, and use the xfer function to transfer data.
If you need more detaild, please let me know.
The result that you see is expected. This is because of the following reasons:
1. On the host application side, you will be splitting the file into chunks of 4KB (4096 bytes). Then these chunks are sent to the driver using xferdata with the length parameter being 4096. This length cannot be increased beyond 4096 bytes for control transfers. Thus the files is divided into chunks of 4096 bytes and sent to the device. This could add up delays while the host schedules the transfers.
2. Inside the firmware, after erasing sectors, again a vendor command is issued to check if the flash is busy or not. For greater file size, more number of sectors needs to be erased and hence more number of checks needs to be done after erase. This could again add the delay.
3. Again, when the write command is issued to the device, the firmware internally splits it and writes one page at a time to the flash. After each page write, there is a 10ms delay. This delay is required by the flash for writes to be successful. This means that the device again splits the 4096 bytes received into pages of 256 bytes (page size set in the firmware) each. At the end of each page write, an additional 10ms delay is added. This will again add up to the delay.
All these factors will cause a greater delay for writing larger files into the flash from the host (2MByte). This observation is an expected behaviour.
OK, got it.
Thanks for your support.