Bb_spi_lcd missing esp_psram.h

Hi all,

I’m working on a project with a CYD (ESP32 S3 + ILI9341) and using BitBank2 bb_spi_lcd library (GitHub - bitbank2/bb_spi_lcd: SPI LCD/OLED library which can be built for Arduino and Linux). I’m using Visual Studio Code as editor with PlatformIO extension.

Just for including the bb_spi_lcd.h I get always the same error:

.pio/libdeps/cheap_yellow/bb_spi_lcd/src/bb_spi_lcd.cpp:127:10: fatal error: esp_psram.h: No such file or directory

It seems it is unable to find esp_psram.h

That file is included with all Arduino IDE libraries and thou the same code complies without problem under Arduino IDE.

The curious thing is that I’ve had some other projects running with this library under PlatformIO with Visual Studio Code some time ago, so I suppose I has to be with any update.

Here it is my minimal platformio.ini

[env:cheap_yellow]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps = bitbank2/bb_spi_lcd @ ^2.9.7

And just this is the minimal code I’m using to try to determine the error.

#include <bb_spi_lcd.h>
BB_SPI_LCD lcd;
void setup() {
}
void loop() {
}

I’ve even tried to include (via includePath setting in Visual Studio Code) the Arduino15 directory where all Arduino IDE packages are installed:

