Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

writing on a MMC card

Status
Not open for further replies.

Tulkas

Member level 4
Joined
May 30, 2002
Messages
70
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
646
I'm learning to use a MMC card, actually i am capable to read a sector, but i can't write, when i send the write command it doesn't answer with the appropiate response, then i can't to send the data, how can i do??, i send other commands and MMC responds ok. Im using MMC card in SPI mode, the card capacity is 32 Mb long.

Thanks.
 

Thanks, but i think i'm doing all correctly. When i send write command, MMC sends Address Error, but i don't understand why it happen, address is ok. Can you help me. If i can read a sector, why cannot i write a sector?.

Sorry for my English.

Thanks.
 

For reading a single block at a time
1 Send the command
Send the read command, then the raw address (LBA *512).
2 Wait for a R1 response
Continue to send 255 till you get something back with bit 7 clear
If <> 0 then error.
3 Wait for token
Continue to send 255 till you get a start token
4 Read 512 bytes
5 Read 2 check sum bytes
It may be a good idea to add some timeout error handling so you don't get stuck in a loop is something goes wrong.
Phil

Added after 7 minutes:

Whoops WRITING NOT READING.
For writing a single block.
1 Send the command
Send the write command, then the raw address (LBA *512).
2 Wait for a R1 response
Continue to send 255 till you get something back with bit 7 clear
If <> 0 then error.
3 Send start token
4 Send 512 bytes
5 Send 2 check sum bytes
6 Wait for NOT busy
send 255 till 0 is not received
 

Try with a lower SPI clock, it might help.
 

Hi Tulkas
Where did you learn it ?
Help me..
Thanks
 

Ok, but i don't understand why do you have to multiply by 512 (LBA * 512), what happens if i send a LBA number directly?, the address would be correct.

Thanks
 


Tulkas said:
Ok, but i don't understand why do you have to multiply by 512 (LBA * 512), what happens if i send a LBA number directly?, the address would be correct.

Thanks
Because you are addressing data.
You could ask for, or write to sector X.5 to X+1.5. The addressed data does not have to be at a LBA boundary.
If you ask for a an LBA, but the card expects a memory address, you will be out by a factor of 512.
Phil
 

Anybody form you know how interface sd card using lpc2148 ?
plz help for coding.
thanks in advance.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top