1 2 Previous Next 15 Replies Latest reply on Oct 19, 2020 5:08 AM by SiJo_4020596

    Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)

    SiJo_4020596

      Dear All,

      Currently, we are accessing the NOR flash from windows over the USB-MS class device. Spansion FTL (block driver in Cypress FFS) integrated into our application and using FTL as a block driver.

      We are facing the below-pointed issue,

      1. Taking approximately 3 min for complete chip erase.

      2. Taking 11 -12 min to copy 12 MBytes of file from USB

       

      Note:- Configured only 14MBytes for USB MSC out of 16 MBytes of Memory

       

      Because of the above issue system performance is degraded.

      Requesting you the find attached configuration file that we did and provide support to resolve this issue.

        • 1. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
          BushraH_91

          Hello Sidharth,

          In Format.h, you are using 4KB erase block. Small erase block size is not efficient in terms of space usage. We suggest to use 64KB erase block instead.

           

          Line#51:

          #define EBLOCK_SIZE (0x10000)  /*64K, 128 pages @ 512B per page*/

           

          Line#68:

          #define NUMBER_OF_ERASE_BLOCKS (224U)

           

          Thank you

          Regards,

          Bushra

          • 2. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
            SiJo_4020596

            Hello Bushra,

             

            Thank you for giving attention to the problem.

             

            1. I have done changes suggested by you. But after that, I am getting error during NOR flash formatting.

             

            2. Also tried by doing the below changes,

             

            Line#49:- number of sectors per page change to 8 from 1.

            #define NUMBER_OF_SECTORS_PER_PAGE         (8)

            #define EBLOCK_SIZE                       (0x10000)

             

            Line#66:- value change to 2 from 40.

            #define NUM_FLUSH_LOG_EBLOCKS             (2)

             

            Line#67:- value change to 4 from 40.

            #define NUM_SYSTEM_RESERVE_EBLOCK_REQUEST (4)

            #define NUMBER_OF_ERASE_BLOCKS            (224U)

             

            After doing the above changes, I am not getting any error, and able to format flash within a minute.

            But when the device connected to the PC through USB, it asked for "Format disk" on every connection and disconnection of the USB (which was working fine with the previous configuration) also showing drive capacity to 12.3 Mbytes.

             

            Please help us with more changes required to work it properly.

            • 3. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
              TakahiroK_16

              Hello,

               

              We tested FTL on our PSoC6 platform. I attached diff screenshots that compares our configuration(right pane) with yours(left pane).

              We use S25FL064L so the NUMBER_OF_ERASE_BLOCKS in Format.h is smaller than yours, but it shouldn't be a matter.

               

              We formatted the volume, then repeated mount and unmount several times, but no error was observed.

               

              I assume that the "Format disk" you mentioned is a pop-up message on Windows, correct?

              Could you let us know the FTL's behavior at that time (i.e., what API returns what error code)?

               

              Thanks,

              Takahiro

              • 4. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
                SiJo_4020596

                Hello,

                 

                I assume that the "Format disk" you mentioned is a pop-up message on Windows, correct?

                ---> Yes, here formatting gets successful. but when disconnection and connection USB windows system again asked for formatting.

                 

                We are using the STM32L4 controller, ST FATFS file system, and USB MSC class.

                 

                Our system is working with configuration done in the file shared (i.e. Format.h and ftl_if_ex.h) by us on ticked, but facing performance issue with that configuration.

                And also with suggested changes, we are getting below observations,

                 

                1 Observation on changes suggested by Bushra on 29-Sept-2020:-

                •    Getting Hardfault in "FTL_InitAll --> TABLE_LoadFlushTable" function.

                 

                2. Observation with below changes:

                 

                Changes in Format.h file:-

                #define NUMBER_OF_SECTORS_PER_PAGE         (8)

                #define EBLOCK_SIZE                       (0x10000)

                #define NUM_FLUSH_LOG_EBLOCKS             (2)

                #define NUM_SYSTEM_RESERVE_EBLOCK_REQUEST (4)

                #define NUMBER_OF_ERASE_BLOCKS            (224U)

                 

                Changes in ftl_if_ex.h file:-

                #define CACHE_RAM_BD_MODULE            FTL_TRUE

                #define CACHE_MINIMUM_RAM              FTL_TRUE

                #define FTL_RPB_CACHE                  FTL_FALSE

                 

                 

                • The first time not getting any error, and formating was successful but the second time getting error code "29001" from "FTL_InitAll-->TABLE_LoadFlushTable".

                 

                3. Observation with below changes:

                Changes in Format.h file:-

                #define NUMBER_OF_SECTORS_PER_PAGE         (8)

                #define EBLOCK_SIZE                       (0x10000)

                #define NUM_FLUSH_LOG_EBLOCKS             (2)

                #define NUM_SYSTEM_RESERVE_EBLOCK_REQUEST (4)

                #define NUMBER_OF_ERASE_BLOCKS            (224U)

                 

                Changes in ftl_if_ex.h file:-

                #define CACHE_RAM_BD_MODULE            FTL_TRUE

                #define CACHE_MINIMUM_RAM              FTL_TRUE

                #define FTL_RPB_CACHE                  FTL_TRUE

                 

                • Getting compilation error "expected identifier". This error occurred because "CACHE_CLEAN" and "CACHE_DIRTY" are declared 2 times,
                • in ftl_def.h at line 1090 and at line 640.
                • If I comment lines 1090 and 1091 then the compilation error will be resolved.
                • With this configuration, after the success of "FTL_Format" API, the mount API of the file system get failed because of "FTL_DeviceObjectsWrite-->RPBCacheForWrite" function which returns error code "27001".

                 

                We not getting the right way to improve the performance, so waiting for your further input.

                • 5. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
                  TakahiroK_16

                  Hello,

                   

                  In our configuration for PSoC6, the FTL_RPB_CACHE is disabled. Sorry for missing this info from previous post.

                  Therefore, your #2 configuration is same with ours except the NUMBER_OF_SECTORS_PER_PAGE. Please try with '4' for that.

                   

                  If you still see the 29001 error during, please verify your SLLD HAL implementation. The '29001' means FTL_ERR_CACHE_NOT_FOUND.

                  In FTL_InitAll(), if the CACHE_RAM_BD_MODULE is enabled, page mapping info is read from Flash and RAM table (cache) is constructed.

                  If something wrong in Flash read, the RAM table may be corrupted or missing and that causes the error.

                   

                  Thanks,

                  Takahiro

                  • 6. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
                    SiJo_4020596

                    Hello,

                     

                    Thank you for the quick feedback.

                     

                    I have did changes suggested by you.

                     

                    Now the configuration is as below,

                     

                    Changes in Format.h file:-

                    #define NUMBER_OF_SECTORS_PER_PAGE         (4)

                    #define EBLOCK_SIZE                                               (0x10000)

                    #define NUM_FLUSH_LOG_EBLOCKS                      (2)

                    #define NUM_SYSTEM_RESERVE_EBLOCK_REQUEST        (4)

                    #define NUMBER_OF_ERASE_BLOCKS                                   (224U)

                     

                    Changes in ftl_if_ex.h file:-

                    #define CACHE_RAM_BD_MODULE                           FTL_TRUE

                    #define CACHE_MINIMUM_RAM                                 FTL_TRUE

                    #define FTL_RPB_CACHE                                           FTL_FALSE

                     

                    • Now getting error code "24005" from "FTL_InitAll-->TABLE_LoadFlushTable-->TABLE_GetTransLogEntry-->TABLE_GetTransLogEntry".

                     

                    Please let me know your comments and look at the attached SLLD HAL file as well

                     

                    Thank you.

                    • 7. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
                      TakahiroK_16

                      Hello,

                       

                      The 24005 can also be caused by incorrect read from Flash. Changing the NUMBER_OF_SECTORS_PER_PAGE affects size of Flash read and that would be a reason of different error code from previous.

                       

                      I saw the SLLD HAL. It's difficult for us to verify that because it's platform specific. One thing I would like to make sure is about bit 1 in the configuration register 1 (CR1[1]). You are using Quad operations so you need to set CR1[1] to enable quad operation in advance.

                       

                      Thanks,

                      Takahiro

                      • 8. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
                        SiJo_4020596

                        Hello,

                         

                        But we are not getting any error in the Flash read function.

                         

                        Regarding SLLD HAL, my query is not specific to our target platform. We are setting bit 1 in the configuration register 1 (CR1[1]) to enable QUAD operation in advance.

                        I am interested in to know if the required command or configuration used in proper.

                        • 9. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
                          SiJo_4020596

                          Hello,

                          Gentle reminder!

                          I am waiting for response, it you want more input please let me know.

                           

                          This issue is blocker for us.

                          • 10. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
                            TakahiroK_16

                            Your SLLD HAL looks OK. I would suggest to return SLLD_ERROR just in case an unsupported command is specified.

                            Please send your slld_targetspecific.h to check SLLD configuration.

                             

                            And please provide the simplest sequence to observe the errors in FTL API level, like:

                            1. Power ON

                            2. FTL_InitAll() with xxx parameters to format

                            3. ...

                            4. FTL_InitAll() with xxx parameters to mount again

                            5....

                             

                            Thanks,

                            Takahiro

                            • 11. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
                              SiJo_4020596

                              Hello,

                               

                              Thank you for looking into SLLD HAL.

                               

                              Please find attached "slld_targetspecific.h" file and below is the simplest sequence to observe the errors in FTL API,

                              1. Power ON

                              2. FTL_InitAll() with below parameters to mount the file system

                                      FTL_INIT_STRUCT initPara;

                                      FTL_STATUS ftlStatus = FTL_ERR_PASS;

                                      initPara.format = FTL_DONT_FORMAT;

                              3. if FTL_InitAll() return error FTL_ERR_NOT_FORMATTED start FTL format

                              4. After formating recall FTL_InitAll() with below parameters to mount the file system

                                      FTL_INIT_STRUCT initPara;

                                      FTL_STATUS ftlStatus = FTL_ERR_PASS;

                                      initPara.format = FTL_DONT_FORMAT;

                              5. call f_mount to mount file system

                              6. Enable USB CustomHID class

                              7. USB_StorageInitFS --> FTL_InitAll with below parameters. it will return error.

                                      FTL_INIT_STRUCT initPara;

                                      FTL_STATUS ftlStatus = FTL_ERR_PASS;

                                      initPara.format = FTL_DONT_FORMAT;

                               

                              We also tired by commenting 2 to 5 points, got the same error.

                               

                              Please review the attached file and let me know your comments.

                              • 12. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
                                TakahiroK_16

                                Hello,

                                 

                                Thanks for the info.

                                 

                                I don't see USE_QUAD_READ and USE_QUAD_WRITE definitions in your slld_targetspecific.h, while your HAL supports Quad read/write operations. I assume you define them somewhere else.

                                 

                                Regarding sequence to see the error, just to confirm, you don't call any other FTL APIs than FTL_Format() and FTL_InitAll(), correct?

                                We confirmed that sequence does not show any error on our test platform.

                                 

                                Is it possible to send Flash binary snapshot (i.e., 16MB raw binary Flash image) at every steps?

                                We can check if the images can be mounted or not on our side.

                                • 13. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
                                  SiJo_4020596

                                  Hello,

                                   

                                  1. Yes, I have defined USE_QUAD_READ and USE_QUAD_WRITE in another place.

                                   

                                  2. Other than FTL APIs, FTL_Format() and FTL_InitAll() API's I am calling FTL_GetCapacity(), FTL_DeviceObjectsRead(), and FTL_DeviceObjectsWrite() FTL API's.

                                   

                                  3. I did't understand how to collect Flash binary snapshot (i.e., 16MB raw binary Flash image) at every steps. Requesting you to specify the step to collect Flash binary snapshot (i.e., 16MB raw binary Flash image).

                                  • 14. Re: Issue with performance when using Spansion FTL + NOR (S25FL128LAGNFV010)
                                    TakahiroK_16

                                    In general, MCU vendors provides Flash programming tools that can access to the external Flash memory as well as MCU internal Flash.

                                    I reached to the Application Note below by a quick search by 'STM32 SPI flash programmer'.

                                    https://www.st.com/resource/en/application_note/dm00281415-programming-an-external-flash-memory-using-the-uart-bootloade…

                                    1 2 Previous Next