Initialisation de la carte SD à l'ips questions

J'ai eu un coup d'oeil à Débordement de Pile question Initialisation d'une carte microSD à l'aide d'une interface SPI et n'ai pas vu toutes les réponses qui correspondait à mes question (qui est, choses que je n'ai pas encore essayé).

J'ai un problème similaire lorsque j'essaye d'accéder à une carte SD grâce à un microcontrôleur de l'interface SPI (en particulier un HC908). J'ai essayé de suivre les diagrammes de flux dans la Couche Physique Simplifié de la Spécification v2.00 et il semble à initialiser correctement sur Transcender 1GO & 2GO et un AE&C 1GO carte. Mais je vais avoir des problèmes sur les trois autres cartes au hasard de ma cachette de vieilles cartes que j'ai utilisé sur mon appareil photo.

Mon code est tous les HC908 assembleur. J'ai exploré le SPI de l'horloge de la ligne et lors de l'initialisation, il est d'environ 350kHz (le seul multiplicateur de vitesse que les HC908 de fournitures à bas de mon MCU vitesse d'horloge qui tombe dans l'100 - 400kHz fenêtre).

Voici les résultats des trois cartes qui ne sont pas à compléter ma routine d'initialisation (le tout fait consécutivement sans changer le code ou les paramètres de synchronisation):

Canon 16Meg card (labeled as SD):
Set card select high
Send 80 SPI clock cycles (done by writing 0xFF 10 times)
Set card select low
Send CMD0 [0x400000000095] and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x01 (indicates idle)
Send CMD8 [0x48000001AA87] and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x05 (idle and illegal command)
Because illegal command set local flag to indicate v1 or MMC card
Send CMD58 [0x7A00000000FD] and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x05 (idle and illegal command)
because illegal command branch to error routine
Send CMD13 [0x4D000000000D] (show status buffer) and Loop up to 8 times waiting for high bit on response to go low
R1= 0x05 (idle and illegal command)

Est la commande illégale drapeau coincé? Devrais-je faire quelque chose après CMD8 pour effacer le drapeau?

SanDisk UltraII 256Meg
Set card select high
Send 80 SPI clock cycles (done by writing 0xFF 10 times)
Set card select low
Send CMD0 [0x400000000095] and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x01 (idle)
Send CMD8 [0x48000001AA87] and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x05 (idle and illegal command)
Because illegal command set local flag to indicate v1 or MMC card
Send CMD58 [0x7A00000000FD] and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x01 (idle)
Send 0xFF 4 times to read OCR
OCR = 0xFFFFFFFF
Send CMD55 [0x770000000065] (1st part of ACMD41) and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x01 (idle)
Send CMD41 [0x6900000000E5] (2nd part of ACMD41) and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x05 (idle and illegal command)
Because illegal command, assume card is MMC
Send CMD1 [0x4100000000F9] (for MMC) and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x05 (idle and illegal command)
Repeat the CMD1 50 times (my arbitrary number to wait until idle clears)
Every R1 response is 0x05 (idle and illegal command)

Pourquoi est-OCR toutes les F? Ne semble pas bon du tout. Aussi, pourquoi ne ACMD41 et CMD1 répondre illégal de commande? Est CMD1 à défaut parce que la carte est en attente de la validité de l'ACMD après la CMD55 même avec la commande illégale réponse?

SanDisk ExtremeIII 2G:
Set card select high
Send 80 SPI clock cycles (done by writing 0xFF 10 times)
Set card select low
Send CMD0 [0x400000000095] and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x01 (idle)
Send CMD8 [0x40000001AA87] and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x7F (??? My loop shows the responses for each iteration and I got 0xFF 0xFF 0xC1 0x7F... is the card getting out of sync?)
Send CMD58 [0x7A00000000FD] and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x01 (idle and back in sync)
Send 0xFF 4 times to read OCR
OCR = 0x00FF80
Send CMD55 [0x770000000065] (1st part of ACMD41) and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x5F (??? loop responses are 0xFF 0xFF 0xF0 0x5F... again out of sync?)
Send CMD41 [0x6900000000E5] (2nd part of ACMD41) and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x05 (idle and illegal command, but back in sync???)
Because illegal command, assume card is MMC
Send CMD1 [0x4100000000F9] (for MMC) and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x7F (??? loop responses are 0xFF 0xFF 0xC1 0x7F... again out of sync?)
Repeat CMD1 and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x01 (idle)
Repeat CMD1 and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x7F (??? loop responses are 0xFF 0xFF 0xC1 0x7F... again out of sync?)
Repeat CMD1 and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x00 (out of idle)
Send CMD9 [0x4900000000AF] (get CSD) and Loop up to 8 times waiting for high bit on response to go low
R1 = 0x3F (??? loop responses are 0xFF 0xFF 0xC1 0x3F... again out of sync?)
Code craps out because Illegal command bit is high.

Ce qui sur Terre est le problème avec cette carte?

Parfois, il est dans la synchro, d'autres fois non. (Ci-dessus motif de est reproductible.) J'ai l'étendue de ça et je ne vois pas de toute voyous cycles d'horloge en passant par entre MOSI/MISO transferts.

J'ai oublié de mentionner. Après ces tentatives infructueuses pour initialiser les 3 cartes, je les ai mis dans mon ordinateur portable est un lecteur de carte SD, et je pouvais encore y avoir accès comme les cartes SD standard (lecture et écriture) w/o question.
Trouvé un bug dans votre liste de commandes pour "SanDisk ExtremeIII": Send CMD8 [0x40000001AA87 -il doit être 0x48, pas 0x40.

OriginalL'auteur Sembazuru | 2010-03-02