1
\$\begingroup\$

I am working on a project to read files off of SD cards with an xmega128a4u via SPI. I noticed that some cards initialize without an issue. However, I have two cards that just wont.

As far as I can tell, I am using the prescribed method of initialization for SPI communication:

  • Assert the CS line
  • Send at least 74 clock pulses (I's sending 80) at 100kHz to 400kHz (I'm at roughly 250kHz).
  • Deassert the CS line
  • Send CMD0 with 0x00000000 as the arg and 0x95 as the CRC
  • Wait for a 0x01 response (or something other than 0xFF).

I have 5 Micro SD cards: 2 x 2GB, 1 x 4GB, 1 x 16GB, and 1 x64GB. I am having issues with only the 2GB cards (they are the same brand). Both never return anything but 0xFF. Even if I retry multiple times or poll indefinitely for something other than 0xFF.

I have ensured that they are FAT formatted and do work in multiple other devices. I have also verified, via a scope and a logic analyzer, that the expected signals are being sent with the right timing.

So the question is why? Is there a possibility that these cards just will not work with SPI? Or maybe there's another slightly different process to try with some cards?

Any info would help. P.S., I'm not using FatFs (or Petit) because I need something event further stripped down a purposefully made, and I'm also trying to learn.

\$\endgroup\$
  • \$\begingroup\$ Could be 2GB are older tech and are power hungry compared to the others. \$\endgroup\$ – CrossRoads Jun 24 at 2:01
  • \$\begingroup\$ @CrossRoads, I can't discount that, for sure. I did get them off of amazon for cheep a few years ago. \$\endgroup\$ – Branden Boucher Jun 24 at 4:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.