ESP32-S3 compilation issue with GFX Library

Hello. I am trying to use GFX library with MaTouch ESP32-S3 2.1Inch circular display but I can’t get GFX library to compile with platform io.
There was a very similar problem for this user that fixed the issue for him but when I tried to fix my issue like they did. It did not work. And I’m a bit too deep in the water here with this.

Platform.ini is working with normal code but when I try to add GFX library stuff it’s not working.

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
lib_deps = 
	adafruit/Adafruit seesaw Library@^1.7.9
	adafruit/Adafruit MCP23017 Arduino Library@^2.3.2
	lvgl/lvgl@^9.2.2
	moononournation/GFX Library for Arduino@^1.5.3

Arduino imports:

#include <Arduino.h>
#include <String.h>
#include <lvgl.h>
#include <GUI/ui.h>
#include <Arduino_GFX_Library.h>

#include <HardwareSerial.h>
#include <HWCDC.h>

Only GFX code that I added:

Arduino_DataBus *bus = new Arduino_SWSPI(
    GFX_NOT_DEFINED /* DC */, 1 /* CS */,
    46 /* SCK */, 0 /* MOSI */, GFX_NOT_DEFINED /* MISO */);
    

Arduino_ESP32RGBPanel *rgbpanel = new Arduino_ESP32RGBPanel(
    2 /* DE */, 42 /* VSYNC */, 3 /* HSYNC */, 45 /* PCLK */,
    4 /* B0 */, 41 /* B1 */, 5 /* B2 */, 40 /* B3 */, 6 /* B4 */,
    39 /* G0 */, 7 /* G1 */, 47 /* G2 */, 8 /* G3 */, 48 /* G4 */, 9 /* G5 */,
    11 /* R0 */, 15 /* R1 */, 12 /* R2 */, 16 /* R3 */, 21 /* R4 */,
    1 /* hsync_polarity */, 10 /* hsync_front_porch */, 8 /* hsync_pulse_width */, 50 /* hsync_back_porch */,
    1 /* vsync_polarity */, 10 /* vsync_front_porch */, 8 /* vsync_pulse_width */, 20 /* vsync_back_porch */);

Arduino_RGB_Display *gfx = new Arduino_RGB_Display(
    480 /* width */, 480 /* height */, rgbpanel, 0 /* rotation */, true /* auto_flush */,
    bus, GFX_NOT_DEFINED /* RST */, st7701_type5_init_operations, sizeof(st7701_type5_init_operations));

and

  // Init Display
  if (!gfx->begin())
  {
    Serial.println("gfx->begin() failed!");
  }

  gfx->fillScreen(GREEN);

My compilation error message is the same as that guys. But even when I get it to compile succesfully. I get the following crash message on serial output:

Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x2a (SPI_FAST_FLASH_BOOT)
Saved PC:0x40379eba
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce2820,len:0x1188
load:0x403c8700,len:0x4
load:0x403c8704,len:0xbf0
load:0x403cb700,len:0x30e4
entry 0x403c88ac
E (1334) lcd_panel.rgb: lcd_rgb_panel_alloc_frame_buffers(165): no mem for frame buffer
E (1335) lcd_panel.rgb: esp_lcd_new_rgb_panel(353): alloc frame buffers failed
ESP_ERROR_CHECK failed: esp_err_t 0x101 (ESP_ERR_NO_MEM) at 0x42004e00
file: ".pio/libdeps/esp32-s3-devkitc-1/GFX Library for Arduino/src/databus/Arduino_ESP32RGBPanel.cpp" line 134
func: uint16_t* Arduino_ESP32RGBPanel::getFrameBuffer(int16_t, int16_t)
expression: esp_lcd_new_rgb_panel(&panel_config, &_panel_handle)

abort() was called at PC 0x4037c3df on core 1

Compilation error message:

.pio/libdeps/touch-avionics/GFX Library for Arduino/src/databus/Arduino_ESP32RGBPanel.cpp: In member function 'uint16_t* Arduino_ESP32RGBPanel::getFrameBuffer(int16_t, int16_t)':
.pio/libdeps/touch-avionics/GFX Library for Arduino/src/databus/Arduino_ESP32RGBPanel.cpp:93:3: error: 'esp_lcd_rgb_panel_config_t::<unnamed struct>' has no non-static data member named 'refresh_on_demand'
   };
   ^
.pio/libdeps/touch-avionics/GFX Library for Arduino/src/databus/Arduino_ESP32QSPI.cpp: In member function 'virtual bool Arduino_ESP32QSPI::begin(int32_t, int8_t)':
.pio/libdeps/touch-avionics/GFX Library for Arduino/src/databus/Arduino_ESP32QSPI.cpp:59:21: error: 'ESP_INTR_CPU_AFFINITY_AUTO' was not declared in this scope
       .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
*** [.pio\build\touch-avionics\libde0\GFX Library for Arduino\databus\Arduino_ESP32RGBPanel.cpp.o] Error 1
.pio/libdeps/touch-avionics/GFX Library for Arduino/src/databus/Arduino_ESP32QSPI.cpp:59:21: note: suggested alternative: 'ESP_ETH_PHY_ADDR_AUTO'
       .isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
                     ESP_ETH_PHY_ADDR_AUTO
.pio/libdeps/touch-avionics/GFX Library for Arduino/src/databus/Arduino_ESP32QSPI.cpp:60:22: error: 'spi_bus_config_t' has no non-static data member named 'isr_cpu_id'
       .intr_flags = 0};
                      ^
.pio/libdeps/touch-avionics/GFX Library for Arduino/src/databus/Arduino_ESP32QSPI.cpp:73:23: error: 'SPI_CLK_SRC_DEFAULT' was not declared in this scope
       .clock_source = SPI_CLK_SRC_DEFAULT,
                       ^~~~~~~~~~~~~~~~~~~
.pio/libdeps/touch-avionics/GFX Library for Arduino/src/databus/Arduino_ESP32QSPI.cpp:73:23: note: suggested alternative: 'LCD_CLK_SRC_XTAL'
       .clock_source = SPI_CLK_SRC_DEFAULT,
                       ^~~~~~~~~~~~~~~~~~~
                       LCD_CLK_SRC_XTAL
.pio/libdeps/touch-avionics/GFX Library for Arduino/src/databus/Arduino_ESP32QSPI.cpp:83:25: error: 'spi_device_interface_config_t' has no non-static data member named 'clock_source'
       .post_cb = nullptr};
                         ^
*** [.pio\build\touch-avionics\libde0\GFX Library for Arduino\databus\Arduino_ESP32QSPI.cpp.o] Error 1

Compiling is working just fine on arduino ide. What could be the issue?

Thank you <3

I had the same issue after cloning a project that was working on another PC. What I found out the other PC was using an older version of espressif32 and GFX. To fix the issue you can either downgrade or upgrade the libs.

To downgrade espressif32and GFX:

[env]
platform = espressif32 @ 6.6.0
lib_deps = moononournation/GFX Library for Arduino @ 1.4.9

To upgrade to the latest espressif32 version using pioarduino (unofficial):

[env]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
lib_deps = moononournation/GFX Library for Arduino @ ^1.5.3
1 Like