Mr. Bodmer: I apologize for being confused, but I am. I was successful using the Arduino GFX Library to implement driving the ILI9341 to display text and to draw a red square on the ILI9341 display. This sketch is listed below:
//######################################################################
//######################################################################
//
// Arduino GFX Draw Text and Square
//
// Comm Port: COM3
//
//######################################################################
//######################################################################
//
// The pin definitions below are altered to be in line
// with those define in Bodmer's TFT_eSPI Library
//
#include <Arduino_GFX_Library.h>
#define TFT_SCK 18 // 18
#define TFT_MOSI 23 // 23
#define TFT_MISO 19 // 19
#define TFT_CS 15 // 22
#define TFT_DC 2 // 2
#define TFT_RESET 4 // 17
void setup(void)
{
Arduino_ESP32SPI bus = Arduino_ESP32SPI(TFT_DC, TFT_CS, TFT_SCK, TFT_MOSI, TFT_MISO);
Arduino_ILI9341 display = Arduino_ILI9341(&bus, TFT_RESET);
// Note that the ILI9341 Display Driver is defined to be: "display"
display.begin();
display.fillScreen(WHITE);
display.setCursor(40, 20);
display.setTextSize(2);
display.setTextColor(BLUE);
display.print("From Arduino");
display.setCursor(25,40);
display.print("This is the text");
display.setCursor(70, 60);
display.print("statement");
display.drawRect(70, 200, 100, 100, RED);
display.fillRect(70, 200, 100, 100, RED);
}
void loop() {}
This sketch created the following display:

Consistent with the pin connections in this sketch is the wiring diagram for same:
I want to run this same sketch using the TFT_eSPI Library. This sketch is shown below:
//########################################################
//########################################################
//
// Draw Text and Square Using TFT_eSPI
//
// 1-27-22
//
//########################################################
//########################################################
#include <TFT_eSPI.h> // Hardware-specific library
#include <SPI.h>
#include <Setup109_ILI9341_JR.h> // User Setup File
//#########################################################
//#########################################################
//
// Define some colors
//
//#########################################################
//#########################################################
#define TFT_BLACK 0x0000 /* 0, 0, 0 */
#define TFT_NAVY 0x000F /* 0, 0, 128 */
#define TFT_WHITE 0xFFFF /* 255, 255, 255 */
void setup(void) {
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
tft.init();
tft.fillScreen(TFT_WHITE); // OK
tft.setTextSize(2); // OK
tft.setTextColor(TFT_NAVY, TFT_WHITE);
tft.drawString("This is the text", 0, 0, 2);
tft.drawRect(70, 200, 100, 100, TFT_RED);
tft.fillRect(70, 200, 100, 100, TFT_RED);
}
void loop() {}
Note that I have added the line: "#include <Setup109_ILI9341_JR.h> // User Setup File"
to read in my desired User Setup instructions.
This sketch compiles, and uploads just fine. It does not run. Why?
This setup file is listed below:
// See SetupX_Template.h for all options available
#define ILI9341_DRIVER // Select ILI9341 Driver
//###################################################
//#
//# Define Pin Connections
//#
//###################################################
#define TFT_CS PIN_D8 // Chip select control pin D8
#define TFT_DC PIN_D3 // Data Command control pin
#define TFT_RST PIN_D4 // Reset pin (could connect to NodeMCU RST, see next line)
// #define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
#define TFT_SCK PIN_D18 // Green Wire
#define TFT_MOSI PIN_D23 // Yellow Wire
#define TFT_MISO PIN_19 // Gray Wire
//#####################################################
//#
//# Pin definitions - Commented Out
//#
//#####################################################
// #define TFT_CS PIN_15 // Brown Wire
// #define TFT_DC 2 // Orange Wire
// #define TFT_RST 4 // Red Wire
// #define TFT_BKL 22 // Connected to +3.3V
//##########################################
//#
//# Load some fonts
//#
//##########################################
#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
//#########################################
//#
//# Define SPI, SPI_Read and SPI_Touch
//# Frequencies
//#
//#########################################
// #define SPI_FREQUENCY 27000000
#define SPI_FREQUENCY 40000000
// #define SPI_FREQUENCY 80000000
#define SPI_READ_FREQUENCY 20000000
#define SPI_TOUCH_FREQUENCY 2500000
// #define SUPPORT_TRANSACTIONS
Now I come down to the issue causing my confusion.
- I am using a 30-pin, ESP32 Development Board:
-
With reference to my User Setup File: Setup109_ILI9341_JR.h, this ESP32 module has no Pin D8
and no Pin D3..What must I do to solve this problem?
-
I ran the Read User Setup sketch on this sketch configuration. The output from this sketch is
shown below:
On 1-28-22
TFT_eSPI ver = 2.4.2
Processor = ESP32
Frequency = 240MHz
Transactions = Yes
Interface = SPI
Display driver = 9341
Display width = 240
Display height = 320
MOSI = GPIO 23
SCK = GPIO 18
TFT_CS = GPIO 15
TFT_DC = GPIO 0
TFT_RST = GPIO 2
Font GLCD loaded
Font 2 loaded
Font 4 loaded
Font 6 loaded
Font 7 loaded
Font 8 loaded
Smooth font enabled
Display SPI frequency = 27.00
What am I doing wrong, or what should I be doing to solve this problem?
Best wishes