# SPI Flash API ESP-IDF Version vs Chip-ROM Version

[中文]

There is a set of SPI flash drivers in Chip-ROM which you can use by enabling CONFIG_SPI_FLASH_ROM_IMPL. Most of the ESP-IDF SPI flash driver code are in internal RAM, therefore enabling this option frees some internal RAM usage. Note that if you enable this option, this means some SPI flash driver features and bugfixes that are done in ESP-IDF might not be included in the Chip-ROM version.

## Feature Supported by ESP-IDF but Not in Chip-ROM

- Octal flash chip support. See OPI Flash Support for details.

- 32-bit-address support on flash chips. Note that this feature is an optional feature, please do read 32-bit Address Support of QSPI Flash Chips for details.

- TH flash chip support.

- Kconfig option CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED.

- CONFIG_SPI_FLASH_VERIFY_WRITE, enabling this option helps you detect bad writing.

- CONFIG_SPI_FLASH_LOG_FAILED_WRITE, enabling this option prints the bad writing.

- CONFIG_SPI_FLASH_WARN_SETTING_ZERO_TO_ONE, enabling this option checks if you are writing zero to one.

- CONFIG_SPI_FLASH_DANGEROUS_WRITE, enabling this option checks for flash programming to certain protected regions like bootloader, partition table or application itself.

- CONFIG_SPI_FLASH_ENABLE_COUNTERS, enabling this option to collect performance data for ESP-IDF SPI flash driver APIs.

- CONFIG_SPI_FLASH_AUTO_SUSPEND, enabling this option to automatically suspend or resume a long flash operation when short flash operation happens. Note that this feature is an optional feature, please do read Auto Suspend & Resume for more limitations.

- CONFIG_ESP_SLEEP_SET_FLASH_DPD, enabling this option allows the flash to enter deep power-down (DPD) mode during sleep for lower power consumption. Note that this feature is an optional feature, please do read SPI Flash Deep Power-Down Mode for more limitations.

- CONFIG_SPIRAM_XIP_FROM_PSRAM, enabling this option allows you to use external PSRAM as instruction cache and read-only data cache. Some functions in the ROM don't support this usage, and an ESP-IDF version of these functions is provided.

## Bugfixes Introduced in ESP-IDF but Not in Chip-ROM

- Detected flash physical size correctly, for larger than 256 MBit flash chips. (Commit ID: b4964279d44f73cce7cfd5cf684567fbdfd6fd9e)

- Fixed issue that address range may escape from checking for erasing and writing function when their sum overflows 32-bit boundary.

Was this page helpful?

- Thank you! We received your feedback.
- If you have any comments, fill in Espressif Documentation Feedback Form.

- We value your feedback.
- Let us know how we can improve this page by filling in Espressif Documentation Feedback Form.