Trouble Getting SparkCore-SD Library to Work on SparkDev IDE

I’ve been using the SparkDev IDE for my project with moderate success so far, but recently ran into some trouble trying to interface with my microSD card. I tried using several different SD card libraries, including SparkCore-SD library (https://github.com/technobly/SparkCore-SD), but have not been able to get any of them to work. When I try to run the example programs I get told that the compiler has either timed out or got an error (but it won’t say what the error is).

My approach so far has been to take all of the library files and put them into the same folder as my main .ino file. That doesn’t work, but when I read all of the forum posts about this library it seems that people are having no problem at all getting it working. Is there something I am missing that needs to be done in order to get the library to work?

In other cases it has proven useful to post a screenshot of your Spark Dev window with the open project/main file, to exclude some common mistakes.

2 Likes

Okay, here is a screenshot of my SparkDev window, I’ve highlighted the error messages with a red box. At the bottom it says “Compiler timed out or encountered an error”, but if I click on that then it says “There were no compile errors” at the top.

@TDeVries, put all the files in a single directory, removing the sub-directories and give it another shot. :smile:

No luck :confused:

I’m wondering, is application.h included in the build by default, or am I missing a file?

Not sure, but try to avoid extra long paths and don’t use blanks in your path.

You could also try building with CLI, maybe this way you might get more info about the reason for your problem.

What version of Spark Dev are you on?
I’m on 0.0.19 due to some issues of 0.0.20 with my Win8.1 tablet, and when building with a path containing a blank, nothing happens what-so-ever.

@TDeVries, @ScruffR, I’ll give it a shot on my PC and see what I get.

@TDeVries, there are multiple errors in the files where “application.h” is referred to as “Application.h”. Also other library files use the < > references instead of double quotes. You will need to go through all the files to fix those items and it should then compile.

1 Like

@TDeVries, changing all the #include <Application.h> to #include “application.h” and changing the < > to " " on other #includes fixed the compile problem. The code was originally written for a local toolchain since it did not compile in the cloud so well. So much has changed since! I will chat with @BDub to discuss updating his repo. :smile:

Well, the good news is that it compiled as you said it would! :smile:

The bad news is that now I get an undefined error when trying to flash to the core. Also happens when trying to load any of my old programs that used to work. :unamused:

@TDeVries, are you flashing via USB or OTA?

I’m using USB.

I just did a factory reset and that fixed the “undefined” error. Then re-uploaded the SD program and it seems like its worked!

And then I tried to modify the program and re-upload again and it reverted back to the “undefined” error…

If you look in Spark Build Libraries, you’ll find an SD-CARD-LIBRARY that was forked from mine, and cleaned up a bit to compile in the Web IDE:
https://build.spark.io/libs/5390c81bace60bab1a000d11/tab/Spark-CardInfo.cpp

1 Like

Thanks BDub. Tried the new library and it also compiles nicely, although I’m still having problems with flashing to the core. Now even the factory reset won’t fix it. The firmware tries to load on to the Core but the lights never change to magenta.

@TDeVries, what happens when you use USB to flash?

I’m getting the same error in the IDE, but it compiles fine when I use the CLI to compile in the cloud. I’ve actually found that I prefer that workflow for two reasons:

  1. I can compile, flash, and monitor serial all from one shell script.
  2. Compile errors are shown in all their glory, instead of being truncated by the IDE :smile:

@rsteckler, when I’m not compiling locally to use the new HAL, I prefer the CLI as well :grinning: