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 Failure (Brands related)!

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



Joined: 15 Nov 2004
Posts: 42

View user's profile Send private message Send e-mail Yahoo Messenger

MMC initialization Failure (Brands related)!
PostPosted: Sun Jan 13, 2008 3:52 pm     Reply with quote

After Testing different MMCs from different brands I figure out that a software works truly with one MMC can act completely unusable in another MMC with different brand.

This problem always occurs in Power Up Initializing step ,For example MMC_INIT() returns zero when I connect 64MBMMC(Nokia Mobile original card) to my board but with 128MB(kingeston DV) it returns 1 !! (Sometimes it returns zero with dual initializing)

I have another damn problem with Transcend 1GB card that MMC_INIT() returns zero So everything must work Fine ... but when I try to read from memory blocks it returns always Zero value !!! No error is reported by MMC_SPI.c when I enable 'print debug messages' . Any Idea about this can help me lot ?

We know that MMCs require clock lower than 400khz for initialization But in MMC_SPI.c the mmc_init() function drive the MMC with 5Mhz Clock which depends on PIC osc clock 20Mhz(osc)->5Mhz(MMC) 10Mhz(osc)->2.5Mhz(MMC) 4Mhz(osc)->1Mhz(MMC) So it never reaches to 400khz Standard ...! Am I say right or there is something wrong with my calculations ?

In MMC_SPI line 110 we have "#define mmc_delay_clk() " I tried to change it to "#define mmc_delay_clk() delay_us(5) " to get 200Khz stable clock ...In this situation 128MB Kingeston card Works perfectly and the initialization error never occurs ,,,But invalid Zero reading with 1GB trancend card still exists .

Im completely confused Is there anyone having such problems ?

MCU:18f452 (20Mhz), Compiler V4.032 .
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jan 13, 2008 4:13 pm     Reply with quote

Is the Transcend unit really an SD card, and not an MMC card ?
Imanjl



Joined: 15 Nov 2004
Posts: 42

View user's profile Send private message Send e-mail Yahoo Messenger

PostPosted: Sun Jan 13, 2008 11:35 pm     Reply with quote

Trancend Unit Is a MMC card : RS-MMC DV .
crystal_lattice



Joined: 13 Jun 2006
Posts: 164

View user's profile Send private message

Kingston not working
PostPosted: Mon Jan 14, 2008 2:40 am     Reply with quote

Hi there, can you perhaps send me the driver code you used for your interface. I currently have a 256 Kingston SD card but i'm having problems. Sometimes it will give me data output but this does not match the data i get using WinHEX, other times it gives output of 0x10 or 0x50 The initialization stuff seems OK as i print all the CSD stuff first then run a loop to read sectors. Maybe we have same problem with the cards/driver??

Kind Regards
Imanjl



Joined: 15 Nov 2004
Posts: 42

View user's profile Send private message Send e-mail Yahoo Messenger

Re: Kingston not working
PostPosted: Mon Jan 14, 2008 2:12 pm     Reply with quote

crystal_lattice wrote:
Hi there, can you perhaps send me the driver code you used for your interface .


The Code is so simple just calling the MMC_init() and read and write to blocks the problem is at basic functions .

Finally the invalid read from 1GB trancend card solved today .
I tried to write some data (Char Test[4]= "TEST") to boot sector (block 0 of card) and fill the rest of the block with zero ,Then I read the Block0 and it returns the correct data "TEST" !!!

In this case the boot sector fills with wrong system data when I put that MMC card to my PC Card reader unit ,Windows didnt find the card and forced me to format the card again ,I formatted it and after this time my PIC read all the blocks and sectors correctly and detect the FAT16 file system !!! I realy dont know what was happened ... but it works now.

It is so strange to me cause I formatted this very card many times before with fat16 file system on PC but my PIC always returns invalid data from boot sector .

Can anyone explain the reason ?
crystal_lattice



Joined: 13 Jun 2006
Posts: 164

View user's profile Send private message

where to get driver
PostPosted: Tue Jan 15, 2008 11:49 pm     Reply with quote

Hi again, i know the process of doing the init is not difficult, but i would like to know where/what driver did you use. If you would be so kind as to share the driver/ source of the driver it would be greatly appreciated!! I am curently also using a Kingston MicroSD card and think that might be the problem, but having another working driver would also help alot.

Kind Regards
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