Hi @GianK128,
What I had to do was first deside on the pins I wanted to use for LCD and touchscreen and SD card if your using it so they don’t conflict. (im using the ili9341 lcd) Then I updated the file:
lv_micropython/lib/lv_bindings/driver/esp32/ili9XXX.py
In the ili9xx and also in the ili9341 method/location so they looked something like this for me:
ili9xx section:
miso=12, mosi=13, clk=14, cs=15, dc=26, rst=27, power=-1, backlight=33, backlight_on=1, power_on=0,
spihost=esp.HSPI_HOST, mhz=40, factor=4, hybrid=True, width=320, height=240,
colormode=COLOR_MODE_BGR, rot=LANDSCAPE, invert=False, double_buffer=True, half_duplex=True, display_type=DISPLAY_TYPE_ILI9341,
asynchronous=False, initialize=True
ili9341 section:
miso=12, mosi=13, clk=14, cs=15, dc=26, rst=27, power=-1, backlight=33, backlight_on=1, power_on=0,
spihost=esp.HSPI_HOST, mhz=40, factor=4, hybrid=True, width=320, height=240,
colormode=COLOR_MODE_BGR, rot=LANDSCAPE, invert=False, double_buffer=True, half_duplex=True,
asynchronous=False, initialize=True
I updated the touchscreen file so that it would work with landscape mode:
lv_micropython/lib/lv_bindings/driver/esp32/xpt2046.py
mine looked something like this:
self, miso=-1, mosi=-1, clk=-1, cs=25,
spihost=esp.HSPI_HOST, half_duplex=True, mhz=5, max_cmds=16,
cal_x0 = 3948, cal_y0 = 242, cal_x1 = 423, cal_y1 = 3783,
transpose = False, samples = 3
Then I compiled the everything so when running lvgl code on my esp32 all I have to add to the beginning is:
# Import libraries
import lvgl as lv
from ili9XXX import ili9341
from xpt2046 import xpt2046
# Initialize drivers
lv.init()
ili9341()
xpt2046()
# then add lvgl code here
If you don’t update those files then you can test by adding your parameters/wiring when initializing the driver like:
# Import libraries
import lvgl as lv
from ili9XXX import ili9341
from xpt2046 import xpt2046
# Initialize drivers
lv.init()
ili9341(miso=12, mosi=13, clk=14, cs=15, dc=26, rst=27, power=-1, backlight=33, backlight_on=1, power_on=0,)
xpt2046(miso=-1, mosi=-1, clk=-1, cs=25, cal_x0 = 3948, cal_y0 = 242, cal_x1 = 423, cal_y1 = 3783)
You also have to look at the file for your LCD if there are any special build instructions as for the ili9341 it notes you have to compile with specific CFLAGS like:
* esp32 NO psram
make -C ports/esp32 LV_CFLAGS="-DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1" BOARD=GENERIC
* esp32 WITH psram
make -C ports/esp32 LV_CFLAGS="-DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1" BOARD=GENERIC_SPIRAM
And after you compile you have to look at the instruction for uploading the firmware to your esp32. when I tried simply uploading the firmware like before it was not working. It only worked when uploading like the documentation mentioned.
EX:
/home/esp32/.espressif/python_env/idf4.2_py3.7_env/bin/python ../../../esp-idf/components/esptool_py/esptool/esptool.py -p /dev/ttyUSB0 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 build-GENERIC_SPIRAM/bootloader/bootloader.bin 0x8000 build-GENERIC_SPIRAM/partition_table/partition-table.bin 0x10000 build-GENERIC_SPIRAM/micropython.bin
hopefully this helps, those are the things that gave me a hard time while trying to compile and upload the FW to my esp32.