3 Replies Latest reply on Dec 23, 2019 2:26 AM by DheerajK_81

    PSoC62 erase SFlash

    JeHu_3414236

      When I want to reprogram the bootloader, I use PSoC Programmer to erase SFlash and Main Flash first.  Does this erase SFlash factory settings like trims and ID?  When I dump SFlash it does not show these registers so I don't know.  If I use the COM API PSoC6_WriteRow(), can I erase factory settings or are they write protected?

        • 1. Re: PSoC62 erase SFlash
          DheerajK_81

          Flash boot, trim constants, and the Table of Contents1 (TOC1) are located in SFlash (Supervisory Flash) which is restricted from being reprogrammed in either Normal or Secure modes. Please find the regions accessible in the SFlash below:

          sflash.PNG

           

          Writing to listed sub-regions is not possible when the chip is in SECURE Life Cycle stage. Writing to any Sflash address outside the specified sub-regions is not possible in any Life Cycle stage except VIRGIN, which is a factory-only stage.

           

          So, wehn you perform erase SFlash in PSoC Programmer, we are talking about the regions in the figure.

           

          PSoC6_WriteRow() can only be used on unprotected rows. Factory settings are write protected.

           

          Hope this answers your query

           

          Regards,

          Dheeraj

          • 2. Re: PSoC62 erase SFlash
            JeHu_3414236

            Thank you.  I want to reprogram a secure bootloader using the COM API and the example program from PSoC Programmer examples \Cypress\Programmer\Examples\Programming\PSoC6\SWD\C_Sharp.  In this example it does not erase SFlash before programming with this comment:

             

            //Do not erase Supervisory Flash region, since there stored device configuration data

            //PSoC6 device may be corrupted if SFlash will be erased

             

            Is this comment referring to something else besides the factory settings which can corrupt the device?  I tried programming different versions of the secure bootloader using the example code without erasing anything in SFlash first and it seems to work fine.  Is it correct to not erase anything in SFlash before programming the bootloader?

            • 3. Re: PSoC62 erase SFlash
              DheerajK_81

              The comment is relevant only when the silicon is in VIRGIN lifecycle. Silicons leave the factory only after they are transitioned to NORMAL mode and hence there is no way of overwriting or erasing the non-accessible regions of the SFlash.

               

              Sorry about the comment, we will remove it to avoid confusion.

               

              Is it correct to not erase anything in SFlash before programming the bootloader?

              I'm not sure about your application, but if you are following the steps to create a secure bootloader as mentioned in this application note, then when programming a secure bootloader, the corresponding public key is placed in the Table of Contents 2 (TOC2) in PSoC 6 MCU supervisory flash (SFlash).

               

              If your application doesn't need to store anything in the user accessible SFlash region, then you need not do anything concerning the SFlash.

               

              Regards,

              Dheeraj

              1 of 1 people found this helpful