SD card CRC trouble
I'm having a bit of trouble understanding how to do CRC for a SD Card. It appears that Maxim has two different APP notes on how to do the same thing and each one shows two different ways to do the same thing...which i would think to be incorrect. One app note says to augment with 6 zeroes and another says to augment with 7 zeros. In the app note for the MAXQ2000, the XOR result even appears to be wrong.
www.maxim-ic.com/appnotes.cfm/an_pk/3969
www.maxim-ic.com/appnotes.cfm/an_pk/4068
The app note for the TINI system appears to have the correct XOR result but how do they get to the final checksum?! they say to shift in zeroes into the register and then you can read the checksum..but if you do that, the checksum will be all zeroes!! I don't see how they go from the result of the XOR to the value that they say is to be the checksum.
i've googled and looked and it still isn't clicking. If someone could give a simpler response i would greatly appreciate it!!!
Thanks
www.maxim-ic.com/appnotes.cfm/an_pk/3969
www.maxim-ic.com/appnotes.cfm/an_pk/4068
The app note for the TINI system appears to have the correct XOR result but how do they get to the final checksum?! they say to shift in zeroes into the register and then you can read the checksum..but if you do that, the checksum will be all zeroes!! I don't see how they go from the result of the XOR to the value that they say is to be the checksum.
i've googled and looked and it still isn't clicking. If someone could give a simpler response i would greatly appreciate it!!!
Thanks
Comments
I can't help with actually doing the CRC. I've always just used the fact that the initialization into SPI mode can use a precalculated CRC, after which CRCs are not needed.
I've also tried to find exact instructions on doing the SD CRC but have not had success. There are some partial and casual explanations out there, but I've never found one complete enough to take a CRC newby all the way from the initial bits to the expected final result.
For details on calculating a CRC, look at the Wikipedia article on the subject and its links.
If you try to make CRC's work for the SD card code note that it will kill preformance due to the sheer number of calculations that need to be preformed per second.
Thanks,