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,
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.
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.
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)?
Thank you for your reply.
Yes, your understanding of Table 1 is correct. You need to force these lines to the indicated levels.
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.
Apologies for the delay. We were discussing your issue internally. We have found the following issues with the code -
- 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.
- At line#90 and line#102, you should use the previously calculated address in (1) and not simply “sectAdrs8Bit”
- At line#107, in case you don’t read 0x1 during verification, you should try the same procedure up to 25 times before giving up.
- We were not able to understand the logic in calculating the sector addresses in lines 28 to 41. You should just double check that it’s doing the right calculation.
The first two issues are major bugs and this is why sector protection is not working.