1 Reply Latest reply on Aug 26, 2019 1:53 AM by EktaN_26

    Is it possible to clear SFLASH memory while programming in PSoC 4?

    MeSe_4244671

      I am using SFLASH to record user preferences but I would like to erase it when I reprogram.

       

      Is it possible to erase SFLASH memory in each proggraming with Psoc programmer? I am using psoc4.0 .

        • 1. Re: Is it possible to clear SFLASH memory while programming in PSoC 4?
          EktaN_26

          Hello,

           

          The SFLASH does not get automatically erased when you program your device using PSoC Programmer. It is possible to erase SFLASH memory in each programming by using any of the two methods given below:

           

          1) You can make use of the CySysSFlashWriteUserRow() API to write 0 to the desired SFLASH rows at the beginning of each program. This will be same as erasing the SFLASH.

           

           

          #include <project.h>

           

          uint8 sFlashData[CYDEV_FLS_ROW_SIZE];

           

          int main(void)

          {

              uint16 i;

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

              {

                  sFlashData[i]= 0;

                 CySysSFlashWriteUserRow(0, sFlashData);

              }

                

              for(;;)

               {

           

                }

            

          }

           

          This can be done for all the four flash rows.

           

          2) You can also use the SFLASH Update tool which gets downloaded as a part of PSoC Programmer to program the SFLASH.

           

           

          Regards

          Ekta

          1 of 1 people found this helpful