CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

MMC initialization Set Block Length

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
gbie



Joined: 22 Apr 2009
Posts: 8

View user's profile Send private message

MMC initialization Set Block Length
PostPosted: Tue May 05, 2009 12:07 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue May 05, 2009 12:45 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue May 05, 2009 1:19 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue May 05, 2009 4:07 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group