Pantalla TFT y arduino MEga2560

Hola, como están. Les quiero consultar tengo una placa mega2560 y una pantalla TFT con estas caracteristias: Tipo de pantalla: Módulo LCD TFT de 3,5 pulgadas

  • Tipo de cristal: TFT
  • Resolución de pantalla: 480XRGBX320 píxeles
  • Luz trasera: 6 chips LED blancos HighLight
    -Control IC: ILI9486/ILI9488
  • Interfaz: interfaz paralela de 16 bits
    La cuestión es que si la monto directamente sobre la placa (paralelo 16bits) no hay problemas anda perfectamente. Pero la necesito conectar vía SPI y no hay caso. La conexión que uso es esta: 5V -> 5V
    GND -> GND
    Pin 51 -> MOSI
    Pin 50 -> MISO
    Pin 52 -> CLK
    Pin 53 -> CS
    Pin 49 -> RS
    Pin 46 -> RST
    En un código de prueba para verificar la conexión me dice: "El problema principal es que el Arduino está enviando datos, pero no recibe respuesta"
    Me podrán orientar qué puede ser o cómo puedo hacer
    Muchas gracias

Lee las normas, mira como se publican los códigos, y postea tu código ejemplo porque es imposible responderte si no lo haces.

Buenos días, no creo que el error o la dificultad vaya por el código, pero bueno.
El código que utilizo para la conexión en paralelo es cualquiera de los ejemplos de la libraría TFT_HX8357 ej Graph.2 Por lo cual esto indicaría que la pantalla funciona.

#include <TFT_HX8357.h> // Hardware-specific library

#include "Free_Fonts.h" // Include the header file attached to this sketch

TFT_HX8357 tft = TFT_HX8357();       // Invoke custom library

unsigned long drawTime = 0;

void setup(void) {

  tft.begin();

  tft.setRotation(1);

}

void loop() {

  int xpos =  0;
  int ypos = 40;

  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  // Select different fonts to draw on screen using the print class
  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

  tft.fillScreen(TFT_NAVY); // Clear screen to navy background

  header("Draw free fonts using print class");

  // For comaptibility with Adafruit_GFX library the text background is not plotted when using the print class
  // even if we specify it.
  tft.setTextColor(TFT_YELLOW, TFT_BLACK);
  tft.setCursor(xpos, ypos);    // Set cursor near top left corner of screen

  tft.setFreeFont(GLCD);     // Select the orginal small GLCD font by using NULL or GLCD
  tft.println();             // Move cursor down a line
  tft.print("Original GLCD font");    // Print the font name onto the TFT screen
  tft.println();
  tft.println();

  tft.setFreeFont(FSB9);   // Select Free Serif 9 point font, could use:
  // tft.setFreeFont(&FreeSerif9pt7b);
  tft.println();          // Free fonts plot with the baseline (imaginary line the letter A would sit on)
  // as the datum, so we must move the cursor down a line from the 0,0 position
  tft.print("Serif Bold 9pt");  // Print the font name onto the TFT screen

  tft.setFreeFont(FSB12);       // Select Free Serif 12 point font
  tft.println();                // Move cursor down a line
  tft.print("Serif Bold 12pt"); // Print the font name onto the TFT screen

  tft.setFreeFont(FSB18);       // Select Free Serif 12 point font
  tft.println();                // Move cursor down a line
  tft.print("Serif Bold 18pt"); // Print the font name onto the TFT screen

  tft.setFreeFont(FSB24);       // Select Free Serif 24 point font
  tft.println();                // Move cursor down a line
  tft.print("Serif Bold 24pt"); // Print the font name onto the TFT screen


  delay(4000);

  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  // Now use drawString() so we can set background colours and the datum
  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

  tft.fillScreen(TFT_BLACK);

  header("Draw with background using drawString()");

  tft.setTextColor(TFT_WHITE, TFT_BLACK);

  tft.setTextDatum(TC_DATUM); // Centre text on x,y position

  xpos = tft.width() / 2; // Half the screen width
  ypos = 50;

  tft.setFreeFont(FSB9);                              // Select the font
  tft.drawString("Serif Bold 9pt", xpos, ypos, GFXFF);  // Draw the text string in the selected GFX free font
  ypos += tft.fontHeight(GFXFF);                      // Get the font height and move ypos down

  tft.setFreeFont(FSB12);
  tft.drawString("Serif Bold 12pt", xpos, ypos, GFXFF);
  ypos += tft.fontHeight(GFXFF);

  tft.setFreeFont(FSB18);
  tft.drawString("Serif Bold 18pt", xpos, ypos, GFXFF);
  ypos += tft.fontHeight(GFXFF);

  tft.setFreeFont(FSB24);
  tft.drawString("Serif Bold 24pt", xpos, ypos, GFXFF);
  ypos += tft.fontHeight(GFXFF);

  // Set text padding to 120 pixels wide area to over-write old values on screen
  tft.setTextPadding(120);
  for (int i = 0; i <= 20; i++) {
    tft.drawFloat(i / 10.0, 1, xpos, ypos, GFXFF);
    delay (200);
  }

  delay(4000);

  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  // Same again but with colours that show bounding boxes
  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


  tft.fillScreen(TFT_DARKGREY);

  header("Show background filled bounding boxes");

  tft.setTextColor(TFT_YELLOW, TFT_BLACK);

  tft.setTextDatum(TC_DATUM); // Centre text on x,y position

  xpos = tft.width() / 2; // Half the screen width
  ypos = 50;

  tft.setFreeFont(FSB9);                              // Select the font
  tft.drawString("Serif Bold 9pt", xpos, ypos, GFXFF);  // Draw the text string in the selected GFX free font
  ypos += tft.fontHeight(GFXFF);                        // Get the font height and move ypos down

  tft.setFreeFont(FSB12);
  tft.drawString("Serif Bold 12pt", xpos, ypos, GFXFF);
  ypos += tft.fontHeight(GFXFF);

  tft.setFreeFont(FSB18);
  tft.drawString("Serif Bold 18pt", xpos, ypos, GFXFF);
  ypos += tft.fontHeight(GFXFF);

  tft.setFreeFont(FSBI24);
  tft.drawString("Serif Bold Italic 24pt", xpos, ypos, GFXFF);
  ypos += tft.fontHeight(GFXFF);

  // Set text padding to 120 pixels wide area to over-write old values on screen
  tft.setTextPadding(120);
  for (int i = 0; i <= 20; i++) {
    tft.drawFloat(i / 10.0, 1, xpos, ypos, GFXFF);
    delay (200);
  }

  delay(4000);

  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  // Now show setting the 12 datum positions works with free fonts
  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

  // Numbers, floats and strings can be drawn relative to a datum
  tft.fillScreen(TFT_BLACK);
  header("Draw text relative to a datum");

  tft.setTextColor(TFT_DARKGREY, TFT_BLACK);
  tft.setFreeFont(FSS9);
  
  tft.setTextDatum(TL_DATUM);
  tft.drawString("[Top left}", 20, 60, GFXFF);
  drawDatum(20,60);

  tft.setTextDatum(TC_DATUM);
  tft.drawString("[Top centre]", 240, 60, GFXFF);
  drawDatum(240,60);

  tft.setTextDatum(TR_DATUM);
  tft.drawString("[Top right]", 460, 60, GFXFF);
  drawDatum(460,60);

  tft.setTextDatum(ML_DATUM);
  tft.drawString("[Middle left]", 20, 140, GFXFF);
  drawDatum(20,140);

  tft.setTextDatum(MC_DATUM);
  tft.drawString("[Middle centre]", 240, 140, GFXFF);
  drawDatum(240,140);

  tft.setTextDatum(MR_DATUM);
  tft.drawString("[Middle right]", 460, 140, GFXFF);
  drawDatum(460,140);

  tft.setTextDatum(BL_DATUM);
  tft.drawString("[Bottom Left]", 20, 220, GFXFF);
  drawDatum(20,220);

  tft.setTextDatum(BC_DATUM);
  tft.drawString("[Bottom centre]", 240, 220, GFXFF);
  drawDatum(240,220);

  tft.setTextDatum(BR_DATUM);
  tft.drawString("[Bottom right]", 460, 220, GFXFF);
  drawDatum(460,220);

  tft.setTextDatum(L_BASELINE);
  tft.drawString("[Left baseline]", 20, 300, GFXFF);
  drawDatum(20,300);

  tft.setTextDatum(C_BASELINE);
  tft.drawString("[Centre baseline]", 240, 300, GFXFF);
  drawDatum(240,300);

  tft.setTextDatum(R_BASELINE);
  tft.drawString("[Right baseline]", 460, 300, GFXFF);
  drawDatum(460,300);

  //while(1);
  delay(8000);

}

// Print the header for a display screen
void header(char *string)
{
  tft.setTextSize(1);
  tft.setTextColor(TFT_MAGENTA, TFT_BLUE);
  tft.fillRect(0, 0, 480, 30, TFT_BLUE);
  tft.setTextDatum(TC_DATUM);
  tft.drawString(string, 239, 2, 4); // Font 4 for fast drawing with background
}

// Draw a + mark centred on x,y
void drawDatum(int x, int y)
{
  tft.drawLine(x - 5, y, x + 5, y, TFT_GREEN);
  tft.drawLine(x, y - 5, x, y + 5, TFT_GREEN);
}


// There follows a crude way of flagging that this example sketch needs fonts which
// have not been enbabled in the User_Setup.h file inside the TFT_HX8357 library.
//
// These lines produce errors during compile time if settings in User_Setup are not correct
//
// The error will be "does not name a type" but ignore this and read the text between ''
// it will indicate which font or feature needs to be enabled
//
// Either delete all the following lines if you do not want warnings, or change the lines
// to suit your sketch modifications.

#ifndef LOAD_GLCD
//ERROR_Please_enable_LOAD_GLCD_in_User_Setup
#endif

#ifndef LOAD_FONT2
//ERROR_Please_enable_LOAD_FONT2_in_User_Setup!
#endif

#ifndef LOAD_FONT4
//ERROR_Please_enable_LOAD_FONT4_in_User_Setup!
#endif

#ifndef LOAD_FONT6
//ERROR_Please_enable_LOAD_FONT6_in_User_Setup!
#endif

#ifndef LOAD_FONT7
//ERROR_Please_enable_LOAD_FONT7_in_User_Setup!
#endif

#ifndef LOAD_FONT8
//ERROR_Please_enable_LOAD_FONT8_in_User_Setup!
#endif

#ifndef LOAD_GFXFF
ERROR_Please_enable_LOAD_GFXFF_in_User_Setup!
#endif
`

el código que utilizo para poder conectar en modo SPI es el siguiente: `

#include <SPI.h>

// Definición de pines para modo SPI
#define TFT_CS   53    // Chip Select
#define TFT_RST  49    // Reset
#define TFT_DC   48    // Data/Command (RS)
#define SD_CS    47    // SD Card Chip Select

void setup() {
  Serial.begin(9600);
  Serial.println("Iniciando prueba de pantalla TFT SPI");
  
  // Configurar pines
  pinMode(TFT_CS, OUTPUT);
  pinMode(TFT_RST, OUTPUT);
  pinMode(TFT_DC, OUTPUT);
  pinMode(SD_CS, OUTPUT);
  
  // Asegurar que SD está desactivado
  digitalWrite(SD_CS, HIGH);
  
  // Inicializar SPI
  SPI.begin();
  SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
  
  // Reset de la pantalla
  digitalWrite(TFT_RST, HIGH);
  delay(10);
  digitalWrite(TFT_RST, LOW);
  delay(10);
  digitalWrite(TFT_RST, HIGH);
  delay(150);
  
  // Prueba básica de comunicación
  testSPICommunication();
}

void testSPICommunication() {
  Serial.println("Probando comunicación SPI...");
  
  // Seleccionar pantalla
  digitalWrite(TFT_CS, LOW);
  
  // Enviar comando de lectura de ID (0x04)
  digitalWrite(TFT_DC, LOW);  // Comando
  SPI.transfer(0x04);
  
  digitalWrite(TFT_DC, HIGH);  // Datos
  // Leer 4 bytes de respuesta
  byte response[4];
  for(int i = 0; i < 4; i++) {
    response[i] = SPI.transfer(0x00);
  }
  
  digitalWrite(TFT_CS, HIGH);
  
  // Mostrar respuesta
  Serial.print("ID recibido: 0x");
  for(int i = 0; i < 4; i++) {
    if(response[i] < 0x10) Serial.print("0");
    Serial.print(response[i], HEX);
  }
  Serial.println();
}

