2 Replies Latest reply on Oct 9, 2019 2:40 AM by ApurvaS_36

    S25FL064L of blank check command

    HiKu_1337496

      HI,

       

      Is there a blank check command for S25FL064L product, as in the GL-S/GL-T series?

      If not, is there any firmware code that can be used as a reference for the user to create?

       

      Best Regards,

      Kumada

        • 1. Re: S25FL064L of blank check command
          ApurvaS_36

          Hi Kumada san,

           

          Unfortunately, there is no blank check command for S25FL064L device. The only way to check whether the sector is programmed or erased is to read the particular sector and compare each byte with FFh. If all bytes are FFh it means the sector is erased. However, even if one bit is found to be zero, it means the sector is programmed and needs to be erased before another program operation.

          Please let me know if you need any further assistance from our side.

           

          Best Regards,

          Apurva 

          • 2. Re: S25FL064L of blank check command
            ApurvaS_36

            Hi Kumada san,

             

            There are two ways in which this problem can be solved -

            1. The customer can maintain a lookup table for sectors which are programmed and erased. Whenever a sector is programmed or erased, the status of that particular sector should be updated in the look up table. Before programming any particular sector, the status for it should be checked in the look up table and then depending upon its status either the sector should be erased before programming or should be programmed directly.
            2. Before programming a particular sector, the entire sector should be read and stored in a buffer. Each byte of that buffer should be compared with FFh. Even if one byte is found to be mismatched the sector should be erased before reprogramming.

             

            The steps to check whether a 4KB sector is erased or programmed are as follows -

            1. Read 4KB (4096 bytes) from a particular sector and store it in a buffer (rxBuffer).
            2. Compare each byte in the buffer with 0xFF.
            3. As soon as a mismatch is found, update a flag (temp).
            4. Depending upon the final status of the flag, decide to erase or program the sector.

             

            Sample function -

             

            #define EQUAL 1

            #define NOT_EQUAL 0

             

            int Blank_Check(uint8_t rxBuffer[])

            {

                int temp = EQUAL;

                int i;

                for(i=0;i<4096;i++)

                {

                    if(rxBuffer[i] != 0xFF)

                    {

                        temp = NOT_EQUAL;   

                        break;

                    }

                }

                return(temp);

            }

             

            Please let me know if you have any further queries.

             

            Best Regards,

            Apurva