7 Replies Latest reply on Oct 18, 2019 1:38 AM by ApurvaS_36

    FLASH Part Cypress S29JL032J In-System Sector Protect Programming

    MiSw_4385396

      We employ Cypress flash device P/N S29JL032J70TFI310 in our product design. There is application code residing in the bottom-most sector SA0 (0x0000) of the subject device that needs to be protected from inadvertent erasure.

       

      Per the attached Cypress datasheet 002-00857 Rev. *J, paragraph 8.10 (page 22), I can do an in-system sector protect of any flash sector such as SA0.  Implementing this algorithm as depicted in Figure 2. In-System Sector Protect/Unprotect Algorithms (page 24), it appears to be successfully performed as signified by a data value “01h” <Data = 01h?> when any byte location within the boot sector is read back.  However after protecting the boot sector per the algorithm, when I subsequently execute a chip erase command the boot sector is erased with all other sectors.

       

      Is that correct device operation or am I incorrectly implementing or interpreting the sector protect algorithm?  In other words, does the in-system sector protect pertain only to the individual sectors and will not protect those sectors from an inadvertent chip erase command?

       

      Thank you.

       

       

       

       

        • 1. Re: FLASH Part Cypress S29JL032J In-System Sector Protect Programming
          SudheeshK_26

          Hello Mike,

           

          Could you please double check the voltage on RESET# pin while executing sector protection command sequence and sector erase command sequence? Voltage on RESET# pin should be VID during sector protection and VIH during sector erase.

           

          Thanks and Regards,

          Sudheesh

          • 2. Re: FLASH Part Cypress S29JL032J In-System Sector Protect Programming
            MiSw_4385396

            Hi Sudheesh,

             

            Thank you for responding to the my question. I’ve been out of town on family leave so I apologize for this late follow-up.

             

            During the sector protect command sequence RESET# is pulled up to 12.0 VDC and then set back to VIH level when sector protect programming completes (sector data read = 01h). The RESET# is at the VIH level during the sector erase too.

             

            Regards,

            Mike

            • 3. Re: FLASH Part Cypress S29JL032J In-System Sector Protect Programming
              ApurvaS_36

              Hi Mike,

               

              Could you please tell us the status of the WP#/ACC pin?

              If you go to page 12 of the datasheet, Note 4 tells the protection status of the sectors with regards to the voltage on the WP#/ACC pin. Also note that leaving the WP#/ACC pin floating or unconnected might result in inconsistent device behavior.

               

              Best Regards,

              Apurva 

              • 4. Re: FLASH Part Cypress S29JL032J In-System Sector Protect Programming
                MiSw_4385396

                Hello Apurva,

                 

                I appreciate your response.

                 

                The schematic shows WP#/ACC grounded through a resistor and I confirmed by measuring WP#/ACC = VIL , or 0.0 VDC.

                 

                I just noticed that I may be incorrectly programming the Sector Protect operation. In the Addresses column of Table 1 on page 12 for the Sector Protect operation gives “SA, A6 = L, A1 = H, A0 = L” . What does A6 = L, A1= H, and A0 =L indicating to do? Do I force those address lines to the levels indicated (L=0, H=1)?

                 

                Regards,

                Mike

                • 5. Re: FLASH Part Cypress S29JL032J In-System Sector Protect Programming
                  ApurvaS_36

                  Hi Mike,

                   

                  Thank you for your reply.

                  Yes, your understanding of Table 1 is correct. You need to force these lines to the indicated levels.

                   

                  Best Regards,

                  Apurva

                  • 6. Re: FLASH Part Cypress S29JL032J In-System Sector Protect Programming
                    MiSw_4385396

                    Thank you and hello again, Apurva.

                     

                    Attached is a simplified version of my sector protect source code which I am using with an emulator and the target circuit card (CCA), and a Word doc with a snapshot of the flash memory during the execution of the sector protect algorithm.


                    I am not having any luck getting the flash to protect or unprotect any sectors in-system. With focus on the sector protect side of Figure 2. In-System Sector Protect/Unprotect Algorithms flow diagram,  after I apply 12VDC to RESET# [RESET# = VID] and then perform the write cycle of 60h first [Sector Protect: Write 60h to sector address with A6 = 0, A1 = 1, A0 = 0], all of the flash memory immediately reflects 0x22f6 (attachment). Note that the base address for flash is 0x90000000.

                     

                    I then wait for 250us  [Wait 150 μs]  followed by a write cycle of 40h [Verify Sector Protect: Write 40h to sector address with A6 = 0, A1 = 1, A0 = 0], but then when I read the data in that sector [Read from sector address with A6 = 0, A1 = 1, A0 = 0] it is not 01h but still 22f6h.

                     

                    I re-attempt PLSCNT for 25 more times with no difference in this outcome (I have removed that loop from the attached source code for clarity).

                     

                    The function flashProtectAllSectors() calls flashProtectSector() for each sector of the flash device. I do program the flash device successfully in every other way without any issues. Does Cypress have any code or a in-system sector protect/unprotect software driver that I can examine and to compare my code implementation?


                    I downloaded the low level drivers Spansion_pNOR_LLD_15.3.1.zip file from Cypress only to find a comment block section “Following are sector protection driver routines“ at the end of the lo lld_S29JLxxxJ.c source file with no code following the section comment. I've attached that too.

                     

                    Warm regards,

                    Mike

                    • 7. Re: FLASH Part Cypress S29JL032J In-System Sector Protect Programming
                      ApurvaS_36

                      Hi Mike,

                       

                      Apologies for the delay. We were discussing your issue internally. We have found the following issues with the code -

                      1. At line#84, the TMP_ADRS should be calculated using sectAdrs8Bit and not using FLASH_START_ADDRESS. You may need to add FLASH_START_ADDRESS to get the physical sector address.
                      2. At line#90 and line#102, you should use the previously calculated address in (1) and not simply “sectAdrs8Bit
                      3. At line#107, in case you dont read 0x1 during verification, you should try the same procedure up to 25 times before giving up.
                      4. We were not able to understand the logic in calculating the sector addresses in lines 28 to 41. You should just double check that its doing the right calculation.

                       

                      The first two issues are major bugs and this is why sector protection is not working.

                       

                      Regards,

                      Apurva