How to find the address of stored data on a SD memory card?



THE BOOK of DT's INTERRUPTS is an organization of interrupt service routines and other works written by Darrel Taylor, RIP.

Interrupt routines are arranged per Darrel's original list. Darrel Taylor's Instant Interrupts are an extension of the work of Tim Box whom in October of 2002 wrote INT_CTRL.pbp

Many of the forum members felt this is a long overdue project.

THE BOOK of DT's INTERRUPTS
will be a valuable resource and a tribute to Darrel Taylor the "Fanatical Contributor".

THE BOOK of DT's INTERRUPTS is located at http://dt.picbasic.co.uk/

+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323

    Default How to find the address of stored data on a SD memory card?

    I've got a 2GB SD memory card that's formatted for FAT16, and I've put some data on it (just drag 'n' drop from windows) and now I need to read it back with my "device".
    The catch is, I can't look up the data by filename... I need to know the physical memory address to retrieve the goods.

    Is there an easy way (some kind of cute little utility?) that will tell me the starting addresses of the data items on my card?


    Thanks!

    steve

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    If you are using SDFS from MeLabs here is a snippet that might help.
    Code:
    SDOPEN_W:
    ' Open a file for write
    	FAT_mode = "A"		' Write mode
    	Gosub FSfopen		' Open file pointed to by Byte array FAT_FileName
    
      Serout2 PORTC.6, 16572, ["Open for write Error: ", Dec FAT_error, $d, $a]
    
    Serout2 PORTC.6, 16572, [ "FILE NAME  ", STR FAT_FileName\11, $d, $a]
    Serout2 PORTC.6, 16572, [ "DISK_fat  ", Dec DISK_fat, $d, $a]
    Serout2 PORTC.6, 16572, [ "DISK_buffer  ", Dec DISK_buffer, $d, $a]
    Serout2 PORTC.6, 16572, [ "SDC_sector_addr  ", Dec SDC_sector_addr, $d, $a]
    Serout2 PORTC.6, 16572, [ "FAT_ccls   ", Dec FAT_ccls, $d, $a]
    Serout2 PORTC.6, 16572, [ "LAST_CLUSTER ", Dec LAST_CLUSTER, $d, $a]
    Serout2 PORTC.6, 16572, [ "FAT_c  ", Dec FAT_c, $d, $a]
    Serout2 PORTC.6, 16572, [ "DISK_maxcls:  ", Dec DISK_maxcls, $d, $a]
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    If you are using SDFS from MeLabs here is a snippet that might help.
    Errr... welll... no... I'm not using SDFS. In fact I had to do a search just now to find out what the heck you're talking about.

    But I've downloaded the files and have the SDReadme.txt open in front of me now and it looks like this is going to be very helpful for me.

    It looks like I've got some reading to do... will be back later with more questions I'm sure.


    Thanks Dave!!

    steve

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    If you want to get into FAT32???
    http://www.picbasic.co.uk/forum/showthread.php?t=11700
    The new link to the file is near the end of the thread..
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Thanks Dave, but I can't use FAT32. The SD card lives inside another device that doesn't play FAT32.

    Still researching my options....


    steve

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    The origional SDFS is FAT16.
    A cool thing about the SDFS32 is if you build your own card reader thingy it will be able to read or write to either one. It detects the format for you.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default

    mackrackit,

    I have been trying to figure out for a while how to send FAT16 or FAT32 files to a SD memory card like Byte_Butcher is trying to do. But using SDFS seems to do the job. Thank you for your help. I also didn't have any idea what SDFS is for.

    The file SDReadme.txt shows a serial connection between the MCU and the PC computer. Now my question for you, can this serial connection be replaced by a USB connection by using for example a PIC18F4550? Have anybody achieved this SDFS with a USB connection? Thank you all for your help.

    Robert

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    All the serial connection is for is dubugging/monitor want is going on. Once you are happy with the setup all of those lines can be deleted.

    USB... I have not played with USB but I do not see why you could not use it for debugging if the PC has a terminal that will work with it.
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default

    Thank you mackrackit for your response.

    Yes, I guess USB can be used for dubugging and monitor what is going on with the MCU. But, what I really had in mind was to be able to see the information in the SD card through a USB connection as a thumbdrive. This might be a challenging project for me, but like everybody else in this forum I am up to the challenge!

    Robert

  10. #10
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rsocor01 View Post
    Thank you mackrackit for your response.

    Yes, I guess USB can be used for dubugging and monitor what is going on with the MCU. But, what I really had in mind was to be able to see the information in the SD card through a USB connection as a thumbdrive. This might be a challenging project for me, but like everybody else in this forum I am up to the challenge!

    Robert
    That would be an interesting project. Probably make you pull your hair out though...
    I go to walmart and get a SD/USB reader for less than $10. Saves my hair
    Dave
    Always wear safety glasses while programming.

  11. #11
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Yep. For $10 you get a 2GB SD card, 2 "othersize adapters", and a USB adapter for the card. (and a little plastic carrying case, not shown)

    No hair pulling at all. Just stick the card in the adapter, shove it in yer USB slot and copy files to and from...


    steve



  12. #12
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637


    Did you find this post helpful? Yes | No

    Default

    Well, what I have been working on is a data logging project that loads the data into a SD card. In this project, the user can interface with the system using a graphic LCD display and data is constantly loaded into the 2GB card. So, I thought that instead of having to remove the SD card all the time to be able to read its contents, it would be very nice been able to read the SD card using a USB connection and read the whole thing like a thumbdrive. There are many devices out there in the market that perform a similar function, like for example your photo camera.

    An easy way to achieve this seems to be using the FTDI Vinculum VDIP1 modules. BrianT explains how to set this chip up in the next thread.

    http://www.picbasic.co.uk/forum/showthread.php?t=7700

    I've just been trying to stay away from adding more chips to my circuit but probably the FTDI Vinculum is the best way to go for the project that I am working on. At least, it seems to be the easiest way.

    Robert
    Last edited by rsocor01; - 4th March 2010 at 20:31.

  13. #13
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Yes, SDFS can be used for reading a file and send that info out. It can be done serially so if you know how to use USB then it shoulf also work with that.

    In my opinion for data logging stay away from the VDIP stuff and use a SD card.
    I spent more time trying to use the VDIP than I did learning to use SDFS.

    So, in the SDFS docs look at SDFS_READ command.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Need the code to write to a memory
    By Hamlet in forum General
    Replies: 0
    Last Post: - 20th August 2007, 00:22
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts