You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks for the RP2350 PSRAM code which we borrowed for arduino-pico! It made things much easier to get PSRAM .heap and .data running for us when the Pico2 came out!
We recently ran into an issue where flash writes caused data loss in PSRAM. Basically the same two issues you discovered and worked around, we had the pleasure of discovering and working around on our own. We added the QMI register save/restore and the XIP cache clean process around flash operations and ended up with essentially your code, too.
However, under very dirty cache cleans the processor can repeatably end up crashing during the cleaning process. The debug is in the RPI Forum thread here.
Essentially, it seems that the XIP cache really need to be both cleaned and invalidated line-by-line before the flash operations. This would add another write in your cache clear loop,
for (int i = 1; i < 16 * 1024; i += 8) {
maintenance_ptr[i] = 0; // Clean (write back)
maintenance_ptr[i - 1] = 0; // Invalidate
}
If you do find users with random crashes under PSRAM and flash write workloads, this change might help avoid a lot of head scratching and hair pulling.
Thanks again for the great work!
The text was updated successfully, but these errors were encountered:
earlephilhower
changed the title
Update PSRAM cache flush to avoid possible crash under high write workloads
Update RP2350 PSRAM cache flush to avoid possible crash under high write workloads
Oct 23, 2024
First of all, thanks for the RP2350 PSRAM code which we borrowed for arduino-pico! It made things much easier to get PSRAM
.heap
and.data
running for us when the Pico2 came out!We recently ran into an issue where flash writes caused data loss in PSRAM. Basically the same two issues you discovered and worked around, we had the pleasure of discovering and working around on our own. We added the QMI register save/restore and the XIP cache clean process around flash operations and ended up with essentially your code, too.
However, under very dirty cache cleans the processor can repeatably end up crashing during the cleaning process. The debug is in the RPI Forum thread here.
Essentially, it seems that the XIP cache really need to be both cleaned and invalidated line-by-line before the flash operations. This would add another write in your cache clear loop,
circuitpython/ports/raspberrypi/supervisor/internal_flash.c
Lines 53 to 55 in 45e0cf1
becomes
If you do find users with random crashes under PSRAM and flash write workloads, this change might help avoid a lot of head scratching and hair pulling.
Thanks again for the great work!
The text was updated successfully, but these errors were encountered: