Shop OBEX P1 Docs P2 Docs Learn Events
Assembly-less SD card reader? — Parallax Forums

Assembly-less SD card reader?

RaymanRayman Posts: 14,665
edited 2013-03-29 11:03 in Propeller 1
Is there a built-in way to get SD card access without using a cog for a driver?

I'd like to read from SD with my DE0-nano P2 emulator, but only have one cog...

I found the FSRW C source code, but that was only for frsw.spin, not for the block driver...

Or, does anybody know of a SPIN only SD card code (without assembly driver)?

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-29 07:21
    If we say it can't be done, maybe Parallax will send you a DE2-115 board. :-)
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-03-29 07:40
    David Betz wrote: »
    If we say it can't be done, maybe Parallax will send you a DE2-115 board. :-)

    It can't be done with my DE0, either!! :0)
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-29 07:49
    Rayman wrote: »
    Is there a built-in way to get SD card access without using a cog for a driver?

    I'd like to read from SD with my DE0-nano P2 emulator, but only have one cog...

    I found the FSRW C source code, but that was only for frsw.spin, not for the block driver...

    Or, does anybody know of a SPIN only SD card code (without assembly driver)?

    I guess I should have given you a real answer. No, there is no way currently to access an SD card using a single COG. It would, of course, be possible. You'd probably have to use -mxmmc and put your low-level block code in HUBTEXT.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-03-29 07:53
    David Betz wrote: »
    I guess I should have given you a real answer. No, there is no way currently to access an SD card using a single COG. It would, of course, be possible. You'd probably have to use -mxmmc and put your low-level block code in HUBTEXT.
    Ugh. I just realized my suggestion was bogus on a number of counts. First, it isn't possible to use XMM mode on P2 yet. Second, if it was possible, it wouldn't work on the DE0-Nano since XMM requires a separate COG to manage the external memory. Third, there is only 32k of hub memory on the DE0-Nano so i don't imagine filesystem code will fit even if you use CMM mode although I might be wrong about that.
  • jazzedjazzed Posts: 11,803
    edited 2013-03-29 08:51
    The sdspiasm.spin code in FSRW can be replaced with sdspi.spin.

    If you want an ASM-less SD card driver, you should be able to replace the file system device _FileDriver with your new version _FileDriver2 in the driver list. Copy the existing lib files to make a new library, change them and replace the driver.

    Look for _FileDriver (add _FileDriver2) and mount here:
    https://code.google.com/p/propgcc/source/browse/lib/drivers/FileDriver.c?name=p2test

    There are more files to consider, but you would end up replacing this: https://code.google.com/p/propgcc/source/browse/lib/drivers/load_sd_driver.c?name=p2test

    I wish the package was a simple library, but as is it's woven into the stdio library fabric. Fortunately Eric gave us a reasonable way (reasonable to me at least) for replacing stdio devices.
  • RaymanRayman Posts: 14,665
    edited 2013-03-29 11:03
    I found sdspi.spin in my 2007 version of FSRW... is there a newer one?

    That might work with spin2cpp... guessing it can't do SDHC, but that's OK for now...
Sign In or Register to comment.