External Quad-Flash Erase and Write on CY8CKIT-062-BLE through PSoC® 6 SMIF – KBA224071
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Version: **
Translation - Japanese: PSoCR 6 SMIF を使用して CY8CKIT-062-BLE 上の外部 Quad-Flash の消去と書込みを行う - KBA224071 - Community Translated (JA...
Question:
External flash in the S25FL512SAGMFI011 device can be read or written through the PSoC® 6 SMIF interface. How can I correctly erase and write to make full use of its storage capacity?
Answer:
Each flash sector of S25FL512SAGMFI011 must be erased before writing to it. However, because the range size of the sector erased and written each time are different, the previously written data may be erased unexpectedly. The user needs be aware of the following erase/write mechanism for S25FL512SAGMFI011:
- extMemAddress
This data array contains address bytes for external flash. For S25FL512SAGMFI011, it contains 3 bytes. extMemAddress[0] is the A23:A16 bits of the address. - sector erase
The sector erase command erases 256 KB of sector every time it executes, which is defined in the S25FL512SAGMFI011 spec. As each sector is 256 (2*16KB aligned), the address 0xFC0000 is masked for a 24-bit address. This means it ignores bits A17:A0 of the sector address when a sector erase command is asserted.
Since the current sector is erased before each ‘write’ time, A17:A16 of extMemAddress[0] is ignored for each sector erase command. Each time the extMemAddress[0]++ 64-kB data is skipped, the current sector does not change within four successive increments. It moves to the next sector only when the fourth increment completes; that is, it keeps erasing data written in the previous 3 writes. Only the fourth write is retained as the next erase moves to the next sector.
The user needs to perform the sector erase accordingly. In the code, you just need to erase the sector only before the first time out of four successive fourth writes.