AnsweredAssumed Answered

Cube STM32F411RE Demo - SPI CRC Calculation?

Question asked by ro.dru on Nov 4, 2015
Latest reply on Nov 4, 2015 by Clive One
Started using the Cube/HAL libraries and working with the F411RE demonstration with the Adafruit 1.8" TFT shield.  It has a SD card slot on it and uses it to load images onto the display.  Not sure if ST doesn't realize that it is 2015 and finding SD cards (vs SDHC SDXC) is nearly impossible.  So of course all of my cards are actually SDHC which do not work with the included libs.  So saying that the Cube libs are the newest and greatest is a bit of a stretch here.

Anyways while going through the code I see the command CMD1 which is 0x40 0x00 0x00 0x00 0x00 and it sends the CRC value of 0x95

I have used every online calculator that I can find and I get 0xC8 for the CRC of the 5 command bytes.

How is 0x95 arrived at?  I have searched for SPI CRC and I cannot find anything that would shed any light on this.  I can go through the descriptions for CRC calculations and calculate it but 0x95 is never the value that comes out.

How the heck does this work?

And since the included SD/FAT library blows is there any library out there that can work with SD/SDHC/SDXC FAT/FAT16/FAT32?  I found a couple of home brewed ones but they have not been updated in quite awhile.