Errors finding any of the include files like "SPI.h"

Hi,

I do my first steps with VSCode, PlatformIO using the ESP32-IDF based on FreeRtos. I have successfully processed and uploaded the blink-example on my ESP32. Now I would like to proceed with programming a TFT-display. I found some example code and would like to compile it.

But I always get compilation errors finding any of the include files like “SPI.h”, <Adafruit_GFX.h> or <ILI9488.h> !!! I would like to use a core-directory in my privat area, not under default C:.… As I could check, libdeps-libraries are loaded correctly in my project directory. So I tried this as well as include_dir, but this didn’t help either. Any idea and help would be fine, thanks!

My platformio.ini and platformio-screenshot look like this:

[platformio]
default_envs = esp32dev
core_dir = D:\privat\privat\Projekte\esp\platformio
include_dir = D:\privat\privat\Projekte\esp\myESP\HomeCtrl01\.pio\libdeps\esp32dev
src_dir = D:\privat\privat\Projekte\esp\myESP\HomeCtrl01\src
libdeps_dir = D:\privat\privat\Projekte\esp\platformio

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espidf
upload_port = COM5
upload_speed = 115200
monitor_speed = 115200
build_flags = 
lib_deps = ESP32, Adafruit GFX Library, ILI9488, SPI, mbed-drivers

SPI is a built-in library, there’s no need to include it the lib_deps line as it doesn’t need to be installed, hence the error about it not being found.

Next thing to check would be what frameworks your libraries are compatible with (and if you’ve specified the right framework in the first place). i.e., you’ve specified the espidf framework, but the Adafruit GFX Library isn’t compatible with that framework! Is there a library named ESP32? ILI9488 is also Arduino only. And where is mbed-drivers coming from?

Have a look at your output again… you’ll notice it says ‘Found 0 compatible libraries’, and then ‘No dependencies’ … that is your first clue you’ve either specified incompatible libraries or frameworks. :wink:

Thanks alot for your remarks. I’m glad to get any input and support!

As you said, SPI is a built-in library. Therefor I removed all libraries in the lib_deps line at all. That is how I started my project weeks before. But I still get compilation errors, not finding “SPI.h”. Do I need to specify it somewhere else?

Ok, what would you suggest me to proceed for an operation of an ILI9488-TFT in combination with

  • platform = espressif32
  • board = esp32dev
  • framework = espidf

Is this combination unusual?
What does it mean, that the library ILI9488 is only usable by Arduino-framework?
I thought it is just C-code with an implementation of the TFT-protocoll based on some I/O-pins. What is specific to the Arduino-framework?
Do I need to modify the source-code to use it for my purpose?

I would like to use espidf-framework instead of Arduino because of the freeRTOS. My next step after understanding how to use the ILI9488 would be using a huge self-developed library, already in use under Windows and QNX-realtime-RTOS. It is based on “pthreads” and “ncurses”, which should be available under freeRTOS as well. Any comments?

There’s no SPI.h in the ESP-IDF framework, the API there works differently. As @pfeerick said it seems like you’re mixing up the frameworks (arduino, esp-idf) and also mixing in mbed-os drivers, which are totally not made for the ESP32.

The ILI9488 library you’ve pointed to uses the Arduino-specific SPI class, digitalWrite() and pinMode() APIs, have a look at the source

That particular library you’ve pointed PlatformIO to use is written against the Arduino framework. A quick search reveals another library (GitHub - jeremyjh/ESP32_TFT_library: Full featured TFT library for ESP32 with demo application) written against ESP-IDF v4 which supports your display controller. Refer to the documentation for intregration into a PlatformIO project.

Arduino has the exact same FreeRTOS functions available, just have a look at their main.cpp file (implements calling setup() and loop())

Note that if you absolutely must use ESP-IDF but still want to use Arduino libraries, there is the possibility of using ESP-IDF and the Arduino code as a component. See the official example.

I’d however suggest to use Arduino since your display driver is already there and easily integratable in a PlatformIO project by simply changing to framework = arduino and using only that library.

Well FreeRTOS doesn’t expose pthreads POSIX compliant APIs directly. So you should either call the APIs directly or have a look at this fancy phtreads/posix compatiblity layer by FreeRTOS. If you just need to call a few simple functions like thread creation or mutexes however, calling the FreeRTOS API directly should suffice and is much easier than compiling a compatibility layer.

And I only know ncurses as a library for text user interfaces on desktop machines, I’ve never seen that in embedded use o_O

1 Like

If I understand this right, the Arduino framework is also based on freeRTOS? So, I’m able to use all functions which freeRTOS offers ? I didn’t know this. Thought the only way to use freeRTOS is ESP-IDF. If so, then I can use Arduino framework as well.

Well FreeRTOS doesn’t expose pthreads POSIX compliant APIs directly. So you should either call the APIs directly or have a look at this fancy phtreads/posix compatiblity layer by FreeRTOS. If you just need to call a few simple functions like thread creation or mutexes however, calling the FreeRTOS API directly should suffice and is much easier than compiling a compatibility layer.

I have seen this fancy pthreads layer. You’re absolutely right, this would be an extra complexity. Maybe direct calls will work as well. Not sure yet. However I need thread, mutexes and timing functionality.

And I only know ncurses as a library for text user interfaces on desktop machines, I’ve never seen that in embedded use.

I would like to run a quicklook monitor on the target as part of the application. This is running at the time under Windows, QNX and as well on a Raspberry.