QSPI Stability Improvements #670
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses an intermittent issue that can occur causing the QSPI Flash chip to get stuck in write-protect mode.
This issue has been most commonly identified by the following behavior:
Solution
With this update to the QSPI Initialization, the Daisy will automatically recover from this issue, and prevent it from causing further problems after initializaiton.
The QSPI is now initialized with fewer pins while manually disabling the write-protect via pin-state during single-SPI initialization, and clearing the SWRD bit if it is set. Once this bit has been cleared, the QSPI is then re-initialized in 4-bit mode.
Testing and Validation
These changes were tested thoroughly by numerous individuals via the dsy_bootloader_v6_2-dev5.bin patched bootloader would auto-recover, and revive any daisies affected by the above issues.
That version of the bootloader was built on an older version of libDaisy, but syncing these changes with the latest libDaisy only involved migrating the changes to the newer
Pinstruct, and I have retested with a file that manually sets the SRWD bit to verify the fix on the latest version.To validate this change one can test the following sequence:
Blink_set_srwd.binfile -- the problem can immediately be noticed by the 5s startup time before the program starts blinking.QspiReadAndWriteexample (bin file also included in the attached zip)Once connected, this program will erase, write, and validate the first 4kB of the QSPI memory, and print out success messages.
If this example is built on previous versions of libDaisy, the program will take additional time to start up, and will stall indefinitely when attempting to erase the QSPI.
Warning: If any other programs are flashed after step 1 before step 3, the problems described above will occur on the Daisy. The Daisy is not bricked, and flashing any binary compiled with this branch of libDaisy will recover from those issues.
qspi-test-bins.zip