Hi!
I can’t figure out how to make ILI9341 controller work with ESP32 via SPI. I’ve tried to make a new component but nothing works.
Has somebody tried to do it and it worked?
Thanks
Hi!
I can’t figure out how to make ILI9341 controller work with ESP32 via SPI. I’ve tried to make a new component but nothing works.
Has somebody tried to do it and it worked?
Thanks
TFT_eSPI is designed for use within the Arduino framework; therefore, there is no official version for ESP-IDF.
If you are required to use ESP-IDF, your only option is to follow the instructions provided in the link below:
If the results are not satisfactory, you have a few alternatives.
Since I have very little information regarding your development environment or target device—and because I lack personal experience with ESP-IDF—I will outline some general options below:
esp_lcd.In any of these cases, you should be able to use LVGL, a high-level GUI library.
I have personally implemented a system using the Arduino framework, LovyanGFX, and LVGL on an ESP32-S3, and I am currently in the process of porting this setup to an ESP32-C6-based system.
I’ve used TFT-eSPI on my ESP32 DevKitC’s on SPI bus in PIO + VSC, on cheap touchscreens from Aliexpress with ILI9341 controllers. Worked fine for me.
I edited the User_setup file to use the #define ILI9341_DRIVER line.
I’ve got the screen, touchcreen and SD card reader all on the same SPI bus, with 3 chip select IO lines.
My Platformio.ini is …
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:nodemcu-32s]
platform = espressif32
board = nodemcu-32s
framework = arduino
monitor_speed = 115200
lib_deps =
https://github.com/pioarduino/platform-espressif32/releases/download/55.03.34/platform-espressif32.zip
bodmer/TFT_eSPI@^2.5.43
; bodmer/TFT_eWidget @ ^0.0.6
sandeepmistry/CAN @ ^0.3.1
SD
lib_ignore = AzureIoTHubMQTTClient //=> this one also has an SD.h file which caused trouble earlier
build_flags =
-D USER_SETUP_LOADED
-D ILI9488_DRIVER
-D TFT_WIDTH=320
-D TFT_HEIGHT=480
-D TFT_RST=4
-D TFT_DC=2
;
-D TFT_SCLK=18
-D TFT_MOSI=23
-D TFT_MISO=19
-D TFT_CS=15
;
-D TOUCH_SCLK=18
-D TOUCH_DIN=23 ;MOSI
-D TOUCH_DO=19 ;MISO
-D TOUCH_CS=5
;
;-D SD_SCLK=14
;-D SD_MOSI=13
;-D SD_MISO=12
-D SD_SCLK=18
-D SD_MOSI=23
-D SD_MISO=19
-D SD_CS=16
;
-D LOAD_GLCD=1
-D LOAD_FONT2
-D LOAD_FONT3
-D LOAD_FONT4
-D LOAD_FONT6
-D LOAD_FONT7
-D LOAD_FONT8
-D LOAD_GFXFF
-D SMOOTH_FONT
-D SPI_FREQUENCY=40000000
Note that the above Platformio.ini specifies the ILI9488_DRIVER , can’t remember now how that came about, but there was a reason.
I’m no expert, but all worked well on several projects so far, so hopefully might help you.
Trevor
trevor1:
Using the TFT_eSPI library within the Arduino framework should not present any particular issues—in other words, it ought to work as expected.
Assuming the title of this issue is accurate, it seems that capy_talism is encountering difficulties specifically when using ESP-IDF.
As an aside, is the resolution of the target device in your example 240x320?
ito_giken
I did say I wasn’t an expert ![]()
I’ve not tried ESP-IDF.
PlatformIO works fine for me.
I started with Arduino IDE, but soon found it so slow to compile, so moved onto PIO.
Yes my display is 320x480 and so must be an ILI9488 or even an ST7796S driver chip.
My Platformio.ini overrides the User_setup file, so I guess those settings are irrelevant / redundant.
My display MISO is connected common with the SD card MISO and also Touch DO.
These all run on the ESP32 IO-19 VSPI MISO pin.
I use x3 IO pins as chip-select connections, one for the display CS, one for the touch CS and one for the SD card reader CS.
All seems to work fine, with no problems.
Sorry capy_talism looks like I’m not helping much.
The ILI9341 works reliably with ESP32 over SPI. Creating a custom driver is usually unnecessary. For ESP-IDF, use Espressif’s esp_lcd_ili9341 component. For Arduino, consider the TFT_eSPI library.