Arduino Mega 2560 TFT 2.8 issue

Hey guys, I've been struggling for days, my screen works fine on the Arduino Uno, no problem there.
But I can't get any output on the Mega 2560.
I'm attaching the code and images below; could you please take a look, coding experts?


#include <ILI9486_SPI.h> //Hardware-specific library
#if (defined(TEENSYDUINO) && (TEENSYDUINO == 147))
ILI9486_SPI tft(/*CS=*/ 10, /*DC=*/ 15, /*RST=*/ 14);
// for my wirings used for e-paper displays:
#elif defined (ESP8266)
ILI9486_SPI tft(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2); // my D1 mini connection shield for e-paper displays
//ILI9486_SPI tft(/*CS=D8*/ SS, /*DC=D4*/ 2, /*RST=D3*/ 0); // my proto board for RPi display
#elif defined(ESP32)
ILI9486_SPI tft(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16);
#elif defined(_BOARD_GENERIC_STM32F103C_H_)
ILI9486_SPI tft(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2);
#elif defined(__AVR)
ILI9486_SPI tft(/*CS=10*/ 8, /*DC=*/ 10, /*RST=*/ 9);
#elif defined(ARDUINO_ARCH_SAM)
ILI9486_SPI tft(/*CS=10*/ SS, /*DC=*/ 6, /*RST=*/ 5); // my proto board
#elif defined(ARDUINO_ARCH_SAMD)
// mapping suggestion for Arduino MKR1000 or MKRZERO
// note: can't use SS on MKR1000: is defined as 24, should be 4
// BUSY -> 5, RST -> 6, DC -> 7, CS-> 4, CLK -> 9, DIN -> 8 // my e-paper connector
ILI9486_SPI tft(/*CS=*/ 4, /*DC=*/ 7, /*RST=*/ 6); // to my proto board
#else
// catch all other default
ILI9486_SPI tft(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9);
#endif

#if !defined(ESP8266)
#define yield()
#endif

#define BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF


void setup() {
  
 Serial.begin(9600); 
tft.setSpiKludge(false);
tft.init();
tft.fillScreen(RED); tft.setRotation(1); tft.setTextColor(WHITE);  tft.setTextSize(4);
tft.setCursor(30, 30);  tft.setRotation(1);
  tft.setTextColor(WHITE);  tft.setTextSize(2);
tft.drawLine(10, 10, 60, 60, WHITE);
tft.drawFastHLine(30, 20, 40, WHITE);
tft.drawRect(50,50, 80, 100, WHITE);
tft.fillRect(200, 150, 100, 60, BLACK);
tft.fillCircle(200, 100, 30, GREEN);
tft.drawTriangle(40, 5, 40, 60, 70, 60, BLACK);
tft.fillTriangle(70, 70, 20, 200, 90, 50, YELLOW);
tft.drawRoundRect(400, 150, 60, 10, 20, BLUE);
tft.fillRoundRect(100, 150, 60, 50, 20, BLUE);  

pinMode(A0,INPUT);            
}

void loop() {

float X=analogRead(A0);
tft.setCursor(300, 130); 
tft.setTextColor(WHITE);
tft.setTextSize(2); 
tft.setRotation(1);
tft.println(X,1);



delay(100);
//tft.init(X);
}

Can you post an annotated schematic showing exactly how you have wired it. I cannot follow your pictures. From what I can see you may have loose wires.

Of course I will send it

Sorry I cannot follow your picture, to much information is missing, signals are not labeled. See if this link helps: https://simple-circuit.com/interfacing-arduino-ili9341-tft-display/
It appears the SPI in not properly wired, check this: https://detailspin.com/arduino/arduino-mega-spi-pinouts.html

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.