Shop OBEX P1 Docs P2 Docs Learn Events
Help With SD/MMC On Propeller — Parallax Forums

Help With SD/MMC On Propeller

soshimososhimo Posts: 215
edited 2010-07-16 02:05 in Propeller 1
I've downloaded the FAT library from Tomas Rokicki and Jonathan Dummer off the object exchange. I have the SD/MMC breakout card from SparkFun. My connections are as follows:

P0 -> DO
P1 -> CLK
P2 -> DI
P3 -> CS
All pulled up to 3.3v through a 10k resistor

I've got IRQ from the breakout pulled up to 3.3v through a 10k resistor

The raw reading and writing tests pass. The mounting tests fail. The first test where it reads the boot record fails because it thinks there is no boot record. I've formatted the card as FAT16 with a 1.88GB volume size (the SD card is 2GB). I can read and write files from windows no problem.

The second mount test fails when it tries to start the spsi object. I am receiving a -100 error. Looking at the code it seems like it could be ERR_ASM_NO_READ_TOKEN which is returned from read_single_block. I think it's happening in the code path from start_explicit but I haven't spent the time to trace how it get's from start_explicit to read_single_block.

This is a blocking issue for my project so any and all help would be greatly appreciated.

TIA

Post Edited (soshimo) : 7/15/2010 3:22:42 PM GMT

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-15 15:28
    Try this simple program: SD Trainer and see what it does.

    also, don't be afraid to try at least three different SD cards. It's amazing how many times these are the trouble.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • zappmanzappman Posts: 418
    edited 2010-07-15 16:14
    Hi OBC,

    I just ordered 2 of the uSD adapters from Parallax this morning, and I am very glad to see your post.

    I will down load and try the SD Trainer recommended in your post.

    I need to buy 2 SD cards.
    Are there any specific brands of SD cards that you know usually work?
    Are there any brands we should stay away from?
    What is the largest mb size card that will work with the Prop?

    Thanks,

    Zappman

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Visit Zappman's Blog at Savage Circuits
  • soshimososhimo Posts: 215
    edited 2010-07-15 16:31
    Thanks OBC for the quick reply.

    I think I have something wired wrong or I'm missing a connection.

    My output from your test program is as follows:
    Running the propeller SD training program

    No SD card present.
    SD card expected on: P0, P1, P2, P3

    Program halted.


    I changed the constants in the program to match my connections as I was too lazy to change them. I have DO, CLK, DI, and CS going to P0, P1, P2, and P3 respectively. All are pulled up to 3.3v through 10k resistors. I have Gnd and VCC connected to gnd and the 3.3v rail (regulated). I am pulling IRQ up to 3.3v through a 10k resistor (because I read somewhere to do that). I have no other pins connected from the breakout board (which, coincidently is very similar to Parallax's board). I've tried 2 different cards (all I have on me). I'm going to the shack to buy some more cards to try out. I still think I have something wired wrong or am missing a connection. I'll try to post a schematic.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-07-15 16:32
    I've used a variety of SD cards and all I've tried seemed to work. The maximum size you can use with the older drivers is 2GB because they're written for a FAT16 file system. The newer versions (Rokicki's FSRW 2.6 or Kye's) of the SD card drivers will work with FAT32 or FAT16 and can handle larger cards.
  • soshimososhimo Posts: 215
    edited 2010-07-15 16:38
    @Mike further proof something is wrong with my setup. My cards are both formatted FAT16 (I verified before replying) and have a volume size of less than 2GB (1.88GB). I can read/write fine from windows but no joy in situ.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-15 16:43
    @Mike,

    Thanks for bringing that to my attention.. I'll add updating the SD Trainer to my "to do" list.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • rokickirokicki Posts: 1,000
    edited 2010-07-15 18:52
    You say the raw reading/writing tests pass. Can you give the full test output?
    (From fsrw2.6, not from SDTrainer). Normally if raw read/write pass, then
    things should be connected okay.
  • soshimososhimo Posts: 215
    edited 2010-07-15 21:12
    @rokiki
    Yeah, I'm pretty sure I'm talking to the card. I was able to see some output but now the function I wrote to return the buffer is suspect. I'll be working on some more diagnostics using the low level block reading routines. I hope to post some data soon. Thanks!
  • soshimososhimo Posts: 215
    edited 2010-07-15 21:51
    Somehow both of my SD cards got corrupted but a quick format of both and all my problems finally went away. Thanks for everyones help!
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-07-15 23:23
    Second time this week that introducing a third card would have found the problem... Interesting.. [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Feature Projects: PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • soshimososhimo Posts: 215
    edited 2010-07-16 02:05
    @OBC I know, and I was about to head to the shack to buy a new one. I decided to give it one more sanity check and lo and behold, when I clicked on the drive in explorer it told me it wasn't formatted. Makes me wonder what I DID format those 20 odd times before tongue.gif
Sign In or Register to comment.