-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Stale reads from mapped addresses after spi_flash_write() (IDFGH-275) #2146
Comments
FYI: I previously asked about this on the ESP32.com forum. |
@snej I'm not sure whether my current issue is what you described but this is the closest I have seen. I have enabled flash encryption along with NVS encryption. I can write data to my nvs partition and read it using: esp_partition_write() and esp_partition_read(), respectively. This works. The issue becomes apparent when I call: esp_partition_read() The first read returns non-human readable data, not what I am expecting (I suspect these are encrypted). I also tried to search for the Cache_Flush() calls you mentioned. but could not find it anywhere. I am usig the latest version of the SDK v3.00 as of writing this. Any help on this would be much appreciated. Thanks. |
@marienifura: I found the Cache_Flush() calls in the |
@snej Thanks. I managed to find it but unfortunately it doesn't seem to have helped in my case. |
@iggr / @projectgus Could we get this over to the 3.3 branch too, pretty please? |
@jmattsson Can do. GitHub issue will be updated when the backport commit lands. |
On flash program operation (either erase or write), if corresponding address has cache mapping present then cache is explicitly flushed (for both pro and app cpu) Closes #2146
Environment
Problem Description
When SPI flash has been mapped into address space via
spi_flash_mmap
, then after callingspi_flash_write
the corresponding mapped addresses sometimes read as stale (erased, 0xFF) data.The only reliable workaround I've found is to call the following after the write:
Expected Behavior
Bytes read from memory correspond to the newly-written data.
Actual Behavior
About 5% of the time, the bytes read from memory are still uninitialized (0xFF). This often persists even if a delay is added in between the write and the read.
Steps to repropduce
esp_partition_mmap
esp_partition_write
to write data into the mapped area of flashCode to reproduce this issue
The text was updated successfully, but these errors were encountered: