Shop OBEX P1 Docs P2 Docs Learn Events
Rokicki's SpiSD Question — Parallax Forums

Rokicki's SpiSD Question

bambinobambino Posts: 789
edited 2007-12-27 21:08 in Propeller 1
I have my SD socket hooked up, Card formatted FAT16, and I'm testing it with Rokicki's Driver from the ObEx.
I am useing the SpiSd driver(The slowest one wrote in spin).
The Checktime function times out and returns -41 error code everytime without fail.
I suspect my hardware because I have not modified the object, other than placing in debug lines to the driver, and the error -41 is present without them. Also, I did not have 20K pull-ups, I am using 22K.
Does anyone know from this, what part of my Hardware to suspect?
Could the 22K's be throwing me of that much?

Comments

  • RaymanRayman Posts: 14,162
    edited 2007-12-26 00:32
    I don't think it's the resistors. I use his "sdrw_test.spin" program to test new SD cards. If that fails I would check connections and make sure you changed the base pin to your setup.
  • bambinobambino Posts: 789
    edited 2007-12-26 01:32
    sdrw_test.spin is the one I am useing and I did change the base pin. I am useing 12..15.
    I have yet to hook up a scope to it, but I have checked to see that the pull-ups are working.
    3.2V on all pins except Grounds.
  • BTXBTX Posts: 674
    edited 2007-12-26 01:41
    Bambino.
    If you have a doubt about to change the base pin... I did it before, and I have the card working perfect... I also use 2x10KOhm in serial.
    But with 22K must work too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
  • RaymanRayman Posts: 14,162
    edited 2007-12-26 01:51
    Also, I would check the SD card again on a PC. I have had to reformat a couple times when I tried to use it with bad connections...
    Also, with it off, you can check continuity between prop pin and SD pin.
    Make sure you have the SD pins right... I have notes here:
    http://www.rayslogic.com/propeller/Programming/SD_Card/SD_Card.htm
  • bambinobambino Posts: 789
    edited 2007-12-26 04:04
    Thanks BTX, That's good to know.

    Thanks for the link Rayman, I will work more on it tomarrow. No good can come from my post christmas dinner state right now.
  • rokickirokicki Posts: 1,000
    edited 2007-12-26 17:51
    The -41 error is a general error for any sort of "didn't get the response I wanted in the time I expected".
    It could be caused by anything.

    The first thing I'd do is throw a scope on the SD pins and make sure you're seeing transitions on the
    clock pin. If you're seeing transitions on the clock pins, I'd then ensure you're seeing transitions on
    both DI and DO.

    Next, I'd make sure you have 3.3 and ground correctly at the SD interface. Maybe pop the card
    out and do a pairwise short check on the SD connections (with the board powered off of course).

    What socket are you using? Would you be willing to post a picture of the setup? To me this sounds
    *most* like a wiring issue.

    What SD card are you using? If it's larger than 2GB, it probably won't work (haven't tried any, but
    the new SDHC spec is not supported by the driver).

    Good luck!
  • bambinobambino Posts: 789
    edited 2007-12-26 17:59
    Thanks Rokicki,
    I agree with the wireing issue. I took a picture, but due to the spigette layout you can't decern much.
    Let me get a scope on it. Your plan of attack sounds good.
  • bambinobambino Posts: 789
    edited 2007-12-26 18:18
    CS = functioning
    Data in = Short burst of data(almost looks like its sending $FF every byte)
    Data out = nothing
    Clk line = see image below

    Dmm checks out. no shorts opens. No resistors touching each other.
    Unless you see something, I am just going to tear it apart and rewire with shortened leads on the resistors.
    640 x 480 - 145K
    640 x 480 - 174K
  • RaymanRayman Posts: 14,162
    edited 2007-12-26 18:32
    That's a pretty fuzzy pic!· Are·those series resistors between Prop SD pins and the SD card?· It should just be straight wire connections...
  • bambinobambino Posts: 789
    edited 2007-12-26 18:35
    Yes, 150 ohm series on the clk,di,do,cs.
  • RaymanRayman Posts: 14,162
    edited 2007-12-26 18:38
    That may be the trouble... Try just using straight wires...
  • RaymanRayman Posts: 14,162
    edited 2007-12-26 18:40
    Also, be careful with that kind of SD case... If you stick pins up in it like I did, there'a good chance things can short out once the SD card is inserted...
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2007-12-26 18:45
    Double check yourself against the diagram in the Propeller Cookbook (link below) I have built several SD adapters now without the pullup resistors and have had no problems with them.··· There's a pic of the socket in the reference.

    Let us know when you get it working.. SD is one of the finer addons. [noparse]:)[/noparse]

    OBC



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook
    Got an SD card? - PropDOS
    A Living Propeller FAQ - The Propeller Wiki
    (Got the Knowledge? Got a Moment? Add something today!)

  • bambinobambino Posts: 789
    edited 2007-12-26 18:50
    Still an error -41.
    I'm going to reformat, and then see.
  • BTXBTX Posts: 674
    edited 2007-12-26 18:58
    How many pull ups resistors do you have ...I can only see "five"....and must be "six"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
  • bambinobambino Posts: 789
    edited 2007-12-26 19:05
    Yes it is a bad picture, but there are 6 pull-ups.
    The card is doing something though. I turned the volts/Div up and got the picture below.
    640 x 480 - 158K
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2007-12-26 19:14
    Hello,

    What kind of socket are you using for the SD card? I had some of the same issues you are having and the problem ended up being the SparkFun breakboard board for the SD card. It was defective and must have had at least one open connection. Luckily I had purchased a spare and that second one worked ok.

    Good luck,

    Robert
  • bambinobambino Posts: 789
    edited 2007-12-26 19:24
    Through very scientific forensic analysis, I have confirmed Robert as the winner!
    By pulling the SD card out of the bread board, all pins but one(Data_In), Jumped out of the Socket, telling on the uncooperative pin.

    Thanks for all your help guys. I have one molex socket left and I thinke I'll just go ahead and make a breakout board for it, instead of a breadboard model.

    Thanks Rayman for the idea though!·I'm sure it works, just not when I'm in control of the soldiering iron.

    Apparently, the card was not getting the data in signal!!!!!!!!!!!!!!!!
    640 x 480 - 149K
  • rokickirokicki Posts: 1,000
    edited 2007-12-26 19:39
    Great job!

    On the pullups, you may be able to get away without *any* pullups; I know of many people running that way quite happily.
    The spec says use pullups, but the pullups are there for multi-card setups and for insertion/ejection and if you don't do
    either then you might not need them at all. I will not make any statement on this, though; you will need to read the spec
    and make your own judgement based on how you intend to use them.

    The series resistors should *not* be used in any high-speed mode; they are good to protect your setup against wiring
    errors with a low-speed mode, but if you plan to run with the faster assembly drivers you should not use series resistors.
    (The RC time constant starts creeping too high.)

    Too bad about those breakout boards.
  • bambinobambino Posts: 789
    edited 2007-12-26 19:46
    Thanks Rokicki.
    What do you mean by insertion/ejection? Are you saying that they are not needed as long as I don;t hotswap the cards?

    The Sd Sockets? No big deal(Samples)! I knew I was going to make a breakout board with one, so I was using this one to prototype with on a bread board.
  • RaymanRayman Posts: 14,162
    edited 2007-12-26 19:47
    I'm starting to think the easiest thing is to get a uSD card (w/ SD adapter) and solder right onto the adapter. I haven't actually tried this yet, but will soon!
  • bambinobambino Posts: 789
    edited 2007-12-26 19:51
    I guess if a guy where deperate he could embedd the card right into his app, with out the adapter!
  • rokickirokicki Posts: 1,000
    edited 2007-12-26 20:40
    By insertion/ejection I mean removing or inserting an SD card while the whole system is powered up.
    (Without pullups, the SD and/or host device will likely see transitions on those lines that it may or may
    not be happy with; also in general unconnected inputs to CMOS processes should be tied high or low to
    prevent spurious power consumption by the input buffers).

    As I said, I'm not going to judge whether you can omit the pullups for any particular use or device.
    You can find the spec (start by using Wikipedia) and only you know how you will use it. I will say that
    some people are quite happily omitting the pullups and I will also say that I can certainly envision
    scenarios in which the pullups might not be needed. It's your call on that.

    As for the "easiest" way: I still like the sparkfun breakouts (one has to wonder though about the
    failures that have been reported). The slightly larger card available for the Prop (Spin Studio?) also
    works well. I find any time I have to hack something together (like using a microSD adaptor and
    soldering onto the SD pads) I botch it up. You guys may well be more skilled than I am.
  • bambinobambino Posts: 789
    edited 2007-12-26 20:46
    Thanks again,
    This is a roll my own job, so I may try it that way. The only project of mine on the floor for possible resale uses a prebuilt sd setup on the back of an LCD. They are great, but too pricey for my own use.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2007-12-27 01:58
    I haven't been able to hot-swap my SD cards with either of my adapters, (with or without resistors) as for
    experiences with various SD cards, I also had a bad adapter from Sparkfun, (one worked, one didn't) and
    have found a preference to either obtaining one of Brian's SpinStudio boards, or building my own from an
    SD adapter and a piece of perf board. If you bend the legs of the two smallest pins out just a little, and
    apply a dab of solder to each hole before soldering the adapter, the adapter solders perfectly, just heating
    up each pin and pushing them down.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook
    Got an SD card? - PropDOS
    A Living Propeller FAQ - The Propeller Wiki
    (Got the Knowledge? Got a Moment? Add something today!)

  • bambinobambino Posts: 789
    edited 2007-12-27 02:41
    I have some perf board, but I also have a piece of left over copper clad board that would be just enough to make a breakout board. Something about etchant solution and the smell of alcohol that keeps the kids out of my shop for a while.
    I had a bad feeling about soldiering that molex to that modified 20 pin connector, but it looked really neat if I could pull it off.
    I pulled it off allright!
  • rokickirokicki Posts: 1,000
    edited 2007-12-27 18:57
    I've never had problems hot-swapping on my demo board with the pullups. Of course if you hot-swap
    you need to reset the new card on the swap (and there's no magic way to detect the swap at the moment;
    you'd need to wire up a card detect pin most likely). What problems have you seen with hot swapping?
  • bambinobambino Posts: 789
    edited 2007-12-27 21:08
    This is my first experience with your object. My other SD is installed to the back of a ezLCD-004, and I'm using a uart interface with it. It has the option of useing the SD card direct, but for now I'm not useing it. Even with all they put into the ezlcd, it doesn't know if a card is present or not. If you write to it without a card, sometimes the screen will freeze. In the future, once I have a better understanding of the SD card in general, I will hook to the SD spi interface so my program can continue to run while the SD is perfoming a function.
Sign In or Register to comment.