Shop OBEX P1 Docs P2 Docs Learn Events
How can I read the contents of an SPI SD card reader? — Parallax Forums

How can I read the contents of an SPI SD card reader?

cbmeekscbmeeks Posts: 634
edited 2015-03-16 10:33 in Propeller 1
In Arduino land, it is trivial to read the contents of an SD card from an SPI device.

I assume the same is true for Propeller but I cannot seem to find out where/how. I'm probably looking in the wrong places.

Anyway, where can I get information on how to do this? I assume I would need to devote a cog for this. But, would I need another cog for the actual code? For example, would I need a cog for the SPI driver and another cog for the reading/writing to the SD?

Thanks.

Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2015-03-16 08:41
    Take a look at the OBEX,
    http://obex.parallax.com/projects/data-storage

    In particular, "FAT16 routines with secure digital card layer" by Tomas Rokicki and "FAT16/32 Full File System Driver" by Kwabena W. Agyeman are self-contained implementations.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2015-03-16 10:33
    First, please pick your poison: C/C++ or Spin.

    If Spin, the above two are excellent recommendations.

    If C/C++, you have 3 options that I'm familiar with (and likely more than I'm not or am forgetting about):

    1. The PropGCC & the Simple libraries comes with functions that follow the standard C functions, like fopen, fputc, etc. Initialize the SD card with sd_mount. See more info here.

    I'm a fan of C++, so the following are C++ options:
    2. libpropeller contains a port of Kwabena's (kae here on the forum) Spin code. You can find the header file here - just copy it into your project and reference it.
    3. PropWare has it's own classes. They are read-only at the moment, but I like them a lot (I might be a tad biased). Write functionality is coming very soon.
Sign In or Register to comment.