View previous topic :: View next topic |
Author |
Message |
Imanjl
Joined: 15 Nov 2004 Posts: 42
|
MMC initialization Failure (Brands related)! |
Posted: Sun Jan 13, 2008 3:52 pm |
|
|
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
|
|
Posted: Sun Jan 13, 2008 4:13 pm |
|
|
Is the Transcend unit really an SD card, and not an MMC card ? |
|
|
Imanjl
Joined: 15 Nov 2004 Posts: 42
|
|
Posted: Sun Jan 13, 2008 11:35 pm |
|
|
Trancend Unit Is a MMC card : RS-MMC DV . |
|
|
crystal_lattice
Joined: 13 Jun 2006 Posts: 164
|
Kingston not working |
Posted: Mon Jan 14, 2008 2:40 am |
|
|
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
|
Re: Kingston not working |
Posted: Mon Jan 14, 2008 2:12 pm |
|
|
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
|
where to get driver |
Posted: Tue Jan 15, 2008 11:49 pm |
|
|
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 |
|
|
|