View previous topic :: View next topic |
Author |
Message |
gbie
Joined: 22 Apr 2009 Posts: 8
|
MMC initialization Set Block Length |
Posted: Tue May 05, 2009 12:07 am |
|
|
my initialization stopped working. when i send CMD16, i get a R1 response of 00000111, which means illegal command + erase/reset + idle?
Code: |
// Got out of idle response
SPI_WRITE(0xFF); // extra clocks to allow mmc to finish off what it is doing
output_low(PIN_C2); // set SS = 0 (on)
SPI_WRITE(0x50); // send mmc command1 to bring out of idle state
SPI_WRITE(0x00);
SPI_WRITE(0x00);
SPI_WRITE(0x02); // high block length bits - 512 bytes
SPI_WRITE(0x00); // low block length bits
SPI_WRITE(0xFF); // checksum is no longer required but we always send 0xFF
count = 0x05;
response = 0xFF;
while(response !=0x00 && count >1){
response = SPI_READ(0xFF);
--count;
}
if (response ==0x00){ //if correct response
output_high(PIN_C2);
return (0);
} else {
output_high(PIN_C2);
return(3);
} |
could this have to do with formatting the mmc card with my PC and a card reader? |
|
|
gbie
Joined: 22 Apr 2009 Posts: 8
|
|
Posted: Tue May 05, 2009 12:45 am |
|
|
Actually, I see that I'm getting a response in the middle of a command.
I send CMD0, get 0x01. Good.
I send CMD1, after 2 tries, I get 0x00. Good.
I send CMD16, I get a 0x07 response in the middle of the command.
I send CMD16 against afterwards and can get a correct 0x00 response. |
|
|
gbie
Joined: 22 Apr 2009 Posts: 8
|
|
Posted: Tue May 05, 2009 1:19 am |
|
|
I got the right responses by adding more clock cycles between commands.
Next problem: I can't get the data block response after a write anymore. I do get a busy signal though. A long block of 0x00. Except the last one. That's 0x07. :(. well, it looks like my response is 0xE0 instead of E5. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Tue May 05, 2009 4:07 am |
|
|
Quote: | I got the right responses by adding more clock cycles between commands. | Seems, as you should pay more attention to the MMC protocol specification. |
|
|
|