A few days ago I posed a question from a reader who was having problems understanding CRC-7 for the SD Card. Well, another reader came through magnificently as follows:
Hi Max, I searched Yahoo for
"crc-7 SD" and found a couple of interesting links to application notes on the MAXIM website:
I used the explanation in the 3969. The 4068 seems to be a copy of 3969. I would assume some standards group would have a document describing the info, but I didn't find one in the search. I wrote a small code sample in C and generated a DOS/Windows *.exe file to test it.
The *.exe, when run, produced the following output, which I captured into a stdout: file, which I've pasted below to show that the code works:
CRC remainder of 0x40 for 0x40 input byte.
CRC remainder of 0x41 for 0x00 input byte.
CRC remainder of 0x53 for 0x00 input byte.
CRC remainder of 0x45 for 0x00 input byte.
CRC remainder of 0x1B for 0x00 input byte.
CRC remainder after augment is 0x4A with FINAL CRC byte of 0x95.
I've tested this for the sample given by the student; I don't have any other test cases to check it with. You are welcome to post this, edit it, forward it, whatever.
PS I just found this file on the web:
This is a specification from the SD Card organization (www.sdcard.org is their home page). It didn't take any registration or money to obtain this 129-page document, which seems to contain all you'd ever want to know.
Furthermore, this reader also kindly sent me the original C source code and the corresponding *.exe
file, which he's allowed me to make available in this crc7expl.zip
compressed (ZIP) file.
Wow! Now that's what I call service!
Questions? Comments? Feel free to email me – Clive "Max" Maxfield – at firstname.lastname@example.org). And, of course, if you haven't already done so, don't forget to Sign Up for our weekly Programmable Logic DesignLine Newsletter.