sdcard: Compute CRC7 for all SPI commands.#1088
Open
kwagyeman wants to merge 2 commits intomicropython:masterfrom
Open
sdcard: Compute CRC7 for all SPI commands.#1088kwagyeman wants to merge 2 commits intomicropython:masterfrom
kwagyeman wants to merge 2 commits intomicropython:masterfrom
Conversation
Some SD cards (e.g. SDXC) have CRC checking permanently enabled in SPI mode. Sending commands with CRC=0x00 causes them to return ILLEGAL_COMMAND, making initialisation fail. Fix this by computing a valid CRC7 for every command. Signed-off-by: Kwabena W. Agyeman <kwagyeman@live.com>
Writes and reads 1 MB through the FAT filesystem and prints throughput in KB/s. Signed-off-by: Kwabena W. Agyeman <kwagyeman@live.com>
d1cb87a to
95f72a7
Compare
Author
|
@dpgeorge - This fix is needed to make the SD card work on the AE3 for the battery shield: https://openmv.io/collections/openmv-ae3-accessories/products/openmv-ae3-battery-shield?variant=42433436385374 |
Member
|
See #765, which does this and other improvements. I gave a lot of feedback on that PR and was waiting for it to be addressed, but it looks like that might never happen... |
Author
|
Oh... yeah, way to many changes in one commit in that PR. I tried to make sure this one just fixes what was causing problems. Nothing else to make it easy to review. If that PR is in limbo, then would appreciate this being considered instead. The only change that needed to be done was to add CRC7 support. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Some SD cards (e.g., SDXC) permanently enable CRC checking in SPI mode. Sending commands with CRC=0x00 causes them to return ILLEGAL_COMMAND, making initialisation fail. Fixed this by computing a valid CRC7 for every command. Most of my SD cards did not work with the SPI code. After adding CRC support all the cards worked.
Also added a performance test to the test script to benchmark things (using baudrate of 20MHz):