View previous topic :: View next topic |
Author |
Message |
NeoTO
Joined: 24 Aug 2005 Posts: 9
|
MMC - problems... |
Posted: Thu Sep 07, 2006 9:09 am |
|
|
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
|
|
|
NeoTO
Joined: 24 Aug 2005 Posts: 9
|
|
Posted: Thu Sep 07, 2006 3:55 pm |
|
|
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
|
|
Posted: Thu Sep 07, 2006 4:02 pm |
|
|
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
|
|
Posted: Thu Sep 07, 2006 4:11 pm |
|
|
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
|
|
Posted: Fri Sep 08, 2006 1:49 am |
|
|
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
|
|
Posted: Fri Sep 08, 2006 2:10 am |
|
|
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
|
|
Posted: Fri Sep 08, 2006 2:13 am |
|
|
I have none I'll try with them also. |
|
|
NeoTO
Joined: 24 Aug 2005 Posts: 9
|
|
Posted: Fri Sep 08, 2006 2:17 am |
|
|
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
|
|
Posted: Fri Sep 08, 2006 2:38 am |
|
|
NeoTO wrote: | I have none 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). |
|
|
|