I get invalid response codes from my SD card (CMD8, CMD 55, and CMD 41).
Int routine:
SDCS = 1; // MMC detiart SPI1CON1bits.SMP = 0; SPI1CON1bits.CKE = 1; SPI1CON1bits.MSTEN = 1; SPI1CON1bits.CKP = 0; SPI1STATbits.SPIEN = 1; For (i = 0; i & lt; 10; i ++) SPI (0x FF); // Reset unsigned char RR = command (CMD 0,0); SDC = 1; // MMC Dormant / * Fine response == 1 * / R = Command (CMD 8,0); // check voltage SDCS = 1; / * Esponse == 0xC1?!? * / R = command (CMD58,0); // READ_OCR unsigned char ocr1 = SPI (0xFF); Unsigned four ocr2 = SPI (0xFF); Unsigned char ocr3 = SPI (0xFF); Unsigned four ocr4 = SPI (0xFF); Unsigned char ocr5 = SPI (0xFF); / * R = 0xF8; ?!? Ocr1 = 0x0F; Ocr2 = 0xFF; Ocr3 = 0xFF; Ocr4 = 0xFF; Ocr5 = 0xFF; * / SDCS = 1; // INIT unsigned char rrr = 0; I = 10000; Do {RRR = Command (55,0); // Next APP CMD is SDCS = 1; If (r) break; } While (- i> gt; 0); / * OK reaction == 1 * / // APP CMD 41 with OCR = 0x0 F ??
You can read the response code in the comments.
Is this code possible to respond to CMD8
is 0xC1
? Bit 7 should be 0, okay?
Is this a hardware error?
solution, stack overflow question . Can be found in. In summary: Before each command (except CMD 0), 0xFF
is not available to you as 0xFF
as a response.
Comments
Post a Comment