ESP32 5inch DIS07050H and arduino context...
Could a generous specialist explain how to set up an environment that works with this board?
I use Arduino IDE 1.8.19
esp32 by Espressif System 3.0.2
Selected card : ESP32S3 Dev Module , HUGE APP, OPI PSRAM
I downloaded Arduino_5inch.zip via the Wiki, copied the libraries from
Arduino_5inch\Hardware-Version-2.0\libraries
to
C:\Users\MyName\AppData\Local\Arduino15\packagesesp32\hardware\esp32\3.0.2\libraries
unzipped UI-5.0-BLUE.rar in this folder
and tried a lot of code like this ... nothing to do
#define TFT_BL 2
#define LGFX_USE_V1
#include <LovyanGFX.hpp>
#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>
class LGFX : public lgfx::LGFX_Device
{
public:
lgfx::Bus_RGB _bus_instance;
lgfx::Panel_RGB _panel_instance;
LGFX(void)
{
{
auto cfg = _bus_instance.config();
cfg.panel = &_panel_instance;
cfg.pin_d0 = GPIO_NUM_8; // B0
cfg.pin_d1 = GPIO_NUM_3; // B1
cfg.pin_d2 = GPIO_NUM_46; // B2
cfg.pin_d3 = GPIO_NUM_9; // B3
cfg.pin_d4 = GPIO_NUM_1; // B4
cfg.pin_d5 = GPIO_NUM_5; // G0
cfg.pin_d6 = GPIO_NUM_6; // G1
cfg.pin_d7 = GPIO_NUM_7; // G2
cfg.pin_d8 = GPIO_NUM_15; // G3
cfg.pin_d9 = GPIO_NUM_16; // G4
cfg.pin_d10 = GPIO_NUM_4; // G5
cfg.pin_d11 = GPIO_NUM_45; // R0
cfg.pin_d12 = GPIO_NUM_48; // R1
cfg.pin_d13 = GPIO_NUM_47; // R2
cfg.pin_d14 = GPIO_NUM_21; // R3
cfg.pin_d15 = GPIO_NUM_14; // R4
cfg.pin_henable = GPIO_NUM_40;
cfg.pin_vsync = GPIO_NUM_41;
cfg.pin_hsync = GPIO_NUM_39;
cfg.pin_pclk = GPIO_NUM_0;
cfg.freq_write = 15000000;
cfg.hsync_polarity = 0;
cfg.hsync_front_porch = 8;
cfg.hsync_pulse_width = 4;
cfg.hsync_back_porch = 43;
cfg.vsync_polarity = 0;
cfg.vsync_front_porch = 8;
cfg.vsync_pulse_width = 4;
cfg.vsync_back_porch = 12;
cfg.pclk_active_neg = 1;
cfg.de_idle_high = 0;
cfg.pclk_idle_high = 0;
_bus_instance.config(cfg);
}
{
auto cfg = _panel_instance.config();
cfg.memory_width = 800;
cfg.memory_height = 480;
cfg.panel_width = 800;
cfg.panel_height = 480;
cfg.offset_x = 0;
cfg.offset_y = 0;
_panel_instance.config(cfg);
}
_panel_instance.setBus(&_bus_instance);
setPanel(&_panel_instance);
}
};
LGFX lcd;
/*******************************************************************************
End of Arduino_GFX setting
******************************************************************************/
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.printf("Coucou, c'est ESP32....\n");
Serial.println();
Serial.println("LCD Init.");
lcd.init();
lcd.setBrightness(255);
lcd.fillScreen(TFT_WHITE);
delay(250);
lcd.fillScreen(TFT_RED);
delay(250);
lcd.fillScreen(TFT_GREEN);
delay(250);
lcd.fillScreen(TFT_BLUE);
delay(250);
lcd.fillScreen(TFT_BLACK);
lcd.setTextSize((std::max(lcd.width(), lcd.height()) + 255) >> 8);
lcd.setTextDatum(textdatum_t::middle_center);
lcd.drawString("touch the screen", lcd.width() >> 1, lcd.height() >> 1);
}
void loop() {
// put your main code here, to run repeatedly:
int32_t x, y;
if (lcd.getTouch(&x, &y)) {
Serial.printf("X:%d Y:%d\n", x, y);
lcd.fillCircle(x, y, 15, TFT_WHITE);
}
delay(100);
}
I get error
C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32s3/include/soc/esp32s3/include/soc/soc.h:37: warning: "REG_SPI_BASE" redefined
37 | #define REG_SPI_BASE(i) (((i)>=2) ? (DR_REG_SPI2_BASE + (i-2) * 0x1000) : (0)) // GPSPI2 and GPSPI3
|
C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\common.cpp:23: note: this is the location of the previous definition
23 | #define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 )))
|
C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\Light_PWM.cpp: In member function 'virtual bool lgfx::v1::Light_PWM::init(uint8_t)':
C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\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);
| ^~~~~~~~~
In file included from C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32s3/include/esp_hw_support/include/esp_memory_utils.h:12,
from C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32s3/include/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h:79,
from C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32s3/include/freertos/FreeRTOS-Kernel/include/freertos/portable.h:59,
from C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32s3/include/freertos/FreeRTOS-Kernel/include/freertos/FreeRTOS.h:71,
from C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32s3/include/driver/include/esp_private/spi_common_internal.h:13,
from C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\Bus_SPI.hpp:36,
from C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\Bus_SPI.cpp:28:
C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-bd2b9390ef\esp32s3/include/soc/esp32s3/include/soc/soc.h:37: warning: "REG_SPI_BASE" redefined
37 | #define REG_SPI_BASE(i) (((i)>=2) ? (DR_REG_SPI2_BASE + (i-2) * 0x1000) : (0)) // GPSPI2 and GPSPI3
|
C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\Bus_SPI.cpp:23: note: this is the location of the previous definition
23 | #define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 )))
|
C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\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\MyName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\Bus_SPI.cpp: In function 'void lgfx::v1::gpio_reset(size_t)':
C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\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
C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\common.cpp: In function 'void lgfx::v1::i2c::i2c_set_cmd(i2c_dev_t*, uint8_t, uint8_t, uint8_t, bool)':
C:\Users\MyName\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\libraries\LovyanGFX\src\lgfx\v1\platforms\esp32\common.cpp:810:14: error: 'struct i2c_dev_t' has no member named 'comd0'; did you mean 'comd'?
810 | (&dev->comd0)[index].val = cmd_val;
| ^~~~~
| comd
By "correcting" a few libs (replace ledcSetup + ledcAttachPin with ledcAttach), I manage to compile the whole thing but the screen remains black....
Best regards
Tagged:
Comments
Finally, I managed to compile the whole thing by updating some libs via Github:
arduino-esp32-master.zip
LovyanGFX-master.zip