6 Replies Latest reply on Nov 19, 2020 11:23 PM by Ascs_4819156

    Why is  downloading file to SPI Flash so slow?

    Ascs_4819156

      Dear sir,

      Now, I tried to download a file into SPI flash. This spi flash is W25Q32FW.

      the SPI code is copied from the cyfxspiprog. Now it could be download into the flash.

      but the speed is very slow. The file is about 2M, it needs about 2 minutes to download it.

      According to the code, the SPI's bit rate should be 10M, So I think there is something wrong.

      Do you have any idea?

      Thanks

        • 1. Re: Why is  downloading file to SPI Flash so slow?
          SudheeshK_26

          Hello,

           

          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,

          Sudheesh

          • 2. Re: Why is  downloading file to SPI Flash so slow?
            Ascs_4819156

            Dear Sudheesh,

            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.

            Thanks

            • 3. Re: Why is  downloading file to SPI Flash so slow?
              JayakrishnaT_76

              Hello,

               

              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.

               

              Best Regards,

              Jayakrishna

              • 4. Re: Why is  downloading file to SPI Flash so slow?
                Ascs_4819156

                Dear Jayakrishna,

                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.

                Thanks

                Asis

                • 5. Re: Why is  downloading file to SPI Flash so slow?
                  JayakrishnaT_76

                  Hello,

                   

                  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.

                   

                  Best Regards,

                  Jayakrishna

                  • 6. Re: Why is  downloading file to SPI Flash so slow?
                    Ascs_4819156

                    Dear Jayakrishna,

                    OK, got it.

                    Thanks for your support.

                    Asis