Initialisieren der SD-Karte im SPI-Probleme

Ich habe einen Blick auf Stack Overflow Frage Die Initialisierung einer microSD-Karte mit SPI-Schnittstelle und sehe keine Antworten, der auf mein Problem (das ist, was ich nicht schon versucht).

Ich habe ein ähnliches Problem, wo ich versuche, auf eine SD-Karte über einen mikrocontroller-SPI-interface (speziell ein HC908). Ich habe versucht, nach dem flow-charts im Physical Layer Simplified Specification v2.00 Uhr und es scheint richtig initialisiert Transcend 1 GB & 2 GB und AE&C 1 GB-Karte. Aber ich habe Probleme auf drei zufällige andere Karten aus meinem Fundus von alten Karten, die ich verwendet habe, auf meine Kamera.

Mein code ist alle HC908 assembler. Ich scoped aus der SPI-clock-Linie und während der Initialisierung ausgeführt wird, über 350 kHz (nur die Geschwindigkeit Multiplikator, der HC908 versorgt bei meiner low-MCU-Taktfrequenz, die sich innerhalb der 100 - 400 kHz-Fenster).

Hier sind die Ergebnisse der drei Karten, die nicht den Abschluss meiner Initialisierungs-routine (alles geschieht fortlaufend, ohne irgendwelchen code zu ändern oder timing-Parameter):

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)

Ist das illegal command flag stecken? Sollte ich etwas tun, nach CMD8 an klar, dass die Flagge?

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)

Warum wird OCR alle F? Scheint nicht die richtige überhaupt. Auch, warum ACMD41 und CMD1 Antworten illegaler Befehl? Ist CMD1 scheitern, weil die Karte wartet auf ein gültiges ACMD nach dem CMD55 auch mit den illegalen Befehl Antwort?

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.

Was auf der Erde ist falsch mit dieser Karte?

Manchmal ist es synchron, mal nicht. (Das obige Muster ist wiederholbar.) Ich habe den Gültigkeitsbereich dieses heraus, und ich bin nicht zu sehen, jeder Schurke clock-Zyklen Durchlaufen zwischen MOSI/MISO überträgt.

  • Vergaß zu erwähnen. Nach diesen gescheiterten versuche, initialisieren Sie die 3 Karten, lege ich Sie in mein laptop SD-Karten-reader, und ich konnte immer noch Zugriff auf Sie als standard-SD-Karten (Lesen und schreiben) w/o Problem.
  • Einen bug gefunden in der Liste der Befehle für "SanDisk ExtremeIII": Send CMD8 [0x40000001AA87 -so sollte es sein, 0x48, nicht 0x40.
InformationsquelleAutor Sembazuru | 2010-03-02
Schreibe einen Kommentar