Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

mmc card read block problem ?

Status
Not open for further replies.

jit_singh_tara

Full Member level 6
Joined
Dec 22, 2006
Messages
328
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Location
Delhi , India
Activity points
4,299
mmcreadblock

well i have been able to get response from the read block command as 0x00 , but how do i get data token 0xfe and data block after it ... can any one send me this code..... or an idea , i am using pic18f8520 and c lang.:?:
 

jit_singh_tara

Full Member level 6
Joined
Dec 22, 2006
Messages
328
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Location
Delhi , India
Activity points
4,299
bs_jmpboot

i have seen that page , i want a running code or an idea as to what should i do so that
i recieve data token for read block command. and data bytes 512 after it.
 

picnoobie

Full Member level 1
Joined
Nov 19, 2006
Messages
97
Helped
8
Reputation
16
Reaction score
2
Trophy points
1,288
Activity points
1,779
rea<d block mmc

somehow, I doubt that you really look at the link. :(

In that link there are downloadable sample files, you might want to look in
the avr dir specifically the file "mmc.c". You just have to change a few platform specific defines and you should be able to make it work on a pic. Even if you're not going to use it as it is after changing the platform specific defines, you can atleast see how he did it.

But if all else fail. You might want to look at this http://www.cs.ucr.edu/~amitra/sdcard/ProdManualSDCardv1.9.pdf

.hope it helps.
 

esbrasil

Newbie level 4
Joined
Dec 6, 2007
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
sd card reading a block

If Your SD/mmc card contains a MBR then reading sector 0 of the card doesnt mean that your reading sector 0 of the fisical disk .... try:


while ( (BS_jmpBoot !=0xEB) && (t<400) )
{
SectorRead(t, (byte*)sector); // read a sector
t++;
BS_jmpBoot = *(word*)&sector[0x00]; //is the first byte 0xEB???
}

now the first sector of your card pointed by t. (ALMOST always 64)
 

sunildutt

Newbie level 2
Joined
Sep 23, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,298
Hi ,
I am working on interfacing the SPI (GPIO) interface with the SD card.I was able to get the responses of all the commands (CID,CSD,SCR,).
I tried to do a block read (the data token also has obtained) for the first 8 blocks and I could get the following data from the first block and 0’s in all the next blocks.I know I am going wrong with my concepts .
Can you please help me.
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004bc1f59e00033d061cfcd9f90007531e000000000000000000000000000000000000000000000000055aa
Is it the correct data.The block0 should contain the MBR.I tried to do the hexdump using winhex of the data from the card and I could not match the data read from the winhex and my application.
Can any one help me out.
Regards,
Sunil
 

ferdem

Advanced Member level 4
Joined
Oct 18, 2008
Messages
113
Helped
29
Reputation
58
Reaction score
26
Trophy points
1,308
Location
Türkiye
Activity points
2,227
Hi Sunil, I had same problem. I did not make any change on my circuit and software, however, it is resolved. What I only did is reformatting my SD card to clear all content, my intent was not to figure out the problem. You can try reformat your SD card but I m not sure wheter format is a solution or not.

SD card works fine now but the problem is still mystery for me. How do we explain wrong 498 bytes despite last two correct bytes which are MBR signature! If formatting had solved it, how?
 

sunildutt

Newbie level 2
Joined
Sep 23, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,298
Hi ,
Thanks for the mail.I feel I was misinterpreting the the data.It is the MBR which contains the partition information from 446th byte(forget about non zero data before that).Interpreting this partition info I was able to read the boot record(Volume ID) specified by the offset 0x000000f9 in the above trace.
This mmc driver is integrated in Linux and when I try to mount the device I always get the error "mounting /dev/mmc on m failed: Invalid argument" .
I also see that when ever I try to mount the drivers request function is invoked to read the first sector.Thus the driver always reads the MBR and returns to the filesystem.Ideally it is the file system that interprets the MBR's partition table and issue request with the calculated sector address right.
Can any one help me in debugging this issue.
Regards,
Sunil
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top