8 Replies Latest reply on Sep 13, 2018 7:41 PM by shkc_3690311

    S25FL128 PPB Erase not working

      Hi ,

       

      I am using S128FL128S SPI  flash memory with zynq.

      I am using Persistent Protection Mode for sector protection. I used PPB Program command(PPBP-E3) to lock a sector starting from 0x00(32 bit address). Then I read PPB access register using PPB read command(E2), its 0x00. So I am not able to erase that sector.

      Then i sent PPB Erase (E4) command (after WREN-0x06). Again i tried to erase the sector, but failed and PPB access register is still 0x00.

      I am not writing to any lock bits. I have successfully erased and programmed that sector before using PPBP command.

       

      Is there any commands / way to erase PPB bits???

      Hoping for the guidance.

       

      Thank you

        • 1. Re: S25FL128 PPB Erase not working
          ApurvaS_36

          Hi,

           

          Thank you for contacting Cypress Community.

          Can you please give us the complete sequence of commands that you are sending?

          Also, try to read the value of the Status Register and Configuration Register after sending the PPB Program command and let us know what these values are.

            

          Thanks and Regards,

          Apurva

          • 2. Re: S25FL128 PPB Erase not working

            Hi Apurva,

             

            Thank you for the reply.

            My program sequence is as below:

            To read PPB Access register:-

            CSb=0;// (LOW,manual control)

            writeBuffer[0]=0xE2;

            WriteBuffer[1] = (u8)((Address & 0xFF000000) >> 24);//32 bit address, now Address=0x00

            WriteBuffer[2] = (u8)((Address & 0xFF0000) >> 16);

            WriteBuffer[3] = (u8)((Address & 0xFF00) >> 8);

            WriteBuffer[4] = (u8)(Address & 0xFF);

            qspi_write(WriteBuffer,5,value);//5 is number of bytes to transfer

            //value has MISO data (8 bit)

            CSb=1;//HIGH

            printf("PPB access register value= 0x%x\r\n",value);

             

            To erase PPBits:-

            u8 ReadStatusCmd[] = { 0x05, 0 };//Read status register 1

            u8 FlashStatus[2];

            CSb=0;

            qspi_write(0x06,1,NULL);//Write enable, NULL means nothing to read back

            qspi_write(0xE4,1,NULL);//PPB Erase command

            while (1) {

                 qspi_write(ReadStatusCmd, FlashStatus,sizeof(ReadStatusCmd));

                 //The Write-In Progress (WIP) bit is a 1 during the self-timed PPBErase operation, and is a 0 when it is completed

                 if ((FlashStatus[1] & 0x01) == 0) {//checking WIP bit

                      break;

                 }

            }

             

            Thank you

            • 3. Re: S25FL128 PPB Erase not working
              ApurvaS_36

              Hi,

               

              In the code snippet for erasing PPB bits, the Chip Select signal is not being made HIGH and LOW for the required number of times.

              You could try this command sequence and let us know the results -

               

              1. CS LOW

              2. WREN command (06h)

              3. CS HIGH

               

              4. CS LOW

              5. PPB Erase (E4h)

              6. CS HIGH

               

              The PPB Erase command will be executed only after the CS goes HIGH. (You can go through the explanation for the PPB Erase command on page 119 of the datasheet. Datasheet link - http://www.cypress.com/file/177966/download).

              You can do the polling of the WIP bit after making CS HIGH.

               

              Thanks and Regards,

              Apurva

              • 4. Re: S25FL128 PPB Erase not working

                Hi Apurva,

                 

                Thank you for the reply.

                Now am controlling CSb inside qspi_write(***) function. At the starting of function, am assigning CSb =0 and at the end CSb=1.

                But the PPB Access register value for any 32-bit address (including 0x00) showing as 0x00 only(PPB read)!!!

                 

                To erase PPBits (current):-

                u8 ReadStatusCmd[] = { 0x05, 0 };//Read status register 1

                u8 FlashStatus[2];

                 

                qspi_write(0x06,1,NULL);//Write enable, NULL means nothing to read back, CSb=low and after transfer CSb=high

                qspi_write(0xE4,1,NULL);//PPB Erase command, CSb=low and after transfer CSb=high

                while (1) {

                     qspi_write(ReadStatusCmd, FlashStatus,sizeof(ReadStatusCmd));//, CSb=low and after transfer CSb=high

                     //The Write-In Progress (WIP) bit is a 1 during the self-timed PPBErase operation, and is a 0 when it is completed

                     if ((FlashStatus[1] & 0x01) == 0) {//checking WIP bit

                          break;

                     }

                }

                 

                Thank you

                • 5. Re: S25FL128 PPB Erase not working
                  ApurvaS_36

                  Hi,

                   

                  Can you please tell us the value of the Status Register after sending the PPB Erase command.

                  Also, please try to send the PPB Lock Bit Read (A7h) command and check the status of the PPB lock bits and let us know.

                   

                   

                  Thanks and Regards,

                  Apurva

                  • 6. Re: S25FL128 PPB Erase not working

                    Hi Apurva,

                     

                    As per your guidance, I read the lock bit status (A7h) and it was 0. So I restarted the board and tried to erase PPB and it worked as lock bit was 1.

                     

                    I am using S25FL128 flash of Uniform 64-kB sectors type. Now am trying to lock for other addresses(considering info in pg. no. 47 of datasheet). But other than 0x00, PPBP is not effective. Not able to lock other sectors!!!!

                    Other addresses i tried are: 0x00001000, 0x0001F000, 0x00002000, 0x00040000, 0x00020000, 0x00FF0000, 0x00FD0000

                    Is the PPB lock specified for some address???not all??

                    Is the address provided is corrrect??

                     

                    Thank you

                    • 7. Re: S25FL128 PPB Erase not working
                      ApurvaS_36

                      Hi,

                       

                      The starting addresses for 64-kB sectors will be 0x00000000, 0x00010000, 0x00020000, 0x00030000 and so on.

                       

                      Could you please check the status of the PPB Lock bit every time before sending the PPBP (E3h) command?

                      If the PPB Lock bit is 0, power on or reset the board to make it 1 and try to send the PPBP command again.

                      If you are still not able to program the PPB bits for other sectors, then try to read the Status Register value after sending the PPBP command and check the status of the P_ERR bit to see whether the programming has completed or not.

                       

                      Let us know the results you obtain.

                       

                      Thanks and Regards,

                      Apurva

                      • 8. Re: S25FL128 PPB Erase not working

                        HI apurva,

                         

                        I am able to able to PPB lock & unlock the sectors (4kbytes) from 0x00 to 0x0000F000. From 0x00010000 not able to lock. The PPB access register value is changing.

                        Thank you for your help... Will check with my Flash write method.

                         

                        Thank You