What MCU/Processor/Board and compiler are you using?
I´m using ESP32 with Arduino IDE.
What LVGL version are you using?
I´m using LVGL library and LVGL examples (form Library manager) versin 7.10.0
What do you want to achieve?
I would like to use ILI9341 LCD with HW SPI.
What have you tried so far?
I can run it with SW SPI, but LCD is very slo.
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
#include <lvgl.h>
#include <lv_examples.h>
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define _cs 5 // goes to TFT CS
#define _dc 21 // goes to TFT DC
#define _mosi 23 // goes to TFT MOSI
#define _sclk 18 // goes to TFT SCK/CLK
#define _rst -1 // goes to TFT RESET
#define _miso 19
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(_cs, _dc, _mosi, _sclk, _rst, _miso); //SW works
Adafruit_ILI9341 tft = Adafruit_ILI9341(_cs, _dc, _rst); //HW does not work
static lv_disp_buf_t disp_buf;
static lv_color_t buf[LV_HOR_RES_MAX * 10];
#if USE_LV_LOG != 0
/* Serial debugging */
void my_print(lv_log_level_t level, const char * file, uint32_t line, const char * dsc)
{
Serial.printf("%s@%d->%s\r\n", file, line, dsc);
Serial.flush();
}
#endif
/* Display flushing */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
uint32_t w = (area->x2 - area->x1 + 1);
uint32_t h = (area->y2 - area->y1 + 1);
uint32_t wh = w * h; //for Adafruit library
tft.startWrite();
tft.setAddrWindow(area->x1, area->y1, w, h);
while (wh--) tft.pushColor(color_p++->full); //for Adafruit library
tft.endWrite();
lv_disp_flush_ready(disp);
}
void setup()
{
Serial.begin(115200); /* prepare for possible serial debug */
lv_init();
#if USE_LV_LOG != 0
lv_log_register_print_cb(my_print); /* register print function for debugging */
#endif
tft.begin(); /* TFT init */
tft.setRotation(1); /* Landscape orientation */
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10);
/*Initialize the display*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.hor_res = 320;
disp_drv.ver_res = 240;
disp_drv.flush_cb = my_disp_flush;
disp_drv.buffer = &disp_buf;
lv_disp_drv_register(&disp_drv);
/* Try an example from the lv_examples repository
https://github.com/lvgl/lv_examples */
//lv_demo_widgets();
lv_demo_stress();
}
void loop()
{
lv_task_handler(); /* let the GUI do its work */
delay(5);
}
When I upload code with call for HW SPI, I get just this at serial monitor and it´s look to me as that main loop is not working.
If I upload code with call for SW SPI, screen is working but framerate is very slow.
Have anyone idea what I could try to make it work with HW SPI?
Many thanks for help.