Micro SD card library

Is anyone working on a microSD/SD port?

:smile:

I started looking at it, and it was getting to be a lot of code. Now that Iā€™m developing locally it will be easier to play with by just including the libraries, and converting small parts. Mashing many headers and cpps all in one file gets to be a PITA so I gave up at the time. Also there was the SD library that comes with Arduino IDE I think, and another one SDFat ā€¦ was trying to figure out which one worked best first before I started. Any suggestions? Currently Iā€™m kinda busy with a few other things at the moment, so if anyone else is attempting/working on this, please donā€™t think Iā€™ll get it to by tomorrow :wink:

I am going to look at PJRCā€™s teensy 3 library. Paul is very good at producing great code. This is a work in progress so I have no expectation but obviously for graphics work, it would be handy. Though I love the cloud connection, sometime local logging is also good. :smile:

UPDATE: Teensy 3 has no specific microSD library, so SDfat and whatever else I can find it is then!

1 Like

https://code.google.com/p/sdfatlib/downloads/list

http://arduino.cc/en/Reference/SD

1 Like

Support for multiple files in the web IDE coming tomorrowā€¦ :wink:

4 Likes

I came.

(1234567890)

2 Likes

@peekay123 - did you get chance to look at this?

I started looking at the Arduino SD library. Was thinking about how we might chunk up the code using #defineā€™s and #if defined() to minimise the memory overhead. Most of the time you donā€™t need all of the functions available, and we could exclude a range of headers / functions when not needed.

The functions could be grouped into a couple of broad categories

  • utility
  • file i/o basic
  • file i/o full

or

  • utility
  • file i/o read
  • file i/o write

Any thoughts ?

Kitard, I have not got to it. I was busy on some other libraries and getting to know smartthings. I know BDub was also going to look at it. I agree that reducing the footprint is a good idea. I usually use microSD for two things. One is logging which needs minimal functionality and the other is for graphics apps to hold screens, fonts or whatever else, which needs more functions.

We could make an SD ā€œtinyā€ version and an SD ā€œfullā€ version using #defines. Tiny would be geared towards logging or simple apps where you only need to create/open/append/close a file and no directories or even formatting. Full would be, well, the entire library. Thoughts?

Tiny and full sounds like a good compromise. I need to set up a local dev. environment as the IDE wonā€™t allow me to manage the number and complexity of files for the SD libraries.

Have a week away with work - might try see if I can get to it this week as I doubt I will have much on in the evenings.

Kitard, I have the local environment setup but I need to setup a microSD project. Iā€™ll see if I canā€™t do a first pass compile to see where the code stands vis-a-vis the Spark environment. Have a good week! :smile:

Apologies for not being very active here when I have materials that may help. I got a port of an SD / microSD card library to work. I zipped it up and here is the link to the code: http://choosatron.com/files/firmware/SD.zip

I modified the library here: https://bitbucket.org/dinau/sdfatmaple-vld/wiki/Home

I did a quick messy job, trying to modify as little as possible. Do whatever youā€™d like with it, and hopefully share any updates!

Iā€™ve been building by checking out the firmware, common, and communication repos. For the sake of quick deving, I created a ā€˜libā€™ directory at the base of core-firmware, and put the SD folder in there. It has a build file already.

Hope this helps!

3 Likes

@choosatron I finally got around to trying out your port of the Maple/Arduino SD library and I got it compiling, then wired up an SD card directly to the core (no level shifting needed) and it worked perfectly straight away. Then I got to pulling a few of the better examples together for the Spark Core, and I cleaned up the library files a little further. I kind of left some of the commented out #includes there for historical purposesā€¦ but I was able to chop a few files away, and more of the defines and stuff.

I really like the way you included the files for the project as well, that works so much cleaner than what I was doing.

Would you mind if I put this up on github?

1 Like

BDub, I feel dumb. Iā€™ve been using choosatronā€™s library for a while now and really like it. I should have posted it on github myself and perhaps saved you some time, at least if you compile locally! :blush:

No worries. Did you edit his files at all? Yeah I think compiling locally is the only way to really go with this oneā€¦ there are too many files!

I did some cleanup but nothing major since it worked! At some point we will have to chose one good library. Perhaps we should poll to see if anyone else has something to contribute.

@Bdub Get it in a github! Lets get it clean and lean. Iā€™d love to get rid of as much historical stuff as possible, and not worry about it being super portable. At least for me, Iā€™m planning on having it be as slim as possible for working on the Spark Core.

1 Like

choosatron, I agree! I believe ALL Spark libraries should be specific to the Spark since there are not ā€œalikeā€ platforms anyway. :smile:

Good to know you guys will have a Micro SD card library up and running once I get to the point of needing one which may be soon.

RWB, you can see it coming, canā€™t you! Someone will develop a digole ā€œdrawBitmapFromSD()ā€ command! Itā€™s just a matter of time :wink:

Yea I could use it right now. I just tried to create 13 frame intro animation but there is not enough ram for it :smile: