Improve CSD parsing#222
Conversation
9ea263f to
99810cb
Compare
|
Oh, this repo uses separate |
|
develop holds the working branch, main holds the releases. A release involves a merge from develop to main. |
thejpster
left a comment
There was a problem hiding this comment.
Looks OK - just some nits to tidy up.
What is CsdV3 for? I don't see it used?
|
I think I had a UC card in my zynq7000 card slot. right now I am working with the ARM9 system, but ill probably just put the SD card from the zynq7000 into that one. Did not come much farther than parsing the CDS so far. |
|
just want to test this again on the new system, then I will undraft :) |
|
Finally managed to read a CSDv2 from an SD card. I updated/tweaked the CRC7 checksum handling. |
|
Oh, one more thing I want to do: I'll add the CSDv2 block retrieved as a new test :) |
47217c5 to
89f2ad6
Compare
|
Okay, just another last thing to make the feature creep stop: I added a CSD constructor, which determines the CSD structure type, constructs it, and also verifies the checksum. |
4d842eb
|
@robamu Since this PR sdmmc has troubles finding any sd card. If I go back to one commit before this PR was merged everything works fine. Did this work for you on real hardware? |
|
Yes, this worked for me on real hardware with a dedicated SD peripheral. I was not using the Spi mode. Unfortunately i do not have the hardware to test with spi mode yet. Can you pinpoint where it goes wrong / is the code open-source? |
|
I think the it is because you changed the crc7 algorithm. Now it gets the wrong value here and the commands are not accepted by the cart embedded-sdmmc-rs/src/sdcard/mod.rs Line 501 in 4d842eb |
|
A shift might be missing. I think the very last bit is 1 and the crc7 is left shifted by 1 but i would have to check the spec again. |
|
I just reverted this one line back to the original |
|
#237 fixes it for me |
|
nice. hope this did not take too long to find. I should have looked for usages of the CRC7 function.. |
Fix SPI communication after #222 broke it
|
no worries. It cost me few hours today, but it was pretty clear soon that the problem is the lib itself and not my hardware. The rest was only that I did want to find the problem itself and it helped me understand the lib better. Maybe we could add some tests to the spi communication so this can't happen again? |
|
Some unittests most certainly sound good to prevent this in the future. Should be possiible by adding a SPI interface mock |
Use
bitbybitwhich is a good fit here. Also Add V3