Shop OBEX P1 Docs P2 Docs Learn Events
SD card with driver fsrw26 — Parallax Forums

SD card with driver fsrw26

ayumeayume Posts: 19
edited 2012-03-03 16:02 in Propeller 1
hi guys,

this my first time accessing sd card with propeller. i was following tuturials in gadgetgangster http://www.gadgetgangster.com/tutorials/331, but the result is failed to mount.

i've checked my sd card connector, made a new connector from http://www.parallaxsemiconductor.com/an006 and still same.

now i use EMS SD card from Innovative Electronic, this is the schematic
ems.JPG


and use program test.spin from frsw26, the result is
Mount tests first
First mount.
Succeeded; stopping cog.
Second mount.
Succeeded.
Reading block 0 (should be a boot block)
Erroneously returned from start!
-255


i've already use SD card 1 gb, 2gb and SDHC 4gb and have same fail to maount
anyone can explain to me????
410 x 636 - 39K
636 x 410 - 35K
«1

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-09-28 04:49
    Is there any chance you could post a larger image of your schematic? Zooming in on it doesn't provide a clear image here.

    OBC
  • KyeKye Posts: 2,200
    edited 2011-09-28 05:57
    You don't need any buffer logic between the card and the propeller chip.
  • ayumeayume Posts: 19
    edited 2011-09-28 19:50
    ems.JPG

    EMS schematic
    i've try this schematic too but still fail to mount
    untitled.JPG

    please tell me which wrong....
    954 x 615 - 56K
    962 x 485 - 50K
  • KyeKye Posts: 2,200
    edited 2011-09-29 05:36
    Um, you'll need to post your complete setup in detail.Also, please use the driver that comes with the FAT16/FAT32 Documentation on the parallax Semiconductor webpage... It comes with an SD card profilier which will speed test your SD card. FSRW may not be able to use your SD card. Thanks,
  • rokickirokicki Posts: 1,000
    edited 2011-09-29 10:23
    Kye wrote: »
    Um, you'll need to post your complete setup in detail.Also, please use the driver that comes with the FAT16/FAT32 Documentation on the parallax Semiconductor webpage... It comes with an SD card profilier which will speed test your SD card. FSRW may not be able to use your SD card. Thanks,

    FSRW also comes with such a speed test (indeed that's what he is running), and I believe fsrw will work with at least as many cards as Kye's driver, and quite a bit faster, as well.

    I would not use any buffering circuitry at all; you can also skip all resistors for testing. Just a straight four-wire connection (along with power and ground of course.) This should work easily and be trouble-free. (When this works, I recommend adding the 10K pullups to help avoid floating inputs.)
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-09-29 14:29
    While both Tomas and Kye are listening in, I'd like to ask about the seek command.
    I don't quite understand the limitations in fsrw 2.6 as described:
    '   Seek.  Right now will only seek within the current cluster.
    '   Added for PrEdit so he can debug; do not use with files larger
    '   than one cluster (and make that cluster size 32K please.)
    '   Returns -1 on failure.  Make sure to check this return code!
    '   We only support reads right now (but writes won"t be too hard to
    '   add).
    pub seek(pos) | delta
       if (direntry or pos < 0 or pos > filesize)
    
    Could you explain more what that mean in terms of file size and card compatibility? Say the cluster size is 32k, does that mean it will only work with a file of size =<32 kbytes, or am I misunderstanding something basic? This would have to do with reading out the Nth entry in a file that has >N fixed field records. The workaround is to open the file for read and then read and throw out records out in turn up to N.

    Kye's does not mention any limitations, I think.
    PUB fileSeek(position) '' 25 Stack Longs
    '' ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    '' // Changes old the file position. Returns the new file position.
    
  • KyeKye Posts: 2,200
    edited 2011-09-29 15:27
    I guess. I think what you think is correct Tracey.

    @Rokicki - Yep, FSRW is like 4 to 8 times faster and much smaller. My driver is more about just supplying everything and the kitchen sink to the user than being lean and mean.
  • ayumeayume Posts: 19
    edited 2011-09-30 00:26
    I've already connect 4 wire (do, di, clk, cs) without R 10k plus power and ground. But still fail to unmount.

    With frsw2.6 driver, success just at 2nd mount with error -255
    With key driver, led 23 blink at 1Hz

    I'll use (really really) new sd card
    Is'nt any problem if I use micro sd with adapter?
  • RaymanRayman Posts: 14,844
    edited 2011-09-30 03:51
    You might want to make sure you don't have DI and DO reversed...
  • ayumeayume Posts: 19
    edited 2011-09-30 06:57
    Miso at sd card is do to p0 at propeller
    Mosi at sd card is di to p2 at propeller
    Right?

    Please, I still stuck in here...
  • RaymanRayman Posts: 14,844
    edited 2011-09-30 07:36
    I think that's right...
    My little bit of help is here:
    http://www.rayslogic.com/propeller/Programming/SD_Card/SD_Card.htm

    But, I have found you don't need the pull-up resistors...

    You do have to format the SD card a certain way, at least with older versions of FRSW.

    Also, make sure the pins you are using matches with the code.
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-09-30 08:25
    While both Tomas and Kye are listening in, I'd like to ask about the seek command.
    I don't quite understand the limitations in fsrw 2.6 as described:
    '   Seek.  Right now will only seek within the current cluster.
    '   Added for PrEdit so he can debug; do not use with files larger
    '   than one cluster (and make that cluster size 32K please.)
    '   Returns -1 on failure.  Make sure to check this return code!
    '   We only support reads right now (but writes won"t be too hard to
    '   add).
    pub seek(pos) | delta
       if (direntry or pos < 0 or pos > filesize)
    
    I think FSRW's seek will work for any position in the file, even though the comment says it has to be within the current cluster. The code appears to loop through the clusters if the seek point is not within the current cluster.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-09-30 09:12
    The fact that it succeeded on the first and second mount indicates that the connections are okay. But then it failed after
    Reading block 0 (should be a boot block)
    That could indicate something wrong with the card format, but the fact that you already tried it with several cards makes that less likely. I have found that fsrw works with practically all cards I have purchased new recently, usually 1GB or 2GB, or 4 or 8GB HCSD cards.

    Maybe there is a power glitch when it goes to read the block? It might help in that case to include a capacitor right across the power at the SD card, if one is not included already.

    The circuit you have is complicated, with the SN74LVC07 non-inverting buffer and all the resistors and connectors. If possible, try it with the simpler connections direct to the Prop and power supply as suggested by others above. Maybe there is a loose connection or delay in that extra circuitry.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-09-30 09:16
    ayume, I'm sorry I highjacked the substance or your topic a little bit to ask about the SEEK command.

    Dave, I do see that code that appears to be crossing cluster boundaries. And it only seems to throw the error if the position being requested is greater than filesize, without regard for clustersize. I'm just not sure how to test it to give it the most-likely-to-fail challenge. How many bytes are in a cluster anyway? Say a sector is 512 bytes, and a cluster is 32768, does that mean that a cluster is made up of 32768/512 = 64 sectors?

    Kye, I appreciate that your driver includes everything, and luckily I use BST so that it can pass up unused methods. Still, I'm after optimizing both footprint and speed, more specifically, low power, which is the other side of the same coin.
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-09-30 09:48
    Dave, I do see that code that appears to be crossing cluster boundaries. And it only seems to throw the error if the position being requested is greater than filesize, without regard for clustersize. I'm just not sure how to test it to give it the most-likely-to-fail challenge. How many bytes are in a cluster anyway? Say a sector is 512 bytes, and a cluster is 32768, does that mean that a cluster is made up of 32768/512 = 64 sectors?
    Yes, there are 64 sectors in a 32K cluster. I have used seek without any problems, but I don't know if I ever did a seek that was outside of the current cluster boundary. Normally, I use seek to rewind back to the beginning of a file, or skip to the end of a file. You could test it by writting a large file with a known pattern, and then perform random seeks and verify that the correct values are read.
  • rokickirokicki Posts: 1,000
    edited 2011-09-30 13:29
    Seek should work arbitrarily; that's an old comment that needs to be removed.

    On the problems you're seeing: I'm not exactly sure what's going on. You are able to
    mount the card (twice), but then read block is failing.

    Why don't you upload *all* of your code (use the make archive feature of the
    PropTool) and I'll test it on my system.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-09-30 17:02
    Thoma, Ah, legacy documentation! To be clear, does it now support files open for write or append as well as read? And cluster sizes other than 32k? Thank you for this object, by the way. It has really helped me and the people I work with, and I think it is fair to say it has been a big boost to the propeller all around.
  • ayumeayume Posts: 19
    edited 2011-09-30 18:20
    It's ok Tracy, never mind. I can also learn from your discuss.

    I've added a 10uF cap at the power, still error -255. I tried with 470uF cap, same. It has happened for all my card. I've reformatted all of them and no change.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-09-30 23:09
    ayume, Was that last test with the simple connection that you posted at the bottom of your post #4 above? The 10uF capacitor should go right next to the SD card socket between power and ground. Please also recheck all the connections so nothing is loose.

    Is it possible that you have a corrupted version of the archive and test program? Upload the firmware you are using here so someone else can check it.
  • ayumeayume Posts: 19
    edited 2011-10-01 01:02
    it's hard for upload my archive (failed when uploading)
    i get frsw26 driver at http://obex.parallax.com/objects/92/
    and key driver at http://www.parallaxsemiconductor.com/an006

    i didn't make any significant change
  • RaymanRayman Posts: 14,844
    edited 2011-10-01 08:09
    I'd suggest triple checking your setup. Make sure your clock settings match the code.
    Are you sure the Prop is working right? An easy way to make sure is try full-duplex serial communications back to the PC at 115200 baud.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-10-01 19:37
    Since you mentioned an adapter I presume you have wired an SD card to your prop. The wires should be short and the card needs a 10uf cap across the power and ground pins (3V3). You should have a 10K pullup on the -CS pin because it depends on what the driver actually does when inactive. There were issues with brands other than SanDisk previously, so this is a possibility too. Do you have anything else connected on the 4 I/O pins???
  • rokickirokicki Posts: 1,000
    edited 2011-10-03 11:19
    Ah, legacy documentation! To be clear, does it now support files open for write or append as well as read? And cluster sizes other than 32k? Thank you for this object, by the way. It has really helped me and the people I work with, and I think it is fair to say it has been a big boost to the propeller all around.

    Hey, that's hilarious! I'll have to use that, "legacy documentation". Almost sounds like a feature!

    Unfortunately, the seek support is for reading files only. Arbitrary cluster sizes are supported (but on the
    Prop, whether for my driver or Kye's, larger clusters are almost always better for several reasons.)

    Thanks for the kind words! I need to spend some time cleaning up those docs.

    Original poster: not sure why you can't upload. General guidance here includes: post a picture of your setup, and upload all code. How big is the archive you are trying to upload?
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-10-04 09:02
    Thanks Tomas,

    I attached a note (a "review") about this to the the fsrw OBEX listing, until such time as you are inclined to update it for such a small matter of legacy (hehe) wording in a comment. Those reviews seem to be the only place to add notes of that sort, in addition to pats on the back.
  • ayumeayume Posts: 19
    edited 2011-10-12 15:46
    Rayman wrote: »
    I'd suggest triple checking your setup. Make sure your clock settings match the code.
    Are you sure the Prop is working right? An easy way to make sure is try full-duplex serial communications back to the PC at 115200 baud.

    can you please explain to me more about full-duplex serial communications back to the PC?
    what should i do?
  • ayumeayume Posts: 19
    edited 2011-10-12 16:00
    Cluso99 wrote: »
    Since you mentioned an adapter I presume you have wired an SD card to your prop. The wires should be short and the card needs a 10uf cap across the power and ground pins (3V3). You should have a 10K pullup on the -CS pin because it depends on what the driver actually does when inactive. There were issues with brands other than SanDisk previously, so this is a possibility too. Do you have anything else connected on the 4 I/O pins???

    i just connect the 4I/O pins (DO, DI, SCK/CLK, CS) and a 10uF cap between the power and ground
    2011-10-12 19.03.26.jpg


    and the respond error is -255
    untitled.JPG


    but sometime -1
    untitled1.JPG


    any advice?
    461 x 517 - 137K
    796 x 685 - 82K
    738 x 657 - 69K
  • ayumeayume Posts: 19
    edited 2011-10-12 16:12
    rokicki wrote: »
    Original poster: not sure why you can't upload. General guidance here includes: post a picture of your setup, and upload all code. How big is the archive you are trying to upload?

    thank you for not giving up on me
    this are my archive (finally i can attach them :smile:)

    test - Archive [Date 2011.10.01 Time 05.14].rar
    test - Archive [Date 2011.10.12 Time 17.14].zip
  • RaymanRayman Posts: 14,844
    edited 2011-10-12 17:50
    ayume, Ok, I see you have a "demo" board and you're using a serial terminal, so I think your prop setup is fine.

    But, it appears to me that you have the SD wired up to the wrong pins!

    Your code indicates you are using P0..P3, but your photo looks like you're using P4..P7.

    You need to either change the code or your wiring...
  • ayumeayume Posts: 19
    edited 2011-10-12 22:53
    Rayman wrote: »
    ayume, Ok, I see you have a "demo" board and you're using a serial terminal, so I think your prop setup is fine.

    But, it appears to me that you have the SD wired up to the wrong pins!

    Your code indicates you are using P0..P3, but your photo looks like you're using P4..P7.

    You need to either change the code or your wiring...


    ya, when i try P4..P7 i changed the code become
    sd_DO = 4
    sd_CLK = 5
    sd_DI = 6
    sd_CS = 7

    but still error -255
  • RaymanRayman Posts: 14,844
    edited 2011-10-13 03:28
    look carefully at the picture and table on this page:

    http://www.rayslogic.com/propeller/Programming/SD_Card/SD_Card.htm

    about half way down, you'll see a blue SD card with the pin#s written on it.
    Below that is a table saying which pin goes to what Prop pin.
Sign In or Register to comment.