void loop() {
  // Nada en el loop
}`

En mi ignorancia deduzco que estoy conectando mal o hay algo que tengo que tener en cuanta y que estoy obviando. La pantalla no funciona con conexión spi (cuando tiene los pines para ello) y más que de software es un tema de hardware (creería). Pero bueno, me dirán ustedes. Por lo pronto, muchas gracias

Veo dos ejemplos donde se instancia el objeto con las características del TFT pero en este no y parece coincidir con la resolución de tu TFT

Puedes probarlo?

Ya lo he probado y no funciona. Me podrías orientar hacia donde buscar el posible error?

Y si cometí un error al momento de comprar esa pantalla, no contemplando que se conecta usando todos los pines. Hay algún modulo que sirva de adaptador como es el caso de los I2C a las pantallas LCD. Consulto porque, por más que estén los pines disponibles para conexión SPI toda la info que encontré en internet es en paralelo. Y en las reseñas de la paginas también dice que el SPI no les funciona.

Las pantallas funcionan solo que hay que buscarles la vuelta.. y eso a veces es muy frustrante. Se paciente. Toma papel y lápiz y no repitas conexiones pero dejar registrado que has hecho para no repetir lo mismo una y otra vez.
Ahora miro y te digo cómo intentarlo.

Tienes algo asi?

Acá tenes una posible sugerencia al final

I suggest that you install Bodmer's TFT_HX8357. <-- Esto es lo que usas
Configure User_Setup.h file for ILI9486. <-- Aca debe estar el problema
Run every example.

Pero lo que estas usando debe funcionar.

Estoy seguro que con esa simple modificación saldrá funcionando.
Esto esta en


cambia surby por tu usuario

Asi esta por defecto

asi debe quedar User_Setup.h

Mira el User_Setup y observa donde te ponga <== ACA

//                            USER DEFINED SETTINGS V6
//  This library supports the Mega and HX8357B/C, ILI9481 and ILI9486 display drivers
//
//                 Set fonts to be loaded and speed up options below


// ##################################################################################
//
// Define ONE driver, either HX8357B, HX8357C, ILI9481 or ILI9486
//
// ##################################################################################

//#define HX8357B // <== este estaba activo por defecto
//#define HX8357C
//#define ILI9481
#define ILI9486  // <=== ACA debes descomentar

// ##################################################################################
//
// Define the display width and height in pixels in portrait orientation
//
// ##################################################################################

#define HX8357_TFTWIDTH  320
#define HX8357_TFTHEIGHT 480

// ##################################################################################
//
// Define the fonts that are to be used here
//
// ##################################################################################

// Comment out the #defines below with // to stop that font being loaded
//
// If all fonts are loaded the extra FLASH space required is about 17000 bytes...
// To save FLASH space only enable the fonts you need!
// In practice a Mega has plenty of FLASH to hold all fonts, so the main gain is
// faster sketch upload due to smaller size
// If free fonts are not needed then there is some performance gain if LOAD_GFXFF
// is commented out

#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

// ##################################################################################
//
// Define the character to be used to detemine the text bounding box for datum changes
//
// ##################################################################################

#define FF_HEIGHT '/'  // '/' character used to set free font height above the baseline
#define FF_BOTTOM 'y'  // 'y' character used to set free font height below baseline


// ##################################################################################
//
// Speed up options (hardly worth changing when using a Due!)
//
// ##################################################################################

// Run faster by stopping most screen boundary limit checks
// Comment out the following #define to stop boundary checking and clipping
// for fillRectangle()and fastH/V lines. This speeds up other funtions such as text
// rendering where size>1. Sketch then must not draw graphics/text outside screen
// boundary. Code saving for no bounds check (i.e. commented out) is small.

#define CLIP_CHECK


// Render fonts slightly faster, only enable if you DO NOT use setTextSize(n)
// with values of 'n' greater than 1, when enabled the code that alows the
// text size to be multiplied is not included.

//#define FIXED_SIZE 


// Uncomment next #define to run faster by keeping CS low
// This only speeds things up a little (0 - 2%)
// We can do this safely as the CS line is not shared with other functions

//#define KEEP_CS_LOW


// ##################################################################################
//
// These defines are used to set different datums for drawing text and numbers
//
// ##################################################################################

// These enumerate the text plotting alignment (reference datum point)
// use in the setTextDatum() function

#define TL_DATUM 0 // Top left (default)
#define TC_DATUM 1 // Top centre
#define TR_DATUM 2 // Top right
#define ML_DATUM 3 // Middle left
#define CL_DATUM 3 // Centre left, same as above
#define MC_DATUM 4 // Middle centre
#define CC_DATUM 4 // Centre centre, same as above
#define MR_DATUM 5 // Middle right
#define CR_DATUM 5 // Centre right, same as above
#define BL_DATUM 6 // Bottom left
#define BC_DATUM 7 // Bottom centre
#define BR_DATUM 8 // Bottom right
#define L_BASELINE  9 // Left character baseline (Line the 'A' character would sit on)
#define C_BASELINE 10 // Centre character baseline
#define R_BASELINE 11 // Right character baseline

// ##################################################################################
//
// These are the default colour definitions, others can be added here
//
// ##################################################################################

// New color definitions, used for all my TFT libraries
#define TFT_BLACK       0x0000
#define TFT_NAVY        0x000F
#define TFT_DARKGREEN   0x03E0
#define TFT_DARKCYAN    0x03EF
#define TFT_MAROON      0x7800
#define TFT_PURPLE      0x780F
#define TFT_OLIVE       0x7BE0
#define TFT_LIGHTGREY   0xC618
#define TFT_DARKGREY    0x7BEF
#define TFT_BLUE        0x001F
#define TFT_GREEN       0x07E0
#define TFT_CYAN        0x07FF
#define TFT_RED         0xF800
#define TFT_MAGENTA     0xF81F
#define TFT_YELLOW      0xFFE0
#define TFT_WHITE       0xFFFF
#define TFT_ORANGE      0xFD20
#define TFT_GREENYELLOW 0xAFE5
#define TFT_PINK        0xF81F

// Color definitions for backwards compatibility
#define HX8357_BLACK       0x0000
#define HX8357_NAVY        0x000F
#define HX8357_DARKGREEN   0x03E0
#define HX8357_DARKCYAN    0x03EF
#define HX8357_MAROON      0x7800
#define HX8357_PURPLE      0x780F
#define HX8357_OLIVE       0x7BE0
#define HX8357_LIGHTGREY   0xC618
#define HX8357_DARKGREY    0x7BEF
#define HX8357_BLUE        0x001F
#define HX8357_GREEN       0x07E0
#define HX8357_CYAN        0x07FF
#define HX8357_RED         0xF800
#define HX8357_MAGENTA     0xF81F
#define HX8357_YELLOW      0xFFE0
#define HX8357_WHITE       0xFFFF
#define HX8357_ORANGE      0xFD20
#define HX8357_GREENYELLOW 0xAFE5
#define HX8357_PINK        0xF81F


// ##################################################################################
//
// End of User_Setup.h
//
// ##################################################################################

La pantalla es precisamente esa. Esa indicación ya la probé incluso realizando ese cambio en otras librerías. Y no funciona. Algo más que pueda probar? Por otra parte en códigos que he probado me han dado como resultado que detecta un id de la pantalla, pero que detecte la id no determina que garantice la conexión

 #include <SPI.h>
#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>

MCUFRIEND_kbv tft;

// Colores predefinidos (valores RGB565)
#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);
  Serial.println("Iniciando prueba de pantalla TFT ILI9486_IPS...");
  
  // Inicializar la pantalla
  uint16_t ID = tft.readID();
  Serial.print("ID de pantalla TFT: 0x");
  Serial.println(ID, HEX);
  
  // Si readID retorna 0 o 0xD3D3, prueba con ID manual
  if (ID == 0x0000 || ID == 0xD3D3) {
    ID = 0x9486; // ID forzado para ILI9486
    Serial.println("Usando ID forzado: 0x9486");
  }
  
  tft.begin(ID);
  Serial.println("Pantalla inicializada");
  
  // Orientación de la pantalla (0-3)
  tft.setRotation(1);
  
  // Prueba básica - llenar la pantalla con colores
  Serial.println("Ejecutando prueba de colores...");
  
  // Limpiar pantalla - Negro
  tft.fillScreen(BLACK);
  delay(1000);
  
  // Rojo
  tft.fillScreen(RED);
  delay(1000);
  
  // Verde
  tft.fillScreen(GREEN);
  delay(1000);
  
  // Azul
  tft.fillScreen(BLUE);
  delay(1000);
  
  // Dibujar texto y elementos
  tft.fillScreen(BLACK);
  delay(500);
  
  // Texto grande
  tft.setCursor(80, 100);
  tft.setTextColor(WHITE);
  tft.setTextSize(3);
  tft.println("PRUEBA OK!");
  
  // Dibujar un rectángulo
  tft.drawRect(50, 180, 380, 50, YELLOW);
  
  // Texto en el rectángulo
  tft.setCursor(60, 195);
  tft.setTextColor(CYAN);
  tft.setTextSize(2);
  tft.println("Conexion SPI correcta");
  
  Serial.println("Prueba completada");
}

void loop() {
  // Animación simple para verificar que la pantalla sigue funcionando
  static int x = 0;
  
  // Dibujar un punto que se mueve de izquierda a derecha
  tft.drawPixel(x, 300, RED);
  x = (x + 1) % tft.width();
  delay(10);
  
  // Borrar rastro del punto (opcional)
  if (x % 10 == 0) {
    tft.drawLine(x-10, 300, x-1, 300, BLACK);
  }
  
  // Imprimir información cada 5 segundos
  static unsigned long lastTime = 0;
  if (millis() - lastTime > 5000) {
    Serial.println("La pantalla está funcionando...");
    lastTime = millis();
  }
}

Y el monitor serie muestra:
Iniciando prueba de pantalla TFT ILI9486_IPS... ID de pantalla TFT: 0xD3D3 Usando ID forzado: 0x9486 Pantalla inicializada Ejecutando prueba de colores... Prueba completada La pantalla está funcionando... Pero en la pantalla no se ve nada

Entiendo que el monitor serial muestra que el código se está ejecutando correctamente, pero la pantalla sigue sin mostrar nada visible a pesar de la retroiluminación encendida. Esto indica que hay comunicación con la pantalla (ya que detecta un ID), pero hay algún problema que impide que se muestre el contenido.
Intente comunicarme con el fabricante hace una semana y no creo que responda.

Revisaste la pantalla, tiene bien las soldaduras?
Revisa también la salida del AMS1117, le llegan 5V y salen 3.3V?


Las soldaduras están bien. Pero me encontré con una sorpresa. Estas pantallas genéricas chinas parecen todas iguales pero no lo son. La primer sorpresa es que no coincide la imagen de la pantalla de la pagina con la que me mandaron:
Pag Web: Amazon.es
O en su defecto la foto:


Y la que yo tengo es esta:

Y una de las diferencias es lo que me estás marcando, no tiene el AMS1117 tiene un 662K. Debo aclara que de electrónica dura, pura no se nada. El 662K lo mido y en el vin 5v mide 4.8v y se me da por medir los 5v del mega y mide 4.8v . No se si eso es representativo o no

Un dato adicional, no descarto que el voltaje tenga o no que ver pero , pero intenté conectarlo a un arduino UNO donde el voltaje si está bien y no pude por una cuestión de memoria " El error "Sketch too big" significa que el código es demasiado grande para la memoria del Arduino Uno, que solo tiene 32 KB de flash. La librería TFT_eSPI y las pantallas con controladores como el ILI9486 pueden ocupar más espacio del disponible en un Arduino Uno. A no ser que me orienten con un código mas liviano). Probé conectarlo a un ESP32 Wroom donde el voltaje es 3.3 y está bien y tampoco funciona la pantalla

Respecto del regulador mientras leas 3.3V a la salida que corresponda, esta bien.

Acá se lee


IL19486_IPS
Y eso coincide con lo que te puse pero IPS, no habrá alguna variante?

No pierdas el tiempo con el UNO, ademas esta todo pensado para el conector del MEGA.

Con respecto al _IPS no encontré ninguna variante. Información adicional sobre la marca Binghe y el modelo YY1-0042 no aparece nada. Lo que me está diciendo, nunca más comprar sin documentación específica sobre el hardware.
Por otro lado les quiero preguntar que tan significativo es esto: con un código que presento a continuación me dice que no detecta el id de la pantalla

#include <MCUFRIEND_kbv.h>

MCUFRIEND_kbv tft;

void setup() {
  Serial.begin(9600);
  uint16_t ID = tft.readID();
  Serial.print("Pantalla detectada con ID: 0x");
  Serial.println(ID, HEX);

  if (ID == 0xD3D3) {
    Serial.println("ID no válido. Intentando forzar un ID conocido...");
    ID = 0x9486; // Prueba con 0x9486 o el ID correcto de tu pantalla
  }

  tft.begin(ID);
  tft.fillScreen(TFT_BLUE);
}

void loop() {}

Entiendo lo que puede significar eso pero por otro lado cuando la conecto en paralelo (montada en el mega) con la librería de
Bodmer/TFT_HX8357
cualquiera de los ejemplos anda perfectamente. Que no es poca cosa. Anda

Cualquier centro que me tiren será bienvenido para seguir investigando y no subsumirme en la angustia y desesperación. Buen fin de semana.

Solo consulta por un ID y el que lee no coincide.
Dices que no presenta nada con estas dos líneas?

Serial.print("Pantalla detectada con ID: 0x");
  Serial.println(ID, HEX);

No se que decirte porque muchas cosas las hago sin entender muy bien lo que estoy haciendo.
Les quiero consultar. Me bajé el Datasheet del ILI9486 y la verdad que admite todo tipo de conexión, es una maravilla, pero en la pantalla solo puedo usar en paralelo de 16 bits porque en 8 tampoco pude. La pregunta es la siguiente. Puede ser esto (link de mercado libre) una solución?
1- https://articulo.mercadolibre.com.ar/MLA-708048087-arduino-mega-shield-lcd-tft-touch-screen-adaptador-v20-_JM#polycard_client=bookmarks&wid=MLA708048087&sid=bookmarks

2- https://articulo.mercadolibre.com.ar/MLA-1436002627-placa-mega-shield-lcd-tft-touch-screen-adaptador-v22-ba-_JM#polycard_client=bookmarks&wid=MLA1436002627&sid=bookmarks

Lo que yo no sé es cómo este Shield se conecta después a la mega. Porque la pantalla entraría perfecto pero si despues del shield al mega tengo que respetar el paralelo no me sirve .

Los chips intermedios U2, U3 y U4, probablemente estén haciendo ruido a la conexión SPI. El chip más parecido al HX8xxx es el ST7796x, que es la versión más actual. Existen ya adaptados a protocolo SPI, como el TFT Display ST7796s de 3.5". Tiene SPI y paralelo:

Como puedes notar este TFT no tiene los chips de conversión 3.3V a 5V, que seguramente interfieren con tu cableado experimental paralelo a SPI. No pierdas de vista que la gran mayoría de TFT´s diseñados para MCU arduino-AVR son nativamente dispositivos de 3.3V, adaptados para funcionar con lógica de 5V.

Las librerías para protocolo paralelo esperan respuesta de los pines DB0-DB11, por lo que habrá que adaptarlas para que puedan responder al protocolo SPI.

Existen rutinas de escritura/lectura para el protocolo SPI que resultan algo complicadas de entender y que no todo mundo considera en sus ajustes, hasta ahora esta rutina se me ha complicado bastante tratando de hacerla funcionar en un arduino R4 minima

#if defined(ARDUINO) && !defined(__DUE__) && !defined(ESP8266) && !defined(ESP32) && !defined(ARDUINO_ARCH_STM32L4) && !defined(ARDUINO_ARCH_STM32) && !defined(ARDUINO_UNOR4_MINIMA)
  void wr_n(uint32_t addr, byte *src, uint16_t n)
  {
    __end(); // stop streaming
    __wstart(addr);
    while (n--) {
      SPDR = *src++;
      asm volatile("nop");
      asm volatile("nop");
      asm volatile("nop");
      asm volatile("nop");
      asm volatile("nop");
      asm volatile("nop");
      asm volatile("nop");
      asm volatile("nop");
      asm volatile("nop");
      asm volatile("nop");
    }
    while (!(SPSR & _BV(SPIF))) ;
    stream();
  }
#else
  void wr_n(uint32_t addr, byte *src, uint16_t n)
  {
    __end(); // stop streaming
    __wstart(addr);
#if defined(ESP8266) || defined(ESP32)
    SPI.writeBytes(src, n);
#elif defined(ARDUINO_ARCH_STM32)
    SPI.write(src, n);
#else
    while (n--)
      SPI.transfer(*src++);
#endif
    stream();
  }
#endif

Lo que trato de decirte, es que este tipo de rutinas son las que se usan para el protocolo SPI, y no son tan fáciles de entender y mucho menos adaptar.

A veces la simplicidad en el protocolo SPI tiene que ver más con la arquitectura del MCU, que con la del hardware que queremos usar. Luego de darle muchas vueltas, decidí alejarme de la R4-Minima y de AVR, esta es la rutina para una placa teensy 4.1 y un TFT de la familia EVE2-EVE3-EVE4

void wr_n(uint32_t addr, byte *src, uint16_t n)
  {
    __end(); // stop streaming
    __wstart(addr);

    while (n--)
    SPI.transfer(*src++);
    stream();
  }

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