Page 1 of 1

Get SPI flash unique ID

Posted: Thu Aug 19, 2021 4:25 am
by redpanda
Is there any code example that is able to read SPI flash unique ID?

Trying out ESP-IDF example https://github.com/espressif/esp-idf/bl ... ple_main.c but it said

Code: Select all

E (450) example: Failed to initialize external Flash: ESP_ERR_INVALID_RESPONSE (0x108)
I tested the code on ESP32-WROVER module with 4MB SPI flash.

In the sample code, esp_flash_read_id() is the API to get the flash ID but how can I get the esp_flash_t* ext_flash of the ESP32 module default SPI flash? Any recommendation?

Re: Get SPI flash unique ID

Posted: Thu Aug 19, 2021 6:10 am
by Victoria Nope
redpanda wrote:
Thu Aug 19, 2021 4:25 am
In the sample code, esp_flash_read_id() is the API to get the flash ID but how can I get the esp_flash_t* ext_flash of the ESP32 module default SPI flash? Any recommendation?

Pass NULL to the chip parameter of the esp_flash_read_id function call. That will read ID of the default flash chip. Just when mentioning unique ID, maybe you are rather interested in the esp_flash_read_unique_chip_id function.