8

I have a 32 GB Kingston SDHC microSD card which has to communicate to MSP430F2618 via SPI. I was not able to initialize it by using CMD55 + ACMD41 (with bit30 set to 1), as it is described in SD specification paper. What works is this sequence:

  CMD0, arg: 0         , CRC: 0x95 (response:0x01)
  CMD8, arg: 0x1AA     , CRC: 0x87 (response:0x01)
  CMD1, arg: 0x40000000, CRC: 0xFF (response:0x00)

I tried it also with a 8 GB SanDisk card and works for that too. So actually, I am using CMD1 here, not ACMD41, with HCS bit set to 1. However, it is not stable, sometimes it works, sometimes it does not. This may be about hardware.

Is it not strange that cards are responding to CMD1 with argument 0x40000000?

4

1 回答 1

10

你不应该用它CMD1来初始化 SDHC 卡;如 SD 卡规范中所述:

在任何情况下都不建议使用 CMD1,因为主机可能难以区分 MultiMediaCard 和 SD 存储卡。

如果您向它们发出一些控制器(主要是更新和更高容量的卡),它们只会停留在空闲状态CMD1CMD8 0x1AA您应该在重置后首先发出( CMD0),然后使用CMD55 + ACMD41.

tl;博士初始化卡你应该:

  1. CMD0arg:0x0,CRC:(0x95响应0x01:)

  2. CMD8arg:0x000001AA,CRC:(0x87响应0x01:)

  3. CMD55arg: 0x0, CRC: any (作为everyCMD55的前缀) ACMD

  4. ACMD41, arg: 0x40000000, CRC: 任何

  5. 如果响应:0x0,你没事;如果是0x1,请转到 3。

请注意,大多数卡片需要重复步骤 3/4,通常是一次,即实际顺序是CMD0/ CMD8/ CMD55/ ACMD41/ CMD55/ ACMD41- 可以肯定的是,尝试n多次(n根据您的理由选择),如果没有,则假设失败。

另外,请注意,您应该至少在前后断言 S̲S̲(又名 CS)为低-实际上CMD0,可能总是在向 SD 卡发送任何命令时。

于 2014-01-15T09:16:44.783 回答