Shop OBEX P1 Docs P2 Docs Learn Events
SD Card Help? — Parallax Forums

SD Card Help?

Dan TaylorDan Taylor Posts: 207
edited 2009-07-14 22:45 in Propeller 1
I have got a SD Card·but am kindof at a loss on how to use it. Could someone explain to me how you upload files to it and use them? I would greatly appreciate it! Can you also store mp3 files and play them through a piezo speaker?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor
«1

Comments

  • mctriviamctrivia Posts: 3,772
    edited 2009-06-16 02:29
    mp3 directly no. wav can be done.

    http://obex.parallax.com/objects/324/

    read the files one of them has a schematic.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    propmod_us and propmod_1x1 are now in stock. Only $30. PCB available for $5

    Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
  • mynet43mynet43 Posts: 644
    edited 2009-06-16 02:30
    Hi Dan,

    I assume you know how to wire it. If not, that's another problem.

    Here's a little program that displays a directory of the SD card.

    It then opens a file called "newfilex.txt". It writes some data to it, then closes the file.

    After this, it opens the file again, reads the data it wrote and displays it to the screen.

    I hope this helps. If not, ask more questions.

    Jim

    CON
            _clkmode        = xtal1 + pll16x
            _xinfreq        = 5_000_000
    
      BasePin  = 16                 ' base pin for video output (0, 8, 16, 24) - 16 on proto board
      
      kbd_dpin = 26                 ' keyboard dpin number - pin 26 on proto board
      kbd_cpin = 27                 ' keyboard cpin number - pin 27 on proto board
      kbd_lock = %0_001_000         ' keyboard locks: disable scroll lock key, NumLock, CapsLock, ScrollLock all off
      kbd_auto = %01_01000          ' keyboard auto repeat: 0.5 sec delay, 15 chars/sec repeat (?)
      kbdflag  = 0                  ' set this if a keyboard is connected/needed
      
    obj
    '   term: "tv_text"
      term: "VGA_1024"
       sdfat: "fsrw"
    
    var
       byte tbuf[noparse][[/noparse]20]
       
    pub go | x
       x := \start
       term.str(string("Returned from start", 13))
       term.dec(x)
       term.out(13)
       
    pub start | r, sta, bytes
       term.start(BasePin, kbdflag, kbd_dpin, kbd_cpin, kbd_lock, kbd_auto)
    '   term.start(12)
       term.str(string("Mounting.", 13))        
       sdfat.mount(0)
       term.str(string("Mounted.", 13))
       term.str(string("Dir: ", 13))
       sdfat.opendir
       repeat while 0 == sdfat.nextfile(@tbuf)
          term.str(@tbuf)
          term.out(13)
       term.str(string("That's the dir", 13))
       term.out(13)
       r := sdfat.popen(string("newfilex.txt"), "w")
       term.str(string("Opening returned "))
       term.dec(r)
       term.out(13)
       sta := cnt
       bytes := 0
       repeat 3
          repeat 39
             sdfat.pputc("*")
          sdfat.pputc(13)
       sdfat.pclose
       term.str(string("Wrote file.", 13))
       r := sdfat.popen(string("newfilex.txt"), "r")
       term.str(string("Opening returned "))
       term.dec(r)
       term.out(13)
       repeat
          r := sdfat.pgetc
          if r < 0
             quit
          term.out(r)
       term.str(string("That's, all, folks!", 13))
       sdfat.pclose
    
    

    Post Edited (mynet43) : 6/16/2009 2:35:14 AM GMT
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-06-16 05:13
    mynet43,

    ···· I have bought the SD holder sold by ucontroller.com, it has given pins on it. Are those correct. Also I don't have the programs[noparse]:term:[/noparse]·tv_text, VGA_1024, and fsrw.


    mctrivia,

    ···· Is there a way to convert mp3 to wav?

    Thanks you both for your help!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-16 05:35
    tv_text comes with the Propeller Tool as well as being downloadable from the Propeller Object Exchange.

    The other drivers (objects) are available in the Object Exchange. I think VGA_1024 is the VGA HiRes Text driver. fsrw is part of the SD card driver.

    There are many utility programs for the MacOS, Windows, and Linux to convert sound files from one format to another including from MP3 to WAV. Apple's QuickTime can do it and there are versions downloadable for Windows as well as the built-in version in the MacOS.

    Post Edited (Mike Green) : 6/16/2009 5:40:25 AM GMT
  • mctriviamctrivia Posts: 3,772
    edited 2009-06-16 05:43
    here is my version. it was writen for a fireworks display so it starts paused and you have to unpause it.

    cool edit pro is my favorite audio program. iTunes though will do the conversion also and is free.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    propmod_us and propmod_1x1 are now in stock. Only $30. PCB available for $5

    Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-06-16 21:51
    Ok.

    One last question. How do you connect the SD Card holder?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • mctriviamctrivia Posts: 3,772
    edited 2009-06-16 21:53
    Look at the schematic

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    propmod_us and propmod_1x1 are now in stock. Only $30. PCB available for $5

    Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-06-17 03:35
    What schematic?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • mctriviamctrivia Posts: 3,772
    edited 2009-06-17 03:43
    One of the files in starts with a I think in the file I uploaded

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    propmod_us and propmod_1x1 are now in stock. Only $30. PCB available for $5

    Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
  • mctriviamctrivia Posts: 3,772
    edited 2009-06-17 13:09
    sdspiqasm contains the schematic. You can also look up the schematic of my propmod-us_sd on my web site propmodule.com

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    propmod_us and propmod_1x1 are now in stock. Only $30. PCB available for $5

    Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-06-17 15:06
    Wow! Thanks alot!jumpin.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-06-17 17:01
    I figured out how to·covert mp3·files to·wave files and upload them to the SD card but I still can't figure out text.

    I am trying to build the Loadrunner game. It says to copy all the level*.txt files to the SD card. How do I do this???? I have been working on this for hours but I can't figure out how! cry.gif


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • rokickirokicki Posts: 1,000
    edited 2009-06-17 17:03
    If you have a secure digital slot on your computer, or a SD card reader/writer, just plug the card into the
    computer and copy the files over using the normal computer tools.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-06-17 18:08
    Ok, I have got the files on the SD card, (thanks to rokicki.) But the program never makes it past these lines at the beginning.

    124· text.str(string("sd not detected, halted."))
    125· fsrw.start(@ioControl)···············
    126· fsrw.mount(spiDO,spiClk,spiDI,spiCS)



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • rokickirokicki Posts: 1,000
    edited 2009-06-17 18:29
    Okay, my best guess is your card is not formatted to FAT16. How did you format it?
    What size card is it? If you do a forum search (using the google link), you can
    easily find lots of information on how to format an SD card.

    Note, to search the forums, use the url http://search.parallax.com/ and *don't* use
    the little forum search box.

    The command I use to format is
    format x: /fs:fat /a:32K
    
    


    where x: is the name of your SD device. (Windows explorer will tell you what this
    x: should be.)
  • mctriviamctrivia Posts: 3,772
    edited 2009-06-17 18:33
    Make sure the card is 2gb or smaller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    propmod_us and propmod_1x1 are now in stock. Only $30. PCB available for $5

    Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-06-17 18:40
    The SD card that I am using is very small only 32 megabytes. I got it from a used canon camera that we don't use anymore. Here is a link: http://www.dealadeal.com/auction/index.cfm?P=5&I=335045
    I did not format it at all, didn't know you had to. smhair.gif

    What do you mean by the name of you SD device? Would that be the part # SDC-32M? Or something else?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • rokickirokicki Posts: 1,000
    edited 2009-06-17 18:44
    Hmm, 32MB should be FAT16 by default, so that's probably not the problem. But it might be fat12.

    I would format it just to be safe, but since it's such a tiny card I would use the following:

    format x: /fs:fat /a:4K
    
    



    That will give you 4K clusters, but make absolutely sure it is FAT16.

    By the "name of the SD card" I mean the drive letter that Windows mounts it as when you put it
    in your Windows machine. Typically your hard disk is C: and your floppy is A:. Something like
    F: is typical for a removable device like an SD card. You want to make sure you get this right,
    because you do not want to format your hard drive.
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-06-17 19:08
    When I tried the: format x: /fs:fat /a:4K, It said that the option 4K didn't exist. So I tried the 32K and it said "Cannot format... this volume is write protected." Even though it isn't locked.

    So I tried doing it on My Computer, by side-clicking the drive and clicking format. The file system was FAT by default, but it has another option "Alocation Unit Size." You have the option of 512 bytes to 6 kilobytes. What should I do?

    Thank you both for your help!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • rokickirokicki Posts: 1,000
    edited 2009-06-17 19:20
    Do the format with right-click, and specify an allocation unit of 4K (or 4096 bytes).

    For the command, use

    format x: /fs:fat /a:4096
    
    



    (The options allow 4096, but not 4K, yet 32K, but not 32768.)
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-06-17 19:31
    The only answer I Get states that it is write protected. Do I need to tape the switch?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • mctriviamctrivia Posts: 3,772
    edited 2009-06-17 19:34
    The switch may be broken. I have had that happen

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    propmod_us and propmod_1x1 are now in stock. Only $30. PCB available for $5

    Need to upload large images or movies for use in the forum. you can do so at uploader.propmodule.com for free.
  • rokickirokicki Posts: 1,000
    edited 2009-06-17 19:36
    Heh, frankly? You might go out and pick up a cheap 2GB card. If the switch is broken, who knows what else
    might be wrong. smile.gif

    But if it works in the camera, then I wonder if it's the reader that's broken.

    Also, you were able to write files to it, so it sounds like it's not *really* write protected. Is it possible you
    have a command shell or window open on that card, and *that's* what's preventing the formatting?
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-06-17 19:44
    I don't really know what a command shell is. Though I am going to be buying a new SD card.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • VaatiVaati Posts: 712
    edited 2009-06-18 16:44
    I got this SD card:

    http://www.amazon.com/Kingston-Secure-Digital-SD-2GB-S/dp/B000E5FOYS/ref=sr_1_7?ie=UTF8&s=electronics&qid=1245343356&sr=8-7

    If you sign up for the Amazon Prime Trial thingy, you can get free shipping on it and lots of other items.
    Apparently the Elite Pro has a faster data transfer, so I guess it would be worth it...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Quit buying all those fixed voltage regulators, and·get an Adjustable Power Supply·for your projects!· Includes an LED testing terminal!

    *-NEW-* SD Card Adapter·Now available!· Add extra memory to your next Propeller project with ease!

    Post Edited (Vaati) : 7/15/2009 12:34:36 AM GMT
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-07-14 19:34
    I got a new 2G SD Card, but I couldn't get the sound to work. So I reprogrammed it with the following code: format·x:·/fs:fat·/a:4096.·Having·F·for X.·But then at the start at any program it just says "Returned from start -20".
    I was trying the program that mynet43·posted on the previous page. The program was·working before I reprogrammed it though.

    Could someone please provide a solution? Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • rokickirokicki Posts: 1,000
    edited 2009-07-14 20:18
    4096? Try 32k. 4096 will not work with that version of fsrw (because 4096 makes it FAT32, not FAT16, for a 2GB card.)
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-07-14 22:01
    Now that I changed to 32k the text will display but still will not work with sound. Please help?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • rokickirokicki Posts: 1,000
    edited 2009-07-14 22:31
    Do you get any sort of error message?
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-07-14 22:45
    I am talking about a whole nother program. I have attached it. Someone posted in a previous post. There was no error message because the display is not incorpurated into the program.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
Sign In or Register to comment.