Skip to content

Example of how to generate CRC7 byte for SD cards in SPI mode

Notifications You must be signed in to change notification settings

hazelnusse/crc7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

When communicating to SD cards in SPI mode, a 6-byte command frame is used. The first byte is the command index. Bytes two through five are the argument. The last byte is a CRC byte that is calculated from the first five bytes. The CRC polynomial used in SD cards is:

G(x) = x^7 + x^3 + x^0

The result of CRC calculation goes in the upper 7 bits of the CRC byte. The 0 bit of is set high.

This code shows what the CRC7 bytes are for a few common SD commands.

You will need a gcc 4.7 or newer in order to build this with the current Makefile, although it should be straightforward to modify to work with earlier compilers or even with a C compiler.

About

Example of how to generate CRC7 byte for SD cards in SPI mode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages