Default blank project for Elecrow 5" screen does not compile

I’m simply loading a blank project to use with the 5 inch LCD from Elecrow. Using Arduino IDE 2.3.2.

Will not compile. These are the errors. I’ve tried with LVGL versions 8.3.11 and 8.3.6 through the options in SLS, same error with both of them. I mean it’s using LovyanGFX so that’s hardly surprising.

c:\Users\Eugh\Documents\export\SquareLine_Project2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\Light_PWM.cpp: In member function ‘virtual bool lgfx::v1::Light_PWM::init(uint8_t)’:
c:\Users\Eugh\Documents\export\SquareLine_Project2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\Light_PWM.cpp:43:5: error: ‘ledcSetup’ was not declared in this scope
43 | ledcSetup(_cfg.pwm_channel, _cfg.freq, PWM_BITS);
| ^~~~~~~~~
c:\Users\Eugh\Documents\export\SquareLine_Project2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\Light_PWM.cpp:44:5: error: ‘ledcAttachPin’ was not declared in this scope; did you mean ‘ledcAttach’?
44 | ledcAttachPin(_cfg.pin_bl, _cfg.pwm_channel);
| ^~~~~~~~~~~~~
| ledcAttach
c:\Users\Eugh\Documents\export\SquareLine_Project2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\Bus_SPI.cpp: In function ‘void lgfx::v1::gpio_reset(size_t)’:
c:\Users\Eugh\Documents\export\SquareLine_Project2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\Bus_SPI.cpp:182:5: error: ‘gpio_matrix_out’ was not declared in this scope; did you mean ‘gpio_iomux_out’?
182 | gpio_matrix_out((gpio_num_t)pin, SIG_GPIO_OUT_IDX, 0, 0);
| ^~~~~~~~~~~~~~~
| gpio_iomux_out

exit status 1

Compilation error: exit status 1

It seems LovyanGFX wants to pull in LEDC to set the backlight with PWM. It’s a part of the ESP library (LED Control (LEDC) - ESP32 - — ESP-IDF Programming Guide v5.3.1 documentation), so I think you should be playing around with the esp32 library version in Arduino IDE to have this contained in it. (The ‘gpio_matrix_out’ problem seems to have the same story: gpio_matrix_out is not defined · Issue #220 · lvgl/lvgl_esp32_drivers · GitHub)
We have collected in the README the versions of libraries we could use the board with, maybe that has some info for you regarding this. ( Elecrow has a page too (on which our board-templates are based on), maybe there are some more ESP/version-related info there: CrowPanel ESP32 HMI 5.0-inch Display - Elecrow Wiki )

Makes sense. I was playing around with ESP32 libraries, and I noticed there has been a significant update recently (relatively speaking).

I will do some more testing based on your feedback and report back.

Appreciate the help, thanks!

1 Like

Ok, so I’ve come back to it a couple days later, and changing the ESP32 board library does indeed lead to a successful compilation, but it doesn’t actually function.

  • 2.0.14 = Compiles and uploads. Result: backlight turns on but the UI isn’t drawn, there’s only a black screen. I have a white background with a single blue button for the UI in SLS.

  • 2.0.17 = Same as above^.

  • 3.0.0+ = See original error in my first post.

Small correction to my original post as well. These errors are actually produced using Arduino IDE 1.8.19, not v2. I’ve been switching between the two and got mixed up.

IDE 2.3.2 actually gives errors too, but seems to be related to the LVGL (or perhaps LovyanGFX) library.

Here is the error produced in IDE 2.3.2.

C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:91:8: error: ‘lv_disp_draw_buf_t’ does not name a type; did you mean ‘lv_draw_buf_t’?
91 | static lv_disp_draw_buf_t draw_buf;
| ^~~~~~~~~~~~~~~~~~
| lv_draw_buf_t
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:6: error: variable or field ‘my_disp_flush’ declared void
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
| ^~~~~~~~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:20: error: ‘lv_disp_drv_t’ was not declared in this scope; did you mean ‘lv_fs_drv_t’?
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
| ^~~~~~~~~~~~~
| lv_fs_drv_t
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:35: error: ‘disp’ was not declared in this scope
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
| ^~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:41: error: expected primary-expression before ‘const’
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t color_p)
| ^~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:75: error: expected primary-expression before '
’ token
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
| ^
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:76: error: ‘color_p’ was not declared in this scope
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t color_p)
| ^~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:6: error: variable or field ‘my_touchpad_read’ declared void
124 | void my_touchpad_read (lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
| ^~~~~~~~~~~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:23: error: ‘lv_indev_drv_t’ was not declared in this scope; did you mean ‘lv_indev_data_t’?
124 | void my_touchpad_read (lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
| ^~~~~~~~~~~~~~
| lv_indev_data_t
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:40: error: ‘indev_driver’ was not declared in this scope
124 | void my_touchpad_read (lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
| ^~~~~~~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:70: error: expected primary-expression before '
’ token
124 | void my_touchpad_read (lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
| ^
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:72: error: ‘data’ was not declared in this scope
124 | void my_touchpad_read (lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
| ^~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:72: note: suggested alternatives:
In file included from c:\users\eugh\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s3-elf\include\c++\12.2.0\unordered_map:48,
from c:\users\eugh\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s3-elf\include\c++\12.2.0\functional:61,
from C:\Users\Eugh\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-alpha3\cores\esp32/HardwareSerial.h:49,
from C:\Users\Eugh\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-alpha3\cores\esp32/Arduino.h:197,
from C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:3:
c:\users\eugh\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s3-elf\include\c++\12.2.0\bits\range_access.h:343:5: note: ‘std::data’
343 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
In file included from c:\users\eugh\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s3-elf\include\c++\12.2.0\bits\ranges_algobase.h:39,
from c:\users\eugh\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s3-elf\include\c++\12.2.0\bits\ranges_algo.h:35,
from c:\users\eugh\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s3-elf\include\c++\12.2.0\algorithm:63,
from C:\Users\Eugh\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.0-alpha3\cores\esp32/Arduino.h:185:
c:\users\eugh\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s3-elf\include\c++\12.2.0\bits\ranges_base.h:577:43: note: ‘std::ranges::__cust::data’
577 | inline constexpr __cust_access::_Data data{};
| ^~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:6: error: variable or field ‘my_disp_flush’ declared void
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
| ^~~~~~~~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:21: error: ‘lv_disp_drv_t’ was not declared in this scope; did you mean ‘lv_fs_drv_t’?
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
| ^~~~~~~~~~~~~
| lv_fs_drv_t
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:36: error: ‘disp’ was not declared in this scope
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
| ^~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:42: error: expected primary-expression before ‘const’
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t color_p)
| ^~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:76: error: expected primary-expression before '
’ token
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
| ^
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:109:77: error: ‘color_p’ was not declared in this scope
109 | void my_disp_flush (lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t color_p)
| ^~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:6: error: variable or field ‘my_touchpad_read’ declared void
124 | void my_touchpad_read (lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
| ^~~~~~~~~~~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:24: error: ‘lv_indev_drv_t’ was not declared in this scope; did you mean ‘lv_indev_data_t’?
124 | void my_touchpad_read (lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
| ^~~~~~~~~~~~~~
| lv_indev_data_t
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:41: error: ‘indev_driver’ was not declared in this scope
124 | void my_touchpad_read (lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
| ^~~~~~~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:71: error: expected primary-expression before '
’ token
124 | void my_touchpad_read (lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
| ^
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:73: error: ‘data’ was not declared in this scope
124 | void my_touchpad_read (lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
| ^~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:124:73: note: suggested alternatives:
c:\users\eugh\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s3-elf\include\c++\12.2.0\bits\range_access.h:343:5: note: ‘std::data’
343 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
c:\users\eugh\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32s3-elf-gcc\esp-12.2.0_20230208\xtensa-esp32s3-elf\include\c++\12.2.0\bits\ranges_base.h:577:43: note: ‘std::ranges::__cust::data’
577 | inline constexpr __cust_access::_Data data{};
| ^~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino: In function ‘void setup()’:
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:164:29: error: ‘draw_buf’ was not declared in this scope
164 | lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * screenHeight / LVGL_BUFFER_RATIO );
| ^~~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:164:5: error: ‘lv_disp_draw_buf_init’ was not declared in this scope; did you mean ‘lv_draw_buf_init’?
164 | lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * screenHeight / LVGL_BUFFER_RATIO );
| ^~~~~~~~~~~~~~~~~~~~~
| lv_draw_buf_init
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:167:12: error: ‘lv_disp_drv_t’ does not name a type; did you mean ‘lv_fs_drv_t’?
167 | static lv_disp_drv_t disp_drv;
| ^~~~~~~~~~~~~
| lv_fs_drv_t
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:168:24: error: ‘disp_drv’ was not declared in this scope
168 | lv_disp_drv_init( &disp_drv );
| ^~~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:168:5: error: ‘lv_disp_drv_init’ was not declared in this scope; did you mean ‘lv_fs_drv_init’?
168 | lv_disp_drv_init( &disp_drv );
| ^~~~~~~~~~~~~~~~
| lv_fs_drv_init
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:172:25: error: ‘my_disp_flush’ was not declared in this scope
172 | disp_drv.flush_cb = my_disp_flush;
| ^~~~~~~~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:174:5: error: ‘lv_disp_drv_register’ was not declared in this scope; did you mean ‘lv_fs_drv_register’?
174 | lv_disp_drv_register( &disp_drv );
| ^~~~~~~~~~~~~~~~~~~~
| lv_fs_drv_register
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:177:12: error: ‘lv_indev_drv_t’ does not name a type; did you mean ‘lv_indev_data_t’?
177 | static lv_indev_drv_t indev_drv;
| ^~~~~~~~~~~~~~
| lv_indev_data_t
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:178:25: error: ‘indev_drv’ was not declared in this scope
178 | lv_indev_drv_init( &indev_drv );
| ^~~~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:178:5: error: ‘lv_indev_drv_init’ was not declared in this scope; did you mean ‘lv_fs_drv_init’?
178 | lv_indev_drv_init( &indev_drv );
| ^~~~~~~~~~~~~~~~~
| lv_fs_drv_init
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:180:25: error: ‘my_touchpad_read’ was not declared in this scope
180 | indev_drv.read_cb = my_touchpad_read;
| ^~~~~~~~~~~~~~~~
C:\Users\Eugh\Documents\export\SquareLine_Project2\ui\ui.ino:181:5: error: ‘lv_indev_drv_register’ was not declared in this scope; did you mean ‘lv_fs_drv_register’?
181 | lv_indev_drv_register( &indev_drv );
| ^~~~~~~~~~~~~~~~~~~~~
| lv_fs_drv_register

exit status 1

Compilation error: ‘lv_disp_draw_buf_t’ does not name a type; did you mean ‘lv_draw_buf_t’?

From here I manually updated the LovyanGFX library to 1.1.16. Now it successfully compiles under IDE 2.3.2 using ESP32 version 3.0.4. However, I then I got the same result as earlier with only a blank backlit screen upon upload.

I tried switching from QSPI PSRAM to OPI PSRAM as suggested in a forum post on Elecrow (as opposed to the QSPI PSRAM option recommended in the docs)… And voila! Success at long last! This QSPI/OPI issue was probably the result of the blank screen in IDE v1 too, but I didn’t test it.

I daresay proper devs will be banging your heads on your desks reading this post, I’ve no doubt done things the hard way or missed obvious things here and there, but in the end it’s working.

Hope this helps others who might face similar issues.

Edit: small update. Switched to a different project and forgot to update the LovyanGFX library. I received the same error as in my original post. So the LovyanGFX version included with SLS obviously needs updating :slight_smile:

Great to see you could solve the problem by the advised version-changes.
In the README of our board-template file we tell to set PSRAM to OPI mode, and we start that document by describing the versions that worked together for us with the included LovyanGFX library (in this case 2.0.17 version of ESP libraries), and telling that you would probably need to change this built-in LovyanGFX library to another version if esp32 versions change. We used the library versions that Elecrow officially used in their code. Libraries used in Arduino are so sensitive to versions, so if you use different versions of the IDE and ESP32 sdk-library, playing around with LovyanGFX versions is unavoidable.

1 Like

I was referencing Elecrow’s own documentation in regards to PSRAM, just to be clear. Although I may have wrongly referenced that too, I have been rather rushed in my time spent on this screen so far.

I hear you loud and clear with version changes being part of the process. I will surely bear this in mind in future! I suspected I might have been going about things rather naively, and your comment confirms this lol :slight_smile:

At least now I can tell you that v3 (up to the current 3.0.4) of the ESP32 library works just fine with SLS and Elecrow’s 5" screen using Lovyan 1.1.16. The only issue I have run into so far is some weird artifacts (screen ‘tearing’) related to animations, but this doesn’t seem to be version related simply judging by a quick scan of current info on this topic on the forums, or at least as far as I could tell (I haven’t read into it greatly enough to figure it out, but I’m not complaining).

In any case, I appreciate the fact that SLS staff are yet again quick to respond and helpful. I will most likely be purchasing a license in the near future, and experiences like this only make me more confident in such a purchase. Top work. SLS really is in a class of its own!

1 Like