-
Notifications
You must be signed in to change notification settings - Fork 939
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
Flash operations overwrite PSRAM QMI configuration registers #1983
Comments
I suspect this is due to An alternative is to copy the code from |
Also, I would suggest to update the documentation for the |
Looks like CircuitPython also does the manual save-and-restore around their flash ops: I'll look into their cache clean code as well to see if it can help with my other PSRAM/flash cache invalidate issue on the RPI forums. |
It's actually the other way round: the default boot2 (XIP setup func) does not configure QMI window 1 (there was an expectation at some point that it might), but the bootrom configures both windows to safe defaults (slow I think it would be reasonable for the SDK to save/restore the QMI registers for window 1 over the ROM calls, but this is actually a problem if window 1 received an XIP exit sequence (enabled by |
The best-effort fix might be to save/restore That would avoid trashing people's registers if they are ignoring the ROM support for the second chip select, but avoid breaking the ROM's reinitialisation of the The ideal fix is still to (re-) initialise both QSPI devices in the XIP setup, but that's a more substantial piece of work to cover all of the possible cases and combinations. |
PSRAM not accessible by the core after a
flash_range_erase
orflash_range_program
.Inspection of the QMI interface before and after a call to these SDK functions shows that the 2nd memory region control register (PSRAM,
qmi_hw->m[1]
) have had their values modified, rendering the interface inoperative. If the original values are restored by the application manually, communication succeeds and PSRAM data is accessible.In the instance of the PSRAM on the Pimoroni PGA2350, we see the following behavior:
Before flash write
After flash_range_erase / flash_range_program
A more detailed description and test code (Arduino based, sorry, because PSRAM setup is not in the SDK yet) is being tracked in earlephilhower/arduino-pico#2537 .
As a workaround, by using GCC to wrap the flash functions and manually saving/restoring the registers, we're able to both access PSRAM and write to flash. I haven't gone through the RP2350 ROM code, but I would guess as part of the XIP restart after a flash command it is setting what it things are "safe" values to the QMI regions which is great for chip reset, but not so good for when things are already configured.
The text was updated successfully, but these errors were encountered: