Libraries just stopped working completely

Hey all,

I worked on a project in Workbench for a Photon, added a few libraries through the installer (Adafruit_SPI, Adafruit_ILI9341, and Adafruit_mfGFX) and it was all working fine. The next step in my project was to get the SD slot in my tft screen working. Unfortunately when I decided to add a few more libraries, all went downhill. I added two libraries through the library installer: SdFat and Adafruit_ImageReader and added one manually as it was unknown by particle library search: Adafruit_SPIFlash. Shit hit the fan from there.

  • Some libraries included libraries that could not be found like Adafruit_SPITFT.h
  • The new libraries did not work well with the mfGFX and requested the GFX or something
  • Weird enough, a few libraries appeared in my lib folder, which I did not install myself. I guess those are required and installed automatically together with the libraries I did install myself? Please, correct me if I am wrong.
  • The cause that made me stop my efforts to fix all errors, was that not a single library was working anymore. Not even the ones I used when it was working just fine.

Now I am completely lost as my program and project folder are completely restored as it was right before the flood of errors, but still none of the three original libraries work.

Such unpredictable and unexplainable issues were never there with the Particle Dev. I don’t mean to come across judgemental but why was the support for the Particle Dev discontinued when it was working fine? VS Code probably has a lot more functionality and might be better for seasoned programmers, but also can be quite complex. The Particle Dev was working fine for me and it was easier and better understandable for a novice user, like me.

I hope my library issue can be fixed.


cannot open source file "SPI.h"
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\\\\Particle\projects\DUETEST\src\DUETEST.ino).
cannot open source file "WProgram.h" (dependency of "Adafruit_ILI9341.h")
cannot open source file "Particle.h" (dependency of "Adafruit_mfGFX.h")

You cannot just add some arbitrary library that hasn’t been properly ported to the Particle platform.
SPI.h and WProgram.h are not part of the Particle build path.

That is correct. You can look in the files of the libraries you installed and will probably find some dependencies entries that will refer to the “unexpected” libraries.

1 Like

Okay, I do understand that, but that library is gone again so it should not interfere anymore right? The libraries still aint working.

SPI.h was included in my .ino when it was working fine, so that is something i do not understand. Would my program have worked without the SPI.h, too?

Yes, the SPI object is already part of the framework (included via Particle.h) and doesn’t need a dedicated include statement.

There might still be some traces of that library in some “unexpected” locations (e.g. in the target folder).
The safest would be to start a completely new project, copy over your own source files and (re)add the known-to-be-good libraries.

1 Like


Will do. I’ll get back to you if it works again.

Another question: how will I be able to get my SD card slot working without that SPIFlash library? Is that also one that is unneccessary?


Created new project and installed the ILI9341 (the mfGFX) was installed automatically. It compiles and flashed but keeps giving these errors

#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\Users\Thoma\Documents\Particle\projects\USER_INTERFACE\src\USER_INTERFACE.ino).
cannot open source file "Adafruit_ILI9341.h"
cannot open source file "Adafruit_mfGFX.h"

There is a well tested library called SDFat

Can you try a cloud build?
What device OS version are you targeting?

1 Like

Is that enough? I followed some tutorials that include both the SDFat and the SPIFlash. I’ll try without.

How do I do a cloud build on the workbench? Sorry for my rookie level! EDIT: nevermind, I found it
I am tagetting OS version 1.4.4

it compiles fine

Somehow the errors disappeared… so that issue is gone, now the next

tried a few examples from the SdFat library but I cannot seem to get a single one to work. The SD card cannot be initialised and I cannot get around it. I’ve read countles other topics on the same issue but none of them regard a similar setup like I have: the Photon with an SD card slot as part of the tft screen.

I have the feeling it is in my hardware as I am quite confident that I made no mistakes in my code, I even used all the examples without editing them. Would you be willing to help me once more?

The CS pin from the display is wired to the D2 pin on the photon.

Piece of my code from the setup:

pinMode(TFT_CS, OUTPUT);
  digitalWrite(TFT_CS, HIGH);

  tft.setCursor(10, 50);
  tft.print("Initializing SD card...");
if (!SD.begin(TFT_CS)) 

The display and the SD card don’t share one CS pin.
You need to wire the SD card’s CS to a separate pin and tell the SDFat library which one you chose.

If you could state the exact board type we might be able to advise more specific.

e.g. this board

has a CS pin (for the TFT) and a Card CS (for the SD card) and these mustnot be tied to the same GPIO on the controler


1 Like

QVGA 2.2 tft spi sd 320X240 display (no touch). I shoud’ve checked the back screen earlier. I hooked it up and often times checked the wiring on the 9 pins that I am using, but never checked what the pins were on the other side. I immediately assumed those 5 pins were duplicates, like my nokia 5110 screen has duplicates.

Sometimes I stare at an issue for so long, it clouds my judgement to the point where I lost all focus. Thanks a bunch for your help!

I am going to put some effort in wiring the dedicated SD card pins. I have the display woking on the DIGITAL SPI pins of the Photon, can I use the ANALOG side SPI pins for wiring the SD card? Or do I need another apprach?

The back side:

On Particle devices the analog pins can always used as digital pins too.

So I wired everything for the SD card and it initializes fine now!

Thanks a lot for all your help, you are a lifesaver!

1 Like