I would like to connect a ER-TFTM035-6 3.5" 480x320 TFT display board to an Adafruit Arduino Huzzah32 esp32 based board.
I connected the power, ground and backlight control to 3.3v and Gnd on the Huzzah32. I connected the CS and DC to those pins and the SPI pins.
The only library I could find that seemed to have ILI9488 support is the TFT_eSPI library, so I installed that.
I opened the UTFT_Demo_480x320.ino example. I set all the pins in the User_Setup.h file according to the pins I wired up.
When I power the Huzzah32 the screen lights up so I have the backlight working right.
As the sketch runs the screen is white and then flashes sort of black / gray from for several seconds. Then it just stays white for a few seconds. Then flashes some more.
Anyone have any experience with this configuration or something close? What might I be doing wrong?
I am hoping it is just some define I didn't set that needs to be.
#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define TFT_MISO 19 // Do not connect to display SDO pin if other devices occupy SPI bus.
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 2 // Data Command control pin
#define TFT_RST 4 // Reset pin (could connect to RST pin)
#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_FREQUENCY 27000000
// #define SPI_FREQUENCY 40000000
// #define SPI_FREQUENCY 80000000
#define SPI_READ_FREQUENCY 20000000
The display is available with a number of interface options. Only a display configured for "4 wire SPI" will work with the library.
I have connected the RST line now and still get the same thing. Any more suggestions? I am using this setup and have double checked the pin connections multiple times:
The weird thing now is that I have RST line connected it only blinks a few times right after boot and then doesn't anymore. What controls the RST hi / low? The datasheet I have says it is active low.
Either way I am just getting this weird blinking of the screen. Any other ideas?
#define ILI9488_DRIVER // WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high)
#define TFT_MISO 19 #define TFT_MOSI 18 #define TFT_SCLK 5 #define TFT_CS 15 // Chip select control pin #define TFT_DC 32 // Data Command control pin #define TFT_RST 4 // Reset pin (could connect to RST pin)
#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_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT #define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
// Comment out the #define below to stop the SPIFFS filing system and smooth font code being loaded
// this will save ~20kbytes of FLASH #define SMOOTH_FONT
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
// #define SPI_FREQUENCY 40000000
// #define SPI_FREQUENCY 80000000
// Optional reduced SPI frequency for reading TFT #define SPI_READ_FREQUENCY 20000000
// The XPT2046 requires a lower SPI clock rate of 2.5MHz so we define that here: #define SPI_TOUCH_FREQUENCY 2500000
Arg, I feel really stupid. Turns out I was not putting the data / command pin to the right value in the header. As you can see in my post above it is 32, when I really have it solder to 33. I wanted it to be 33 because that is what the examples for Adafruit show. I don't know where I got 32. It might have been a default value somewhere and my old eyes didn't see the diff.
Now the example works and the display is working great.
Sorry for the trouble. Good learning lesson. Sometimes you can go over something a million times and if values are really close you still don't catch it.
Would you mind if I asked a TFT_eSPI question here? I am just wondering if your library does BLIT operations to speed things up and if you do does it work with the ILI9488.
I have been using the Adafruit GFX library with an ILI9143 and before it didn't have BLIT, but now it does. The speed up is pretty dramatic.
Yes, TFT_eSPI implements efficient bit block copying of memory to the screen. This can be achieved via the Sprite class, see examples. TFT_eSPI supports 1,4,8 and 16 bit memory images via the pushImage function.
On STM32 processors the image block copy can be achieved via DMA but the performance improvement from DMA is generally small due the the efficiency of the block transfer approach used.
When using an ESP32 the transaction support is automatically enabled because it is required to handle the dual processor mutex flags.
What connections are you using from the SD card and TFT to the ESP32?
I recommend you initialize the SD library first in setup() (i.e. before tft.begin();), this is because the TFT_eSPI constructor sets the TFT chip select high so the TFT does not then interfere with the SD initialization.
On the TFT break out board I have the SD and TFT SPI lines (miso, mosi, sck) connect together and then I have them going to the adafruit feather same lines as labeled. I then have a CS for the TFT and another for the SD on normal pins.
I will try what you said about trying to init the SD first. That is a good thing to try.
I did try removing the TFT CS line completely just to see if that would help, but it didn't.
I was able to figure it out. I wasn't thinking through it properly. I just had to connect the SDO from the SD card and not the TFT to the esp32 MISO.
Now the TFT and the SD seem to work at the same time.
Now if I can just figure out what kind of touch controller this has on it. I know it is the cap touch version, but I can't find any data on how it works. The datasheet doesn't say anything other than the pins being i2c.
Does anyone know what cap touch controller this is?