cancel
Showing results for 
Search instead for 
Did you mean: 

Nor Flash

New Contributor

Hello,

We are using Hyper flash S26KS512SDPBHM020 with V3H SoC. We are trying to set some sectors to be protected but we are not able to unlock them.

Actually, after successfully execution of password unlock(Status register 0x80), Executing Write sequence resulting in Lock status Error.

Status register  : 0x92  device ready , which means (Device ready, Program error, Sector locked error).

Below is sequence followed:

  1. Read Ppb lock bit ( 0xFF)
  2. Set password sequence
  3. Read password sequence(Read password matches input password)
  4. Set ASPR register with password protection mode(permanent)
  5. Set PPB sector protection sequence
  6. Set ppb lock bit Sequence
  7. Check lockbit(0xFE)
  • Read status : 0x80
  • Erase sector sequence and status read (0xA2 : Device ready, Erase fail, Sector Lock error)
  • Clear register (0x80 : Device ready)
  • Write sector sequence and Status read (0x92 : device ready, Program Fail, Sector locked error)
  • Read status(x92) : Program error, Lock bit error.
0 Likes
Reply
1 Solution
Moderator
Moderator

Hi,

Thank you for your response.

In the points mentioned under "Now after reset", first point is "Unlock password sequence". Could you please elaborate a little on the steps? Please tell as to what are the exact commands being sent to the flash? Are you unlocking the PPB Lock bit, then erasing all the PPB bits to unprotect all the sectors?

I would like to inform you that merely unlocking the PPB Lock bit (setting PPB Lock bit to 1) does not ensure that the previously protected sectors are now unprotected. PPB Lock bit determines whether the PPB bits corresponding to each particular sector can be program/erased or not.

  • When the PPB Lock bit is set to 0, it means the PPB bits are locked and cannot be programmed or erased. Hence, whichever PPB bits are set to 0 shall remain 0 and the sectors corresponding to those PPB bits are protected. Similarly, all the PPB bits that were 1 will remain 1 and the sectors corresponding to those bits will remain unprotected.
  • When the PPB Lock bit is set to 1, it means the PPB bits are unlocked and can be either programmed to 0 individually (bit wise) or all of the PPB bits can be erased to 1. The sectors corresponding to these PPB bits behave accordingly (Sectors will be protected for PPB bit set to 0, and sectors will be unprotected for PPB bits set to 1).

i would request you to go through the following sections from the datasheet​ that will give you more idea about the above mentioned concept -

  • 6.3.2 Advanced Sector Protection (ASP)
  • 6.3.3 PPB Lock
  • 6.3.4 Persistent Protection Bits (PPB)

Please let me know if you have any confusion in any part.

Regards,

Apurva

View solution in original post

0 Likes
Reply
4 Replies
Moderator
Moderator

Hi,

Thank you for contacting Cypress Community.

I would like to inform you that -

  • When flash devices are shipped from Cypress, all PPB bits are erased, which means all sectors are unprotected. You can perform program/erase operations to all sectors. (Last line on page 54 of datasheet.)
  • If you choose to program some of the PPB bits to 0, this means the corresponding sectors to these bits are now protected. Flash will throw an error if you try to program/erase that particular sector.

From the command sequence provided by you, I can understand that some of the PPB bits have been programmed (point number 5. Set PPB sector protection sequence). Please correct me if I am wrong. If you are programming some of the PPB bits to 0 and then performing program/erase operation on the sectors corresponding to these bits, then the error received is a normal flash behavior. If you don't wish to protect any of the sectors, you should erase all PPB bits to 0xFF.

Please let me know if you have more questions.

Regards,

Apurva

New Contributor

Thanks for your replay. Actually, I did not describe the sequence correctly, as I did not detailled the unlock password sequence.

Below is sequence followed:

  1. Read Ppb lock bit ( 0xFF)
  2. Set password sequence
  3. Read password sequence(Read pass is matching input password)
  4. Set Aspr register with password protection mode(permanent)
  5. Set PPB sector protection sequence
  6. Set ppb lock bit Sequence
  7. Check lockbit(0xFE)
  • Read status : 0x80
  • Erase sector sequence and status read (0xA2 : Device ready, Erase fail, Sector Lock error)
  • Clear register (0x80 : Device ready)
  • Write sector sequence and Status read (0x92 : device ready, Program Fail, Sector locked error)
  • Read status(x92) : Program error, Lock bit error.

To that point, behaviour is as expected and what you described is totally fine.

Now after reset:

  1. Unlock password sequence
  2. Read status : 0x80
  3. Erase sector sequence and status read (0xA2 : Device ready, Erase fail, Sector Lock error)
  4. Clear register (0x80 : Device ready)
  5. Write sector sequence and Status read (0x92 : device ready, Program Fail, Sector locked error)
  6. Read status(x92) : Program error, Lock bit error.

So even after a succesful password unlock sequence, the sector is still protected and Status register reports an error.

On the datasheet:

"In the Password Protection Mode, the PPB Lock Bit is cleared to 0 during POR or a Hardware Reset. The PPB Lock Bit can only set

to 1 by the Password Unlock command sequence. The PPB Lock Bit can be cleared back to 0 with the PPB Lock Bit Clear

sequence."

So setting PPB lock to 1 should occur automatically once Password Unlock sequence suceeded. and this is what is not happening in our case.

0 Likes
Reply
Moderator
Moderator

Hi,

Thank you for your response.

In the points mentioned under "Now after reset", first point is "Unlock password sequence". Could you please elaborate a little on the steps? Please tell as to what are the exact commands being sent to the flash? Are you unlocking the PPB Lock bit, then erasing all the PPB bits to unprotect all the sectors?

I would like to inform you that merely unlocking the PPB Lock bit (setting PPB Lock bit to 1) does not ensure that the previously protected sectors are now unprotected. PPB Lock bit determines whether the PPB bits corresponding to each particular sector can be program/erased or not.

  • When the PPB Lock bit is set to 0, it means the PPB bits are locked and cannot be programmed or erased. Hence, whichever PPB bits are set to 0 shall remain 0 and the sectors corresponding to those PPB bits are protected. Similarly, all the PPB bits that were 1 will remain 1 and the sectors corresponding to those bits will remain unprotected.
  • When the PPB Lock bit is set to 1, it means the PPB bits are unlocked and can be either programmed to 0 individually (bit wise) or all of the PPB bits can be erased to 1. The sectors corresponding to these PPB bits behave accordingly (Sectors will be protected for PPB bit set to 0, and sectors will be unprotected for PPB bits set to 1).

i would request you to go through the following sections from the datasheet​ that will give you more idea about the above mentioned concept -

  • 6.3.2 Advanced Sector Protection (ASP)
  • 6.3.3 PPB Lock
  • 6.3.4 Persistent Protection Bits (PPB)

Please let me know if you have any confusion in any part.

Regards,

Apurva

View solution in original post

0 Likes
Reply
New Contributor

Dear Apurva,

I was able to resolve the issue. And your comment is correct as I was not unprotecting each secto individualy thinking it was done automatically once PPR Lock Bit is set to 1.

Thanks

Rachid

0 Likes
Reply