Use SFDP Data to Set Timeout Timer Value for SPI NOR Flash Page Program and Erase Operations - KBA230621

Version 2

     

    Author: YongQ_16           Version: **

     

    Translation - Japanese:  SPI NOR Flashページプログラムおよび消去操作でタイムアウトタイマー値を設定するためにSFDPデータを使用 – KBA230621- Community Translated (JA)

     

    Question:

    What timeout timer value should I set for Page Program and Erase operations for Cypress’ SPI NOR Flash?

     

    Answer:

    You can set the timeout timer value using either of the following methods:

    1. Use the Page Program and Erase maximum time specification stated in the device datasheet
    2. Calculate the maximum Page Program and Erase time using Serial Flash Discoverable Parameter (SFDP) data

     

    All recent Cypress SPI NOR Flash products are SFDP compliant. The second option (using SFDP data) is the recommended approach because it makes the code portable while migrating to other SFDP compliant SPI NOR devices.

     

    This document explains how to calculate the maximum Page Program time and Erase time according to SFDP data, assuming you have basic SFDP knowledge and know how to access a specific SFDP DWORD in the flash device.

     

    Page Program time is defined in the Basic Flash Parameter DWORD-11:

    • DWORD-11 Bit[13] defines Page Program time unit (0=8us, 1=64us).
    • DWORD-11 Bit[12:8] defines Page Program typical time count.
    • DWORD-11 Bit[3:0] defines Multiplier from Page Program typical time to Page Program maximum time.

     

    Page Program typical time = (Page Program typical time count + 1) * Page Program time unit

    Page Program maximum time = 2 * (Multiplier + 1) * Page Program typical time

     

    For example:

    • DWORD-11 Bit[13] = 1 (time unit is 64us)
    • DWORD-11 Bit[12:8] = 00111b
    • DWORD-11Bit[3:0] = 0010b

     

    Page Program typical time = (00111b + 1) * 64us = 8 * 64us = 512us

    Page Program maximum time = 2 * (0010b + 1) * 512us = 2 * 3 * 512us = 3072us

     

    The timeout timer for Page Program should use the Page Program maximum time, that is, 3072 µs.

     

    A flash device may contain multiple size sectors. For example, a hybrid sector architecture flash contains 4-KB sectors and 256-KB sectors. Erase time for different size sectors vary.

     

    The SFDP standard defines up to four erase types. Each erase type defines a sector size. Erase types are defined in the Basic Flash Parameter DWORD-8 and DWORD-9:

    • DWORD-8 Bit[7:0] defines Erase Type 1 Size
    • DWORD-8 Bit[23:16] defines Erase Type 2 Size
    • DWORD-9 Bit[7:0] defines Erase Type 3 Size
    • DWORD-9 Bit[23:16] defines Erase Type 4 Size

     

    The value “N” of the above fields are used to calculate Erase Type size = 2^N bytes. For example, if the value of DWORD-8 Bit[7:0] is 0Ch, then Erase Type 1 size is 4KB; if the value of DWORD-8 Bit[23:16] is 12h, then Erase Type 2 size is 256KB. If the value of the field is 00h, then this Erase Type does not exist.

     

    Sector Erase time for all the four Erase Types are defined in Basic Flash Parameter DWORD-10:

    • DWORD-10 Bit[31:30] defines Erase Type 4 Sector Erase time unit (00b=1ms, 01b=16ms, 10b=128ms, 11b=1s).
    • DWORD-10 Bit[29:25] defines Erase Type 4 Sector Erase typical time count.
    • DWORD-10 Bit[24:23] defines Erase Type 3 Sector Erase time unit (00b=1ms, 01b=16ms, 10b=128ms, 11b=1s).
    • DWORD-10 Bit[22:18] defines Erase Type 3 Sector Erase typical time count.
    • DWORD-10 Bit[17:16] defines Erase Type 2 Sector Erase time unit (00b=1ms, 01b=16ms, 10b=128ms, 11b=1s).
    • DWORD-10 Bit[15:11] defines Erase Type 2 Sector Erase typical time count.
    • DWORD-10 Bit[10:9] defines Erase Type 1 Sector Erase time unit (00b=1ms, 01b=16ms, 10b=128ms, 11b=1s).
    • DWORD-10 Bit[8:4] defines Erase Type 1 Sector Erase typical time count.
    • DWORD-10 Bit[3:0] defines Multiplier from Erase typical time to Erase maximum time. This applies to all the 4 types Sector Erase and Chip Erase.

     

    Erase Type x Sector Erase typical time = (Erase Type x Sector Erase typical time count + 1) * Erase Type x Sector Erase time unit

    Erase Type x Sector Erase maximum time = 2 * (Multiplier + 1) * Erase Type x Sector Erase typical time

     

    The timeout timer for Erase Type x Sector Erase should use the Erase Type x Sector Erase maximum time.

     

    To calculate Sector Erase maximum time for a given sector size, you must first find out the Erase Type from Basic Flash Parameter DWORD-8 and DWORD-9 where all the four Erase Types are defined. Then find the time unit, typical time count, and Multiplier for the corresponding Erase Type from Basic Flash Parameter DWORD-10. Then calculate the Sector Erase maximum time using the fore-mentioned formulas.

     

    Chip Erase time is defined in Basic Flash Parameter DWORD-10 and DWORD-11:

    • DWORD-11 Bit[30:29] defines Chip Erase time unit (00b=16ms, 01b=256ms, 10b=4s, 11b=64s).
    • DWORD-11 Bit[28:24] defines Chip Erase typical time count.
    • DWORD-10 Bit[3:0] defines Multiplier from typical erase time to max erase time. This applies to all the four types of Sector Erase and Chip Erase.

     

    Chip Erase typical time = (Chip Erase typical time count + 1) * Chip Erase time unit

    Chip Erase maximum time = 2 * (Multiplier + 1) * Chip Erase typical time

     

    The timeout timer for Chip Erase should use the Chip Erase maximum time.

     

    Page Program and Erase operations normally complete earlier than the maximum time. Instead of using a maximum timeout timer, using a polling method for checking for operation completeness is more efficient. Timeout timer implementation can be combined with the polling method if necessary.

     

     

    References:

    • JEDEC Standard, JESD216D, August 2019