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 - problems...

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



Joined: 24 Aug 2005
Posts: 9

View user's profile Send private message

MMC - problems...
PostPosted: Thu Sep 07, 2006 9:09 am     Reply with quote

I am unsucessfully trying read from MMC card for a week now.
I am using mmc_spi.c 'driver', PIC 18F2620 at 20MHz and 3.0V, MMC directly connected to appropriate SPI pins on PIC. I am never getting 0xFE response token from MMC!! Why? This is what driver debug is saying:
Code:
                                                                                                                                                                               
 sent cmd 0, arg 0                                                                                                                                                             
 err: no start bit waiting for response                                                                                                                                       
                                                                                                                                                                               
 sent cmd 0, arg 0                                                                                                                                                             
 i=7                                                                                                                                                                           
 cmd data in = 01                                                                                                                                                             
                                                                                                                                                                               
 sent cmd 1, arg 0                                                                                                                                                             
 i=7                                                                                                                                                                           
 cmd data in = 01                                                                                                                                                             
                                                                                                                                                                               
 sent cmd 1, arg 0                                                                                                                                                             
 i=7                                                                                                                                                                           
 cmd data in = 00                                                                                                                                                             
 init cmd returns: 00                                                                                                                                                         
                                                                                                                                                                               
 sent cmd 59, arg 0                                                                                                                                                           
 i=7                                                                                                                                                                           
 cmd data in = 00                                                                                                                                                             
                                                                                                                                                                               
 sent cmd 16, arg 16                                                                                                                                                           
 i=7                                                                                                                                                                           
 cmd data in = 00                                                                                                                                                             
                                                                                                                                                                               
 sent cmd 17, arg 0                                                                                                                                                           
 i=7                                                                                                                                                                           
 cmd data in = 00                                                                                                                                                             
 ERR: didnt get repsone when reading   


It sits in a loop for 150 times, waiting for 0xFE token, but it never comes.
I also wrote my own code to communicate based on http://www.cc5x.de/MMC/ but it also don't get the token. Instead, I receive 0xFF, 0xFF, 0xFF, 0xFC (response token for multiple block WRITE!?), 0, 0....
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Sep 07, 2006 2:22 pm     Reply with quote

Quote:

I also wrote my own code to communicate based on http://www.cc5x.de/MMC/ but it also don't get the token.

That code has already been translated to CCS and it's known to work,
provided that your hardware is wired correctly. See this link:
http://www.ccsinfo.com/forum/viewtopic.php?t=23183&start=15
NeoTO



Joined: 24 Aug 2005
Posts: 9

View user's profile Send private message

PostPosted: Thu Sep 07, 2006 3:55 pm     Reply with quote

As I said, I can initialize MMC (send CMD0 and CMD1 with the right replies), set the block size and send read_block command, but I don't get 0xFE response token. I am running PIC on 3.0V and it is directly connected to MMC, so I have no idea, what could be wrong with wiring, that would affect MMC in a way, it wouldn't be sending 0xFE token.
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Thu Sep 07, 2006 4:02 pm     Reply with quote

I have vague memories of reading someplace that different brands of MMC cards have problems. You may want to try another card and another brand of card.

Good luck,

John
NeoTO



Joined: 24 Aug 2005
Posts: 9

View user's profile Send private message

PostPosted: Thu Sep 07, 2006 4:11 pm     Reply with quote

jecottrell wrote:
I have vague memories of reading someplace that different brands of MMC cards have problems. You may want to try another card and another brand of card.

Good luck,

John


I have 4 MMC cards at home now. 3 of them work until I want that 0xFE token. I have 2 SanDisk and one no-name RS-MMC cards.
Tomorrow I will try to connect the MMC to port B, where there is no hardware SPI module. I am running out of ideas...

Matevž
NeoTO



Joined: 24 Aug 2005
Posts: 9

View user's profile Send private message

PostPosted: Fri Sep 08, 2006 1:49 am     Reply with quote

I have removed 1k resistors, I had between PIC and MMC and now it WORKS!!!

Regards,
Matevž
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Sep 08, 2006 2:10 am     Reply with quote

Good for you that it works now, but why did you insert these resistors in the first place? It is not common to have resistors in your SPI lines, only on some specific PIC processors a resistor is required on the clock line (check errata sheet).
What are the values of your pull-up resistors? Good values are between 50k and 100kOhm.
NeoTO



Joined: 24 Aug 2005
Posts: 9

View user's profile Send private message

PostPosted: Fri Sep 08, 2006 2:13 am     Reply with quote

I have none Sad I'll try with them also.
NeoTO



Joined: 24 Aug 2005
Posts: 9

View user's profile Send private message

PostPosted: Fri Sep 08, 2006 2:17 am     Reply with quote

It works with or without 100k pull-ups.

Another question now: there is data on the card. The first sector has around 10 bytes different from 0 (it also ends with 55h and AAh), the next 10 sectors are empty, there is nothing written... Where is then the partition table?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri Sep 08, 2006 2:38 am     Reply with quote

NeoTO wrote:
I have none Sad I'll try with them also.
The pull-ups are compulsory! On power-up the cards are not yet in SPI-mode but in a mode called an MMC-bus, in this mode the outputs are open collector until you switch to SPI-mode. Without the pull-ups the data lines will float on power-up and you might get erratic startup behaviour (PIC I/O-pins are input on power-up).
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