+ Post New Thread
Results 1 to 8 of 8
  1. #1
    Full Member level 6
    Points: 3,903, Level: 14

    Join Date
    Dec 2006
    Location
    Delhi , India
    Posts
    323
    Helped
    10 / 10
    Points
    3,903
    Level
    14

    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.

    •   AltAdvertisement

        
       

  2. #2
    Full Member level 1
    Points: 2,444, Level: 11
    Achievements:
    7 years registered

    Join Date
    Nov 2006
    Posts
    97
    Helped
    8 / 8
    Points
    2,444
    Level
    11



  3. #3
    Full Member level 6
    Points: 3,903, Level: 14

    Join Date
    Dec 2006
    Location
    Delhi , India
    Posts
    323
    Helped
    10 / 10
    Points
    3,903
    Level
    14

    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.



    •   AltAdvertisement

        
       

  4. #4
    Full Member level 1
    Points: 2,444, Level: 11
    Achievements:
    7 years registered

    Join Date
    Nov 2006
    Posts
    97
    Helped
    8 / 8
    Points
    2,444
    Level
    11

    rea
    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...SDCardv1.9.pdf

    .hope it helps.




  5. #5
    Newbie level 4
    Points: 918, Level: 6

    Join Date
    Dec 2007
    Posts
    6
    Helped
    0 / 0
    Points
    918
    Level
    6

    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)



    •   AltAdvertisement

        
       

  6. #6
    Newbie level 2
    Points: 407, Level: 4

    Join Date
    Sep 2010
    Posts
    2
    Helped
    0 / 0
    Points
    407
    Level
    4

    Re: mmc card read block problem ?

    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.
    00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000004bc1f59e00 033d061cfcd9f90007531e0000000000000000000000000000 00000000000000000000055aa
    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



  7. #7
    Full Member level 1
    Points: 2,579, Level: 11
    Achievements:
    7 years registered

    Join Date
    Oct 2008
    Location
    Türkiye
    Posts
    112
    Helped
    29 / 29
    Points
    2,579
    Level
    11

    Re: mmc card read block problem ?

    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?



  8. #8
    Newbie level 2
    Points: 407, Level: 4

    Join Date
    Sep 2010
    Posts
    2
    Helped
    0 / 0
    Points
    407
    Level
    4

    Re: mmc card read block problem ?

    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



--[[ ]]--