Shop OBEX P1 Docs P2 Docs Learn Events
SD loader — Parallax Forums

SD loader

Filip SFilip S Posts: 54
edited 2007-06-19 12:17 in Propeller 1
Hello everyone

I wonder if there is anyone who has made an object to load a pre-compilied eeprom-file from an SD card to the propeller and then run it. Otherwise a fat-filesystem reader in assembler could be rewritten to do this. I'm doing a project with the propeller that could really use this function.

Thanks
Filip

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my game page: http://fgames.110mb.com

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-06-16 19:12
    Yes this has been done, several people have worked in conjuction to get the peices together. Mike Green's OS has the functionality, if you want a relatively stripped down example of its use look for my kiosk.zip in this thread: http://forums.parallax.com/showthread.php?p=643397

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Mike CookMike Cook Posts: 829
    edited 2007-06-16 19:30
    Here's a stripped down boot loader, that I use. Loads a *.binary from a SD card, file name·that is loaded is TEST.BIN

    SD card is installed on PINs: 0..3 and uses the TV-Text object, on pins 12..15, to display errors. Should be enough comments in the 'top' file to get you going.

    Most/All of the work is biased on Mike Green's & Tom Rokicki's efforts with FemtoBasic & fsrw-and-friends programs.

    Have fun, if it's not useful to you please delete!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-06-16 20:09
    An even simpler example, thanks Mike.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Filip SFilip S Posts: 54
    edited 2007-06-17 08:34
    Thanks Mike.

    It'll surley be very usefull for the project I'm working on right now. It's a propeller based thing with a built-in keyboard and a small serial display. I've only got one or two EEPROM-packs, and soon I'll have more than two applications for it. So a SD with all the apps will come very handy.

    I haven't been able to try it yet, the link doesn't work right now, trying again soon.

    Filip

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my game page: http://fgames.110mb.com
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-06-17 08:50
    Flip, make sure you are choosing the save option rather than open, Internet Explored has difficulty opening zip files located in your temporary file area.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Filip SFilip S Posts: 54
    edited 2007-06-18 07:17
    I know, but i got error 404 when I clicked the link. But now it works.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my game page: http://fgames.110mb.com
  • Filip SFilip S Posts: 54
    edited 2007-06-18 07:52
    Thanks again mike. This seems exactly what I wanted! It also works perfectly on my demoboard! I'm going to do a simple UI to it so that it's easier to select among more files.
    But I've got a small problem, the card doesn't mount correctly (on my hommade board). I've hooked the card up to pins 19-22 with 10K resistors (i've tried with 20K too) and I get the error -972, wich is the negative pointer to the string "InitSDCard mount". I've changed pin numbers in the code too.

    Filip

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my game page: http://fgames.110mb.com

    Post Edited (Filip S) : 6/18/2007 9:46:01 AM GMT
  • Mike CookMike Cook Posts: 829
    edited 2007-06-18 10:58
    Filip,

    You might try downloading FemtoBasic from the Propeller Object exchange and try that on your home made board. The 'boot loader' I made is basically that, I·just pulled out what I did not need as a base for a new file.

    However I would suspect that the SD pins will need to be groups of 4 (at multiples of 4), such as:

    0..3
    4..7
    8..11
    12..15
    16..19
    20..23
    24..27

    I have not tested it with the SD mounted on other sets of PINs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike
  • Filip SFilip S Posts: 54
    edited 2007-06-18 11:04
    I tried to move the pins on my demo-board to 1..4 and tested. That worked anyway.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my game page: http://fgames.110mb.com
  • Filip SFilip S Posts: 54
    edited 2007-06-18 12:30
    No, I tried, it isn't any difference. Is there any importance about 10 or 20 K pullup resistors?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my game page: http://fgames.110mb.com
  • Mike CookMike Cook Posts: 829
    edited 2007-06-18 12:36
    Not sure, I've always used 20K, there might be some more·info here:

    http://forums.parallax.com/showthread.php?p=622673

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike
  • Filip SFilip S Posts: 54
    edited 2007-06-18 12:43
    When i wired the sd-card to my Demo Board i used 10K, because I didn't have any 20K at home, it works very well, but when I build this one I bought 20K, because the documentation says so. But now I tried with 10K on this board too.

    Filip

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my game page: http://fgames.110mb.com
  • Mike CookMike Cook Posts: 829
    edited 2007-06-18 13:06
    If your using the same SD card between both the Demo Board (Working - SD card installed on 0..3) and Home made board (not-Working - SD card installed on 19..22), Then the next step in debugging this is to go grab FemtoBasic from the object exchange. Get that working as-is with out any modifications. Then try moving the SD interface to pins 19..22. If FemtoBasic works on pins 19.22 then it's quite possible I left something out that's causing the problem. When I originally modified FemtoBasic to be just a 'boot loader' it worked so I left the SD interface on pins 0..3

    In the above archive, only the 'Top file' was modified, objects:

    fsrwFemto.spin

    sdspiFemto.spin

    TV-Text.spin

    TV.spin

    were left in their original state.

    This basically was a test, next step in it's evolution is to rip out the TV object, replace it with the serial object, so I can connect it to a PC running a terminal program. Then add the Xmodem protocol so I can up/download files to the 'boot loader' via a serial connection. This is a future wireless project, PC terminal will be replaced with some type of wireless technology, probably a GSM/GPRS modem or Xbee.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mike

    Post Edited (Mike Cook) : 6/18/2007 1:16:02 PM GMT
  • Filip SFilip S Posts: 54
    edited 2007-06-18 13:13
    I might was unclear, I used YOUR code to interface a SD on pins 1..4, not FemtoBasic. Anyway, I can't run FemtoBasic on my own board, because I haven't got a TV or VGA-connector to it, it's a serial display called microOLED.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my game page: http://fgames.110mb.com
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-18 14:33
    Filip,
    FemtoBasic is pretty flexible in terms of a display. There is a variation (also in the Object Exchange) called BoeBotBasic that uses a serial port for the "console" and will even work with the programming port and your PC.
  • Filip SFilip S Posts: 54
    edited 2007-06-18 20:52
    Now i've tried BoeBot basic and changed the pins. It says can't mount SD-card. I noted a difference in time between having the wrong pin-numbers and the right pin numbers. I think that means that it does something anyway.
    Is there anyway of getting more specific error messages out of BoeBotBasic?(not just Can't mount SD-card, it also says a possible reason why it can't)
    Is there an easy way to see wich pin(s) are wrong (I assume there is a hardware error, even if I can't find it, even if i've searched for it)

    Filip

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my game page: http://fgames.110mb.com

    Post Edited (Filip S) : 6/18/2007 9:01:43 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-18 21:03
    Unfortunately, the routine in BoeBotBasic doesn't have much information about why the failure occurred. When I was debugging the SD card support, I inserted debugging statements directly into the SD support routines supplied by Rokicki and that helped somewhat. The low level routines are in assembly and don't have much information to report ... either the data comes in or it doesn't. I'd carefully check your wiring. Occasionally I would wire up an SD card backwards and it wouldn't work.
  • rokickirokicki Posts: 1,000
    edited 2007-06-18 21:24
    Actually, I did make the routines generate very specific return codes that indicate specifically what went wrong.
    Just grep abort *.spin and you'll see the codes. For debugging, you should definitely just use sdspi.spin (the
    spin versions) and not the assembly versions since they do have more information available. If you get a
    mount failure in BoeBASIC it should report the error code which you can look up in the source. If you need to
    you can add that code (it should be pretty easy to do; just look for backslashes; those are where the abort
    codes are being collected.)

    On the other hand, if the initialization sequence isn't even working (that is, the wires are not hooked up right)
    then you'll essentially get no response from the card at all which is just a timeout condition on waiting for a
    response, and this is very tough to debug from the software end. Here there's not much more you can do
    than verifying the connections and/or slapping a scope on the pins. Just run mount in a loop and start looking
    at the wires and check the responses.

    Post Edited (rokicki) : 6/18/2007 9:28:48 PM GMT
  • Filip SFilip S Posts: 54
    edited 2007-06-19 08:14
    Now I hooked up my old SD-connector (on the demo board) with wires to my new board, that did work with rokiki's FSRW(the card got mounted, but i couldn't use nextfile), but not with BoeBotBasic or Mike's modified version of it. Strange.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my game page: http://fgames.110mb.com
  • Filip SFilip S Posts: 54
    edited 2007-06-19 12:17
    Now I finally got it working, Thanks everyone!

    I found out that it was my SD-reader holder·that was bad. I'm trying to fix it.

    Filip

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my game page: http://fgames.110mb.com

    Post Edited (Filip S) : 6/19/2007 12:24:00 PM GMT
Sign In or Register to comment.