Sports car in disguise…
With its 8-bits parallel interface under the hood, this cheap MCUFriend 2.4″ TFT Arduino shield is something like a V8 powered Aston Martin, disguised as a Volkswagen Beetle.
I wondered how fast an ESP32 could drive it, especially when using the TFT_eSPI library.
These popular 320×240 ili9341 TFT displays are usually equipped with an SPI interface, but the TFT_eSPI library supports their 8-bits parallel version as well. I adapted the corresponding user_setup file for wiring the shield to a LOLIN D32 Pro board (see below), connected the required 15 wires (including two power lines*) and ran the same benchmark sketch that I had previously used in this post. The result was quite impressive.
The complete benchmark test (without the final text loop) completes within 0.8 seconds!
The following table quantifies the considerable speed gain in comparison with the SPI version at 27 MHz and 40 MHz (no DMA).
Here’s my user_setup file for a LOLIN D32 Pro board. It leaves GPIO pins 16 & 17 (used by PSRAM on WROVER boards), standard SPI pins 18, 19 & 23 and UART0 pins 1 & 3 free. Adding the line #define DMA_BUSY_CHECK fixed a compile error.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
#define ESP32_PARALLEL // this line was added to fix a compile error: #define DMA_BUSY_CHECK #define ILI9341_DRIVER // ESP32 pins used for 8-bit parallel interface to ili9341 TFT display #define TFT_CS 33 // Chip select control pin (library pulls permanently low #define TFT_DC 15 // Data Command control pin (sometimes labeled RS) - use a pin in the range 0-31 #define TFT_RST 32 // Reset pin, toggles on startup #define TFT_WR 5 // Write strobe control pin - use a pin in the range 0-31 #define TFT_RD 2 // Read strobe control pin - use a pin in the range 0-31 #define TFT_D0 12 // Must use pins in the range 0-31 for the data bus #define TFT_D1 13 // so a single register write sets/clears all bits. #define TFT_D2 26 // Pins can be randomly assigned, this does not affect #define TFT_D3 25 // TFT screen update performance. #define TFT_D4 21 #define TFT_D5 22 #define TFT_D6 27 #define TFT_D7 14 #define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH #define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters #define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters #define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm #define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:. #define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. #define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts #define SMOOTH_FONT |
This is a great display for projects that require ultra fast screen updates and don’t mind spending 13 GPIO pins. Now I’ll go after the 3.5″ version with 480×320 pixels, hoping it will be less sensitive to solderless wiring than my HX8357D 3.5″ display in 8-bit mode.
* For my shield to work, I had to power its 5V pin from the ESP32’s 5V output pin.