I am using an Arduino Mega 2560 and the adafruit ILI9341 library as the vendor specifies but I only manage to get a white screen.
I have tried replacing the wires, using another board (an Arduino UNO), and I have checked the connections many many times (pins 48 (DC), 49 (RST), 50 (MISO), 51 (MOSI), and 52 (SCK), 53(CS) + GRND + 5V).
I ran the graphictest example from the library and got lots of info, and according to chatgpt the problem could be in the MISO pin).
Extract of test:
ILI9341 Test!
Display Power Mode: 0x0
MADCTL Mode: 0x0
Pixel Format: 0x0
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark Time (microseconds)
Screen fill 1496768
Text 154492
Lines 1268804
(I got reasonable values in every of the following points).
Thanks a lot for the answer! I am using precisely that example.
I am a beginner in these topics, how can you tell that the reset pin should be handled like that?
That example was for a Uno or Nano and did not explicitly use the screen reset pin. Can you show how you modified it for the Mega because the pins are different for the Mega. Include the whole program if necessary.
although the link in post 1 states “Compatible con 5V, uso con lógica de 3,3V o 5V” (5V compatible, use with 3.3V or 5V logic) in general this type of display even if powered from 5V (link J1 is open) the display interface logic level is still 3.3V
connecting directly to UNO/MEGA/etc GPIO pins which use 5V logic can damage the display
I think this could be the problem, I have really tested many things and I have found other posts about TFT screens not being really 5V.
The TFT screen looks like a good choice for my project. What would you do on my situation? Just buy another TFT screen or another microcontroller board that supports 3.3V logic?
If you are using the code base as in the link in post #1 then you have to make changes to the code below to match your Mega (original code shown).
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
Note that the constructor which uses the screen reset pin is commented out and this pin should not be allowed to float.
I also have some experience with these ILI9341 screens (touch version) using ESP8266 and ESP32 but not used these with a 5v logic device such as a Uno. Logic level shifters would also be an option if, for example, you chose the Mega because you needed a huge number of GPIO pins.
if you need to use a Mega have a look at displays which plug into UNOs etc, e.g. mcufriend-2-4-tft-display
the problems of 5V/3.3V logic conversion are handled on the PCB