Hi Team,
In our project we are using the SPI based NOR flash chip as a slave, whose ordering part number is S25FL256SAGMFI000.
As per the datasheet, we can see that there is dynamic sector protection schemes available for each sector(independent to the size of sector). To implement this scheme, we would like to understand the flow to make this protection scheme enable. I am slightly confuse what the DYBAR returns, is it the sector number associated with the protection which it returns or anything else? and if it is the sector number then why only 8-bits are allotted to it; in fact the sector numbers are more considering the 32 4Kb and 510 64Kb sectors.
We are stuck and unable to achieve our ultimate goal which is to -> write some data to the desired sector(4kb or 64kb or both) and then enables the protection for it (in the boot software), so that later though application wanted to modify that sector it will not allow. and then once the protection is enabled how to read the data from that protected sector?
Request you to please suggest some inputs which we have to implement to achieve this protection schemes.
Regards,
Shivam Kakad
Solved! Go to Solution.
Hi Shivam,
Every sector in the main flash array has a volatile dynamic protection bit (DYB) associated with it. When the bit is 0, the sector is protected from program and erase operations. When the bit is 1, the sector is in unprotected state. Even though it is called the dynamic protection 'bit', however, this bit is written to/read from the flash in the form of a one byte data, and DYBAR is the Dynamic Protection Bit Access Register which holds this one byte of data.
Therefore, if the value of DYB Access Register associated with a particular sector is 0x00 it means that the particular register is protected from program and erase operations. And, when the value of DYB Access Register associated with a particular sector is 0xFF then it means that the particular sector is not protected against program or erase operations.
The value of the DYB Access Register associated with any particular register can be read using the DYB Read (0xE0) command.
The DYB Write (0xE1) command can be used to write the desired value to the DYB Access Register.
Please note that this is just a volatile protection scheme.
The process of reading data from a sector always remains same, irrespective of whether it is protected or unprotected. The protection scheme only protects the sector against program and erase. The method used for reading shall remain same.
Let us know if you have more questions.
Thank you and Regards.
Hi Shivam,
Every sector in the main flash array has a volatile dynamic protection bit (DYB) associated with it. When the bit is 0, the sector is protected from program and erase operations. When the bit is 1, the sector is in unprotected state. Even though it is called the dynamic protection 'bit', however, this bit is written to/read from the flash in the form of a one byte data, and DYBAR is the Dynamic Protection Bit Access Register which holds this one byte of data.
Therefore, if the value of DYB Access Register associated with a particular sector is 0x00 it means that the particular register is protected from program and erase operations. And, when the value of DYB Access Register associated with a particular sector is 0xFF then it means that the particular sector is not protected against program or erase operations.
The value of the DYB Access Register associated with any particular register can be read using the DYB Read (0xE0) command.
The DYB Write (0xE1) command can be used to write the desired value to the DYB Access Register.
Please note that this is just a volatile protection scheme.
The process of reading data from a sector always remains same, irrespective of whether it is protected or unprotected. The protection scheme only protects the sector against program and erase. The method used for reading shall remain same.
Let us know if you have more questions.
Thank you and Regards.
Appreciate the quick response, this information actually helped us to understand the protection scheme in better way.
Further I need suggestion on its execution, considering our project requirements.
As per the requirement,
1. write the data to the sector
2. enables the protection such that data will not get altered(either by programming or erasing).
So, as per my understanding i have to perform the following:
1. Select the required sector for the protection among all the available sectors (selected sector size could be 4KB or 64KB).
2. Issue the WREN command
3. pull the chip select low
4. Program required number of pages with the desired data in the selected sector with 4PP command.
5. after programming the necessary data, issue the DYBWR command followed by the 32-bit address and then 1 data byte as 00; where, the address could be anything but from the selected sector for which the protection has to be enable.
6. pull chip select to high
7. Issue the WRDI command
Is this the correct sequence to follow, to achieve the requirement correctly?
Regards,
Shivam Kakad
Hi Shivam,
The correct sequence of commands is -
Thank you and Regards.