~/Library/Arduino15/packages/** (under MacOS)

But no change.

Could anyone set some light on this? Any idea or something to try?

Thanks a lot all in advance

Regards,

Francis Perea

It might be possible that this header only exists in newer ESP-IDF versions (which is in turn used by newer Arduino-ESP32 core versions). The current version of platform-espressif32 still uses Arduino-ESP32 2.0.17.

To try compilation with Arduino-ESP32 3.x, use the pioarduino platform. For that, use a platformio.ini of e.g.

[env:cheap_yellow]
; has Arduino-ESP32 3.2.1
platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21/platform-espressif32.zip
board = esp32dev
framework = arduino
lib_deps = bitbank2/bb_spi_lcd @ ^2.9.7

Hi maxgerhardt,

Thanks a lot for your fast reply.

I’ve tried your suggestion and at least something changed.

Now I get a different error not finding the compiler:

sh: xtensa-esp32-elf-g++: command not found

I’ve tried to specify manually the compiler path through the compilerPath setting but of no help.

Any other suggestion?

This is beginning to make me crazy, too much days without being able to begin to work. Considering going back to Arduino IDE where it does compile and upload without any trouble.

I don’t really get the point of the error when it has been compiling on Visual Studio Code + PlatformIO before.

Thanks once again for your help.

What’s the full log of project task → Clean and project task → Build?

Also how do you have a ESP32S3 yet board = esp32dev is a regular ESP32?

Project Task Clean:

 *  Executing task: platformio run --target clean --environment cheap_yellow 

Processing cheap_yellow (platform: espressif32; board: esp32dev; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
idf_tools.py installation failed
Verbose mode can be enabled via `-v, --verbose` option
idf_tools.py installation failed
Removing .pio/build/cheap_yellow
Done cleaning
========================================================================== [SUCCESS] Took 0.44 seconds ==========================================================================
 *  Terminal will be reused by tasks, press any key to close it. 

Project Task Build:

Executing task: platformio run --environment cheap_yellow 

Processing cheap_yellow (platform: espressif32; board: esp32dev; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
idf_tools.py installation failed
idf_tools.py installation failed
Verbose mode can be enabled via `-v, --verbose` option
idf_tools.py installation failed
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (54.3.21) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.2.1 
 - framework-arduinoespressif32-libs @ 5.4.0+sha.858a988d6e 
 - tool-esptoolpy @ 5.0.0 
 - toolchain-xtensa-esp-elf @ 14.2.0+20241119
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 42 compatible libraries
Scanning dependencies...
Dependency Graph
|-- bb_spi_lcd @ 2.9.7
Building in release mode
Compiling .pio/build/cheap_yellow/lib0f1/SPI/SPI.cpp.o
sh: xtensa-esp32-elf-g++: command not found
Compiling .pio/build/cheap_yellow/liba28/Wire/Wire.cpp.o
*** [.pio/build/cheap_yellow/lib0f1/SPI/SPI.cpp.o] Error 127
sh: xtensa-esp32-elf-g++: command not found
*** [.pio/build/cheap_yellow/liba28/Wire/Wire.cpp.o] Error 127
=========================================================================== [FAILED] Took 1.06 seconds ===========================================================================

 *  The terminal process "platformio 'run', '--environment', 'cheap_yellow'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it.

It’s the board I use for all the project with this CYD, it works perfectly with all libraries, even with bb_spi_lcd some months ago.

I have several other projects with this board setting and this CYD without any problem.

Thanks once again for your help, sincerely.

Well that’s not good.

I just tried to compile the touch demo on Windows and it compiled perfectly fine.

Can you retry it with

platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.20/platform-espressif32.zip

which is a slightly older version but should still work?

Wow! Great maxgerhardt!

Now it compiles without errors after a first run with

platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.20/platform-espressif32.zip

Even if I go back to

platform = espressif32

Errors have disappeared

But sadly in any case the screen shows nothing. Totally black.

As I told before, just the same code compiled and uploaded under Arduino IDE runs perfectly.

And even under VSC + PlatformIO any other project I have (not using bb_spi_lcd but TFT_eSPI) do run without problems.

There must be something I am loosing…

Any other idea?

Thanks once again for all your efforts.

That’s because espressif32 now is that pioarduino’s version. It takes its place as the “highest installed platform version”. If you want to go back to PlatformIO’s (outdated) espressif32 version, you would have to specify them by version number, e.g., platform = espressif32@6.11.0.

  1. Did uploading work fine? If there’s still the issue of your board being an ESP32S3 while you have your platformio.ini set for a regular ESP32, then nothing should work
  2. What exact board are you uploading to? Any store link?
  3. Screenshot of your Arduino IDE → Tools menu with which it works?
  4. Any serial output? (project task → upload and monitor). This might need you to set the baud rate the firmware uses, e.g., monitor_speed = 115200 in the platformio.ini.

Hi again and again thanks for all your efforts.

  1. Yes, the uploading was all fine. I have just uploaded another project that uses TFT_eSPI instead of bb_spi_lcd with the same board esp32dev in platformio.ini and, as usual, works perfectly. I’m sure it is not an issue of the board.
  2. The exact board I^'0m using is a Cheap Yellow Display of type 2432S028R (Pantalla ESP32 de 2,8)

(I continue in a new post because I’m no allowed to send more than 1 link and 1 image, sorry)

I have also make some tests with another board of the same type but with 2 USB ports (ESP32 Arduino LVGL Placa de desarrollo WIFI y Bluetooth, pantalla de visualización inteligente de 2,8 pulgadas, 240x320, módulo LCD TFT de 2,8 pulgadas, con panel táctil - AliExpress 502) and the problem is exactly the same. Zero problems programming them under Arduino IDE. Under VSC + PlatformIO works perfectly with TFT_eSPI or LVGL for example but unable to make them run with bb_spi_lcd from VSC.
3. Here you have my code running under Arduino IDE and the result on board

  1. Nothing special, here you have the output of another demo that also runs without trouble when uploaded from Arduino IDE

I hope you can see anything I’m unable to.

Big Thanks, I don’t want to go back to Arduino IDE, VSC is much better for me to manage big projects, so I need to find the problem.

Regards,

Francis

In the Arduino IDE → Boards Manager, what version of esp32 is installed?

In the Arduino IDE → Library Manager, what version of bb_spi_lcd is installed?

The screenshot above seems to set DISPLAY_CYD_2USB.

The Aliexpress listing however shows an ILI9341 display… Which one is right?

Hi again maxgerhardt,

The versions installed in Arduino IDE are
esp32 version 2.0.18
bb_spi_lcd version 2.9.7

The screenshot I sent shows DISPLAY_CYD_2USB because I have 2 CYDs, one with 1 USB port (DISPLAY_CYD) and another with 2 USB ports (DISPLAY_CYD_2USB)

I’m making all kind of tests with both and the problem is always the same: I can program any of them under Arduino IDE with any library (TFT_eSPI or bb_spi_lcd) but under VSC + PIO (once you pointed out the change of platform) I can only get results with TFT_eSPI, if I use bb_spi_lcd it compiles and uploads but I only get a blank screen

Thank you very much once again. I won’t have any way of giving you back all your efforts.

Regards,

Francis

Are you sure? Can you show a screenshot? The Espressif core does not have 2.0.18. And the “Arduino ESP32 core” is not relevant because you don’t have an Arduino Nano ESP32.

Only esp32 by Espressif Systems matters.

THis is what I have installed under Arduino IDE:


Okay. So you have Arduino-ESP32 3.2.1 not 2.0.18.

Let’s exactly match that, this time fixing the previous IDF install error.

Can you:

  1. Set your platformio.ini as
[env:cheap_yellow]
; has Arduino-ESP32 3.2.1
platform = https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21/platform-espressif32.zip
board = esp32dev
framework = arduino
lib_deps = bitbank2/bb_spi_lcd @ 2.9.7
  1. Close VSCode
  2. Delete your entire ~/.platformio folder. If you have anything in there that you need backed up (old critical versions that aren’t published anymore or whatever), back them up. Otherwise, just rm -rf ~/.platformio
  3. Re-Open VSCode. Wait a bit to let it reinstall everything.

I then need you to test the same example code in the Arduino IDE and PlatformIO, with the same display type configured. Use an example code like https://github.com/bitbank2/bb_spi_lcd/tree/master/examples/cyd_gif_demo instead of your own (more complicated sketch). What exact display code and pins are you choosing? Is the result the same on the Arduino IDE and PlatformIO?

Hi Max, I’m Francis again, sorry but I had to create another account because of exceeding the maximum number of messages for my first day :sweat_smile:

Ok, I’ve just done it.

Once I set platform back to 54.03.21 y get this old error:

This error took me, after you pointed it out, to change platform to 54.03.20 that corrects it but gives a blank screen instead.

And, yes cyd_gif_demo is the example I’m using as a base, because it compiles great under Arduino IDE with both different CYDs I have.

Thanks for not letting me down.

Regards,

Francis