Shop OBEX P1 Docs P2 Docs Learn Events
PropBASIC - SD card / FAT working anyone? — Parallax Forums

PropBASIC - SD card / FAT working anyone?

simonlsimonl Posts: 866
edited 2012-12-01 14:58 in Propeller 1
Has anyone got FAT working with SD cards using PropBASIC yet? I thought I saw someone mention it a while back - may have been FSRW via dispatcher? - but I can't find any mention of it in my searches.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,
Simon

www.norfolkhelicopterclub.com

Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.

Comments

  • RsadeikaRsadeika Posts: 3,837
    edited 2010-06-13 19:08
    Maxwin was working on a PropBASIC SD program, but have not heard from him since his last post. He must of given up on the program, it is a lot of work, I do not blame him one bit.

    Ray
  • VonSzarvasVonSzarvas Posts: 3,451
    edited 2010-06-13 19:55
    Hi Rsadeika & simonl,

    Not given up just yet... only not able to work the last couple of weeks. The SD card dev. platform is sitting on my shiny new desk and I will be back to it this week. (That said the holiday season is about to start and I am planning to be away for most of the next 3 months, so depending on progress I may not post anything new with any great pace until September).

    My plan does not currently involve FAT though. I would probably use one of the SPIN objects for that at the moment as it seems FAT implementation is not a part-time project [noparse]:)[/noparse]

    My intention is to create a library of PropBASIC functions that allow an SD card to be used for mass storage of data instead of an eeprom. So I will not be concerned with filenames etc.. Just reading and writing to logical memory addresses.

    I will be using it for a datalogging project - so the plan is to write "raw" data to the SD card, then at the end of each month simply plug the card into a PC and read the data into a spreadsheet or database table for processing.

    Anyhow, I will certainly keep posting with any useful progress,

    Cheers, Max.
  • simonlsimonl Posts: 866
    edited 2010-06-13 20:17
    Hi both - thanks for your replies.

    @maxwin: Yay, I'm looking to do datalogging to SD too! I'm just wondering how you'll be able to read the SD on the PC if the card's not got some form of FAT on it - can PCs read raw?

    I wish I understood PropBASIC dispatcher - I'd have a go at doing this with FSRW myself.

    I'm looking forward to September - LOL

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,
    Simon

    www.norfolkhelicopterclub.com

    Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.
  • VonSzarvasVonSzarvas Posts: 3,451
    edited 2010-06-14 05:56
    @simonl

    PCs can read raw with ease!

    For example, with .NET code, open a file stream to the SD card but using ".\PhysicalDriveX" as the drive name instead of C, D, E, whatever... (where X is a physical drive number, eg. 4). You can find the PhysicalDrive number by checking control panel/administrative functions/computer management/disc management.

    There are also some freeware apps that will allow you to get the raw data and export to a text file. WinHex is one.
    Some other tips on coding here: www.fort-awesome.net/blog/2010/03/25/MBR_VBR_and_Raw_Disk
  • pmrobertpmrobert Posts: 675
    edited 2012-11-15 06:59
    Resurrecting zombie thread here! Maxwin, did you ever have much success with an SD lib for Propbasic? Just wondering so I don't go reinventing the wheel....

    -Mike
  • VonSzarvasVonSzarvas Posts: 3,451
    edited 2012-11-15 12:18
    Hi Mike.... yes !

    http://forums.parallax.com/showthread.php?122615-PropBasic-SD-Card

    The final code was attached to the first post.

    Enjoy!
  • pmrobertpmrobert Posts: 675
    edited 2012-11-16 05:13
    I'm using a 16gb usd (SDHC) that works fine under fsrw. Sdplay hangs after "card inserted" message. sd.lib appears to successfully open the usd but hangs when any other operation is requested. Should I perhaps try a smaller non-SDHC card or do you have any suggestions? I only need a few hundred kb of storage space for config info so small would work. The challenge will be finding a new small non-SDHC - but I may be getting ahead of myself here. Thanks for the prompt response and the code, any further insight would be greatly appreciated.

    -Mike
  • VonSzarvasVonSzarvas Posts: 3,451
    edited 2012-11-17 00:14
    I only ever had 2GB usb sticks when I wrote this! Try 2GB or smaller to check it works... 4GB might work too- cannot remember now.

    Probably 16GB could be made to work... could it be something silly like the total sector number is bigger than one long, and so that would need to be stored across two (or more) longs, or divided by a suitable value before storing to one long?
  • pmrobertpmrobert Posts: 675
    edited 2012-11-17 08:59
    Thanks, Max. I tried a 4gb with same results. Ebay had 2gb cards for basically pennies so I've ordered one. Have a good day sir!

    -Mike
  • VonSzarvasVonSzarvas Posts: 3,451
    edited 2012-11-17 12:29
    pmrobert wrote: »
    Thanks, Max. I tried a 4gb with same results. Ebay had 2gb cards for basically pennies so I've ordered one. Have a good day sir!

    -Mike

    Good stuff! Don't give up.. I am still using this code in a project logging sensor data to 1 & 2gb cards, which is working well even after two years of service.

    I will try to find a moment to try some larger cards next week, but if you have some success yourself in upgrading the code, then please do post - it would be really interesting to see the capability continued in PropBasic for the future (and more modern) generations!!
  • pmrobertpmrobert Posts: 675
    edited 2012-12-01 14:58
    Maxwin, I didn't give up! I now have 100% success using 256MB cards. For whatever reason 2 gig and above did not work. I'm not complaining in any way, just documenting my experience to hopefully help others. Thanks again for sharing your code, it does precisely what I need and I'm encouraged by your report of two years of reliability regarding your use.

    -Mike
Sign In or Register to comment.