I have a very simple ESP32 sketch which draws a straight yellow line on a blue screen on an ILI9341 TFT display. I have an identical sketch written for an ESP8266 which uploads OK but does not draw the line on the same ILI9341 TFT display.
I believe the problem is caused by the USB drivers I use for each uProcessor.
For the ESP32:
// # Microprocessor: ESP32 Dev Module
// # Display: Display: MSP2807 TFT LCD, 240 x 320 Pixels
// # Control IC: ILI9341
// #
// # Device Driver: SILICON LABS CP210x USB to UART Bridge (COM4)
// #
// # Needs Font 2 (also Font 4 if using large scale label)
// #
// # Comm Port: COM4
// #
// ########################################################################
#include <SPI.h>
#include <Adafruit_GFX.h> // include Adafruit graphics library
#include <Adafruit_ILI9341.h> // include Adafruit ILI9341 TFT library
// ########################################################################
// #
// # We need six connections to drive the PDI035HVHI-48
// # ILI9488 TFT display from the ESP32 uProcessor
// #
// ########################################################################
// ########################################################################
// #
// # Define pin connections between display and the ESP32 uP
// #
// ########################################################################
#define TFT_CS 15 // TFT CS Pin 3 conn to ESP32 uP pin 15 Brown
#define TFT_RST 4 // TFT RST Pin 4 conn to ESP32 uP pin 4 Red
#define TFT_DC 2 // TFT DC Pin 5 conn to ESP32 uP pin 2 Orange
// ########################################################################
// #
// # Other pin connections between display and the ESP32 uP shown below
// #
// ########################################################################
#define TFT_MOSI 23 // TFT MOSI Pin 6 conn to ESP32 uP pin 23 Yellow
#define TFT_SCK 18 // TFT SCK Pin 7 conn to ESP32 uP pin 18 Green
#define TFT_MISO 21 // TFT MISO Pin 9 conn to ESP32 uP pin 21 Gray
// #define TFT_LED 3.3V // TFT LED conn to ESP32 uP pin 3.3V
// initialize ILI9341 TFT library
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
// #################################################################
// #
// # Define constants used in this sketch
// #
// ################################################################
float Yi= 20, Yf= 150, del1=1;
float X_Beg=10, X_End=479-X_Beg, Y_Beg=Yf, Y_End=Yf;
void setup() {
tft.begin();
tft.setRotation(3);
tft.fillScreen(ILI9341_BLUE);
tft.setTextSize(3);
tft.setCursor(X_Beg, Y_Beg);
tft.drawLine(X_Beg, Y_Beg, X_End, Y_End, ILI9341_YELLOW);
}
void loop(){}
Wiring Diagram:
ESP32 Line Draw.pdf (75.0 KB)
The driver files from the Device Manager for this ESP32 sketch are:
ESP32 Device Manager Driver Contents.pdf (102.5 KB)
This ESP32 sketch uploads and plots the straight line on the ILI9341 TFT screen.
For the ESP8266:
// # Microprocessor: ESP8266 Dev Module
// # Display: Display: MSP2807 TFT LCD, 240 x 320 Pixels
// # Control IC: ILI9341
// #
// # Device Driver: USB-SERIAL CH340 (COM3)
// #
// # Needs Font 2 (also Font 4 if using large scale label)
// #
// # Comm Port: COM3 Driven by CH340 driver
// #
// ########################################################################
#include <SPI.h>
#include <Adafruit_GFX.h> // include Adafruit graphics library
#include <Adafruit_ILI9341.h> // include Adafruit ILI9341 TFT library
// ########################################################################
// #
// # We need six connections to drive the PDI035HVHI-48
// # ILI9488 TFT display from the ESP8266 uProcessor
// #
// ########################################################################
// ########################################################################
// #
// # Define pin connections between display and the ESP8266 uP
// #
// ########################################################################
#define TFT_CS 8 // TFT CS Pin 3 conn to ESP8266 uP pin 8 Brown
#define TFT_RST 4 // TFT RST Pin 4 conn to ESP8266 uP pin 4 Red
#define TFT_DC 3 // TFT DC Pin 5 conn to ESP8266 uP pin 3 Orange
// ########################################################################
// #
// # Other pin connections between display and the ESP8266 uP shown below
// #
// ########################################################################
#define TFT_MOSI 7 // TFT MOSI Pin 6 conn to ESP8266 uP pin 7 Yellow
#define TFT_SCK 5 // TFT SCK Pin 7 conn to ESP8266 uP pin 5 Green
#define TFT_MISO 6 // TFT MISO Pin 9 conn to ESP8266 uP pin 6 Gray
// #define TFT_LED 3.3V // TFT LED conn to ESP8266 uP pin 3.3V
// initialize ILI9341 TFT library
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
// #################################################################
// #
// # Define constants used in this sketch
// #
// ################################################################
float Yi= 20, Yf= 150, del1=1;
float X_Beg=10, X_End=479-X_Beg, Y_Beg=Yf, Y_End=Yf;
void setup() {
tft.begin();
tft.setRotation(3);
tft.fillScreen(ILI9341_BLUE);
tft.setTextSize(3);
tft.setCursor(X_Beg, Y_Beg);
tft.drawLine(X_Beg, Y_Beg, X_End, Y_End, ILI9341_YELLOW);
}
void loop(){}
ESP8266 Wiring Diagram:
ESP8266 Line Draw.pdf (67.9 KB)
The driver files from the Device Manager for this ESP8266 sketch are:
ESP8266 Device Manager Driver Contents.pdf (104.3 KB)
What is the problem with the ESP8266 sketch?
Is it the driver that I am using?