lvgl / lvgl_esp32_drivers

Drivers for ESP32 to be used with LVGL
MIT License
339 stars 285 forks source link

ST7789 SPI mode seems wrong #178

Closed richardclli closed 2 years ago

richardclli commented 2 years ago

I have a display that is not working with the driver in SPI mode 2, but when changing the mode to 0, it works.

Not sure why the following code is needed in the first place.

if defined (CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7789)

define SPI_TFT_SPI_MODE (2)

else

define SPI_TFT_SPI_MODE (0)

endif

richardclli commented 2 years ago

After checking with eSPI_TFT library, it seems some ST7789 uses mode 0 and some uses mode 3, so probably mode 2 is not right?

C47D commented 2 years ago

I've been using it in mode 2 for quite a while now, and it's working fine. I'll try to add an option in the Kconfig menu to choose the mode. Thanks for the report.

I'm guessing you are using the master branch.

richardclli commented 2 years ago

A good choice, have a config is better, thanks. I am using the version in the esp32 port, which is quite old, but I checked newer versions still use mode 2 hardcoded.

richardclli commented 2 years ago

After tryout, I am creating a project using lvgl and the esp32 driver as submodules, may try newer version. Use master branch in esp32 drivers is good? Or should I move to another branch? Which version of LVGL should I use?

C47D commented 2 years ago

That project only supports LVGL v7, we're trying to get a general cleanup on the repo before starting to support LVGL v8. I will send you the patch later today.

richardclli commented 2 years ago

Take your time, I already have a quick fix anyway.

ksmq commented 2 years ago

TTGO T-Watch which uses the ST7789 seems to work with both spi mode 0 and 3, but not with 2. I've seen other libs also use 0. Took me a while to debug this so posting in case someone else comes across the same problem.