Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing flash data with PSRAM XIP enabled causes MMAP flash read errors (IDFGH-14084) #14897

Open
3 tasks done
swilson opened this issue Nov 15, 2024 · 1 comment
Open
3 tasks done
Labels
Status: Opened Issue is new Type: Bug bugs in IDF

Comments

@swilson
Copy link

swilson commented Nov 15, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.3.1

Espressif SoC revision.

ESP32-S3 (QFN56) (revision v0.1)

Operating System used.

macOS

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

ESP32-S3-DevKitC-1 v1.0

Power Supply used.

USB

What is the expected behavior?

mmap flash reads should return correct data

What is the actual behavior?

mmap read returns garbage randomly. Turning off PSRAM XIP (CONFIG_SPIRAM_FETCH_INSTRUCTIONS & CONFIG_SPIRAM_RODATA) seems to avoid the issue. Perhaps because when PSRAM XIP is enabled (aka SPI_FLASH_CACHE_NO_DISABLE) the regular flash APIs use mutex locking, but the MMAP APIs disable the cache?

Steps to reproduce.

main.c.txt

Debug Logs.

I (1556) example: esp_partition_read deadbeefdeadbeefdeadbeefdeadbeef
I (1557) example: mmap read: ESP-IDF Partition Memory Map Example
I (1659) example: mmap read: ESP-IDF Partition Memory Map Example
I (1759) example: mmap read: ESP-IDF Partition Memory Map Example
I (1859) example: mmap read: ESP-IDF Partition Memory Map Example
I (1959) example: mmap read: ESP-IDF Partition Memory Map Example
I (2059) example: mmap read: ESP-IDF Partition Memory Map Example
I (2138) example: esp_partition_read deadbeefdeadbeefdeadbeefdeadbeef
I (2159) example: mmap read: �������������������������������������

More Information.

partitions_example.csv
sdkconfig.txt

@swilson swilson added the Type: Bug bugs in IDF label Nov 15, 2024
@swilson
Copy link
Author

swilson commented Nov 15, 2024

This bug was initially discovered when a call to esp_ota_set_boot_partition() (which uses MMAP flash reads) failed while another thread was writing to to a different partition.

@github-actions github-actions bot changed the title Writing flash data with PSRAM XIP enabled causes MMAP flash read errors Writing flash data with PSRAM XIP enabled causes MMAP flash read errors (IDFGH-14084) Nov 15, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

2 participants