5 Replies Latest reply on Sep 6, 2019 4:17 PM by BushraH_91

    Accessing NOR (S25FL128L) flash from windows 10 (USB) with FTL block driver

    SiJo_4020596

      Dear All,

      Currently we are trying to access the NOR flash from windows over USB-MS class device. FTL (block driver in Cypress FFS) integrated in our application and using FTL as block driver.

      We are able to format the flash from windows. And able to copy the files to flash. But when we eject the device (which contains the flash) and again rec-connect to the PC, it is found files are corrupted. Files names and there sizes read successfully, but files are corrupted.

      We suspect that this issues is due to wrong configuration and porting of FTL block driver. Below is the configuration for the FTL.

       

      FTL configuration

      #define NUMBER_OF_BYTES_PER_SECTOR        (512)

       

      #define NUMBER_OF_SECTORS_PER_PAGE        (8)

       

      #define SECTOR_SIZE                       (NUMBER_OF_BYTES_PER_SECTOR)

      #define EBLOCK_SIZE                       (0x1000) 

      #define NUMBER_OF_ERASE_BLOCKS            (4096)

       

      Device side USB interface configuration as below,

      Number of blocks --> 4096

      Size of each block --> 4096 bytes

      MSC media packet size --> 4096 bytes

       

      NOR flash configuration

      For NOR flash write we are using command PP (Page programming : 02h, max write size 256 bytes)

      For NOR flash read we are using command Read (03h)

      For NOR flash Erase we are using command Sector Erase (20h, sector size 4096 bytes)

       

      Kindly provide us the appropriate inputs to overcome the mentioned issue, also help us to point out the mismatch in configuration.

      Is there any specific initialization sequence for FTL and any specif eject (USB) sequence to store the data properly.

        • 1. Re: Accessing NOR (S25FL128L) flash from windows 10 (USB) with FTL block driver
          BushraH_91

          Hello,

          Can you please let me know the full MPN?

           

          Thank you

          Regards,

          Bushra

          • 2. Re: Accessing NOR (S25FL128L) flash from windows 10 (USB) with FTL block driver
            SiJo_4020596

            Hi,

            Full MPN of NOR flash is S25FL128LAGNFV010 WSON8

             

            Thanks and regards,

            Sidharth

            • 3. Re: Accessing NOR (S25FL128L) flash from windows 10 (USB) with FTL block driver
              BushraH_91

              Hello,

              Please response to the following questions below:

              • How many files were copied to the USB storage before ejecting?
              • How many files were corrupted?
              • This symptom can be observed every time you eject the USB?
              • What FTL operation is performed at eject event? Do you call FTL_Shutdown()?

               

              Thank you

              Regards,

              Bushra

              • 4. Re: Accessing NOR (S25FL128L) flash from windows 10 (USB) with FTL block driver
                SiJo_4020596

                Hi,

                Below are the answers for above questions and based on the configuration mentioned above.

                 

                • How many files were copied to the USB storage before ejecting?

                --> 3 to 4 files (.txt,.pdf) were copied from PC of size ranging from 1KB to 3 MB.

                • How many files were corrupted?

                --> All files were corrupted

                • This symptom can be observed every time you eject the USB?

                --> Yes

                • What FTL operation is performed at eject event? Do you call FTL_Shutdown()?

                --> Initially there was no FTL operation is performing on eject or directly removal of the USB.

                But after calling FTL_Shutdown() on eject event and when reconnect again the USB to the windows system, sometime FTL_InitAll() call getting failed (with error code FTL_ERR_LOG_GET_ENTRY  or FTL_ERR_NOT_FORMATTED) and shows error pop-up "Please insert the disk" at PC side.

                 

                Later we made some changes in configuration of USB-MS driver (while providing capacity at connect event) as below,

                • Number of data blocks set to "stFlashCapacity.numDBlocks-1".
                • Size of the each block set to 512 bytes.
                • MSC media packet size set to 512 bytes and configuration for FTL is as same as mentioned previously.

                Below is the behavior after mentioned changes,

                we have copied 3 files into USB drive through the windows system. Then ejected and re-connected USB to the PC, 3 times always proper files.

                But after restart the device,  "FTL_InitAll" goes into the error (i.e. FTL_ERR_LOG_GET_ENTRY or FTL_ERR_NOT_FORMATTED) or corrupted files. Also we tried FTL_Shutdown(), but does not help.

                 

                 

                Below are the member values of the "FTL_CAPACITY" structure, that getting when called the "FTL_GetCapacity" function.

                •    stFlashCapacity.totalSize = 16367616;  
                •    stFlashCapacity.numDBlocks = 31968;
                •    stFlashCapacity.numEBlocks = 4096;
                •    stFlashCapacity.eBlockSizeBytes = 4096;
                •    stFlashCapacity.eBlockSizePages = 1;
                •    stFlashCapacity.pageSizeDBlocks = 8;
                •    stFlashCapacity.pageSizeBytes = 4096;
                •    stFlashCapacity.numBlocks = 31968;
                •    stFlashCapacity.blockSize = 4096;

                 

                Requesting to provide the correct FTL initialization or Eject sequence and configuration changes if required. Also do you have any example of USB-MS to work in-conjunction with windows.

                 

                 

                 

                 

                 

                • 5. Re: Accessing NOR (S25FL128L) flash from windows 10 (USB) with FTL block driver
                  BushraH_91

                  Hello Sidharth,

                  Since we are working offline, I am closing this thread.

                   

                  Thank you

                  Regards,

                  Bushra