# 3.2 tft SPI 240x320 14P only shows half the screen

**URL:** <https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860>\
**Category:** General Guidance\
**Created:** [April 25, 2024, 4:52am UTC](https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860 "2024-04-25T04:52:39Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff100](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@jeff100](https://forum.arduino.cc/u/jeff100)\
**Post date:** [April 25, 2024, 4:52am UTC](https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860/1 "2024-04-25T04:52:39Z")

</div>

I need help please. I bought a 3.2 TFT SPI 240x320 14P V1.0 touch screen with XPT2046 chip specifically for my research and every time, it only shows half the screen. I am not an expert on this but simply trying my best but I always ends up with a half screen working. I change the pins and libraries several times according to the uploaded projects already on the internet but no luck. I need steps on what to do please to whoever reading this post. Please help me.

 ![438231752_410959051560557_3677132905345002297_n](https://europe1.discourse-cdn.com/arduino/original/4X/e/e/f/eefa4712957945ade7fa934caf553f34f3d51922.jpeg)  
 ![438237599_450413377354648_1755573450100211827_n](https://europe1.discourse-cdn.com/arduino/original/4X/7/6/d/76d24fa17f1922bd89c4013bf851522ca37cd9da.jpeg)

This is the screen that only shows half,

 ![438223263_1221975238774885_3129578586041012428_n](https://europe1.discourse-cdn.com/arduino/original/4X/1/d/c/1dcc06d3ab5a3d9eced36cb8d26e0b72bf641879.jpeg)

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [April 25, 2024, 5:08am UTC](https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860/2 "2024-04-25T05:08:40Z")

</div>

As outlined in [How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966), you have omitted quite a few critical pieces of information. By no means a complete list: what board you are using, your sketch, properly formatted with the `<CODE/>` tool, and a schematic (one drawn with pen and paper is fine, Fritzing style diagrams are generally not useful).

---

<div class="post-metadata">

**Author:** ![jeff100](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@jeff100](https://forum.arduino.cc/u/jeff100)\
**Post date:** [April 25, 2024, 5:34am UTC](https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860/3 "2024-04-25T05:34:10Z")

</div>

Thank you for your reply I wish you have a great day

I'm using arduino Uno and I used this code first with simple text display

```arduino
#include <Adafruit_GFX.h>    
#include <Adafruit_ILI9341.h> 

#define TFT_CS 10
#define TFT_RST 9
#define TFT_DC 8

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

void setup() {
  Serial.begin(9600);
  tft.begin();
  tft.setRotation(3); 
  tft.fillScreen(ILI9341_BLACK); 

  tft.setTextColor(ILI9341_WHITE);
  

  tft.setTextSize(2);
  

  tft.setCursor(30, 80);
  

  tft.print("Hello, World!");
}

void loop() {
  // Nothing to loop here since we are displaying static content in setup()
}

```

then the schematics i used is based on other project that are already on the internet  
 ![418663197_2346908202161655_1773772017096427269_n](https://europe1.discourse-cdn.com/arduino/original/4X/8/4/6/846ef01409ef30de6a50b6a020d0674d93d46f2e.jpeg)

but its the same, the screen is always half. I used the newest Adafruit\_ILI9341 library, and Adafruit\_GFX\_Library.

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [April 25, 2024, 6:23am UTC](https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860/4 "2024-04-25T06:23:55Z")

</div>

Assuming your display is actually using an ILI9341 controller, my eye is drawn to those 1K series resistors standing in for proper level shifters. I'm less than sanguine about those for a couple of reasons. One, the fact that there's one on the MISO line tells me that the originator really didn't know what they were doing. And two, I vaguely remember another instance where someone was only getting a partial display on an LCD display, and that ended up being because they had a 3.3V level display hooked directly into a 5V level board. Once they added proper level shifters the display worked just fine.

---

<div class="post-metadata">

**Author:** ![jeff100](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@jeff100](https://forum.arduino.cc/u/jeff100)\
**Post date:** [April 25, 2024, 6:32am UTC](https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860/5 "2024-04-25T06:32:47Z")

</div>

I also used this setup with 5.1k and 2.2k resistor and after I downloaded the Libraries i just used the graphic test that comes with the library but still only half of the screen is working

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/f/b/7/fb719f184f1e9710edf3d0ec72064dc7169b248b.jpeg)

```arduino
/ ***************************************************
  This is our GFX example for the Adafruit ILI9341 Breakout and Shield
  ----> http://www.adafruit.com/products/1651

  Check out the links above for our tutorials and wiring diagrams
  These displays use SPI to communicate, 4 or 5 pins are required to
  interface (RST is optional)
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 **************************************************** /

#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
#define TFT_RST 8
//#define TFT_MOSI 11
//#define TFT_CLK 13
//#define TFT_MISO 12

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
// 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);

void setup() {
  Serial.begin(9600);
  Serial.println("ILI9341 Test!"); 
 
//deselect all SPI devices
pinMode (TFT_CS, OUTPUT);
pinMode(7, OUTPUT);
digitalWrite(TFT_CS, HIGH);
digitalWrite(7, HIGH);

tft.begin();

  // read diagnostics (optional but can help debug problems)
  uint8_t x = tft.readcommand8(ILI9341_RDMODE);
  Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDMADCTL);
  Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDPIXFMT);
  Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDIMGFMT);
  Serial.print("Image Format: 0x"); Serial.println(x, HEX);
  x = tft.readcommand8(ILI9341_RDSELFDIAG);
  Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX); 
  
  Serial.println(F("Benchmark Time (microseconds)"));
  delay(10);
  Serial.print(F("Screen fill "));
  Serial.println(testFillScreen());
  delay(500);

  Serial.print(F("Text "));
  Serial.println(testText());
  delay(3000);

  Serial.print(F("Lines "));
  Serial.println(testLines(ILI9341_CYAN));
  delay(500);

  Serial.print(F("Horiz/Vert Lines "));
  Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));
  delay(500);

  Serial.print(F("Rectangles (outline) "));
  Serial.println(testRects(ILI9341_GREEN));
  delay(500);

  Serial.print(F("Rectangles (filled) "));
  Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
  delay(500);

  Serial.print(F("Circles (filled) "));
  Serial.println(testFilledCircles(10, ILI9341_MAGENTA));

  Serial.print(F("Circles (outline) "));
  Serial.println(testCircles(10, ILI9341_WHITE));
  delay(500);

  Serial.print(F("Triangles (outline) "));
  Serial.println(testTriangles());
  delay(500);

  Serial.print(F("Triangles (filled) "));
  Serial.println(testFilledTriangles());
  delay(500);

  Serial.print(F("Rounded rects (outline) "));
  Serial.println(testRoundRects());
  delay(500);

  Serial.print(F("Rounded rects (filled) "));
  Serial.println(testFilledRoundRects());
  delay(500);

  Serial.println(F("Done!"));

}

void loop(void) {
  for(uint8_t rotation=0; rotation<4; rotation++) {
    tft.setRotation(rotation);
    testText();
    delay(1000);
  }
}

unsigned long testFillScreen() {
  unsigned long start = micros();
  tft.fillScreen(ILI9341_BLACK);
  yield();
  tft.fillScreen(ILI9341_RED);
  yield();
  tft.fillScreen(ILI9341_GREEN);
  yield();
  tft.fillScreen(ILI9341_BLUE);
  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();
  return micros() - start;
}

unsigned long testText() {
  tft.fillScreen(ILI9341_BLACK);
  unsigned long start = micros();
  tft.setCursor(0, 0);
  tft.setTextColor(ILI9341_WHITE); tft.setTextSize(1);
  tft.println("Hello World!");
  tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2);
  tft.println(1234.56);
  tft.setTextColor(ILI9341_RED); tft.setTextSize(3);
  tft.println(0xDEADBEEF, HEX);
  tft.println();
  tft.setTextColor(ILI9341_GREEN);
  tft.setTextSize(5);
  tft.println("Groop");
  tft.setTextSize(2);
  tft.println("I implore thee,");
  tft.setTextSize(1);
  tft.println("my foonting turlingdromes.");
  tft.println("And hooptiously drangle me");
  tft.println("with crinkly bindlewurdles,");
  tft.println("Or I will rend thee");
  tft.println("in the gobberwarts");
  tft.println("with my blurglecruncheon,");
  tft.println("see if I don't!");
  return micros() - start;
}

unsigned long testLines(uint16_t color) {
  unsigned long start, t;
  int x1, y1, x2, y2,
                w = tft.width(),
                h = tft.height();

  tft.fillScreen(ILI9341_BLACK);
  yield();
  
  x1 = y1 = 0;
  y2 = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2 = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t = micros() - start; // fillScreen doesn't count against timing

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1 = w - 1;
  y1 = 0;
  y2 = h - 1;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2 = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t += micros() - start;

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1 = 0;
  y1 = h - 1;
  y2 = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2 = w - 1;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);
  t += micros() - start;

  yield();
  tft.fillScreen(ILI9341_BLACK);
  yield();

  x1 = w - 1;
  y1 = h - 1;
  y2 = 0;
  start = micros();
  for(x2=0; x2<w; x2+=6) tft.drawLine(x1, y1, x2, y2, color);
  x2 = 0;
  for(y2=0; y2<h; y2+=6) tft.drawLine(x1, y1, x2, y2, color);

  yield();
  return micros() - start;
}

unsigned long testFastLines(uint16_t color1, uint16_t color2) {
  unsigned long start;
  int x, y, w = tft.width(), h = tft.height();

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(y=0; y<h; y+=5) tft.drawFastHLine(0, y, w, color1);
  for(x=0; x<w; x+=5) tft.drawFastVLine(x, 0, h, color2);

  return micros() - start;
}

unsigned long testRects(uint16_t color) {
  unsigned long start;
  int n, i, i2,
                cx = tft.width() / 2,
                cy = tft.height() / 2;

  tft.fillScreen(ILI9341_BLACK);
  n = min(tft.width(), tft.height());
  start = micros();
  for(i=2; i<n; i+=6) {
    i2 = i / 2;
    tft.drawRect(cx-i2, cy-i2, i, i, color);
  }

  return micros() - start;
}

unsigned long testFilledRects(uint16_t color1, uint16_t color2) {
  unsigned long start, t = 0;
  int n, i, i2,
                cx = tft.width() / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n = min(tft.width(), tft.height());
  for(i=n; i>0; i-=6) {
    i2 = i / 2;
    start = micros();
    tft.fillRect(cx-i2, cy-i2, i, i, color1);
    t += micros() - start;
    // Outlines are not included in timing results
    tft.drawRect(cx-i2, cy-i2, i, i, color2);
    yield();
  }

  return t;
}

unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(x=radius; x<w; x+=r2) {
    for(y=radius; y<h; y+=r2) {
      tft.fillCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testCircles(uint8_t radius, uint16_t color) {
  unsigned long start;
  int x, y, r2 = radius * 2,
                w = tft.width() + radius,
                h = tft.height() + radius;

  // Screen is not cleared for this one -- this is
  // intentional and does not affect the reported time.
  start = micros();
  for(x=0; x<w; x+=r2) {
    for(y=0; y<h; y+=r2) {
      tft.drawCircle(x, y, radius, color);
    }
  }

  return micros() - start;
}

unsigned long testTriangles() {
  unsigned long start;
  int n, i, cx = tft.width() / 2 - 1,
                      cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  n = min(cx, cy);
  start = micros();
  for(i=0; i<n; i+=5) {
    tft.drawTriangle(
      cx , cy - i, // peak
      cx - i, cy + i, // bottom left
      cx + i, cy + i, // bottom right
      tft.color565(i, i, i));
  }

  return micros() - start;
}

unsigned long testFilledTriangles() {
  unsigned long start, t = 0;
  int i, cx = tft.width() / 2 - 1,
                   cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(cx,cy); i>10; i-=5) {
    start = micros();
    tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(0, i*10, i*10));
    t += micros() - start;
    tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
      tft.color565(i*10, i*10, 0));
    yield();
  }

  return t;
}

unsigned long testRoundRects() {
  unsigned long start;
  int w, i, i2,
                cx = tft.width() / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  w = min(tft.width(), tft.height());
  start = micros();
  for(i=0; i<w; i+=6) {
    i2 = i / 2;
    tft.drawRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(i, 0, 0));
  }

  return micros() - start;
}

unsigned long testFilledRoundRects() {
  unsigned long start;
  int i, i2,
                cx = tft.width() / 2 - 1,
                cy = tft.height() / 2 - 1;

  tft.fillScreen(ILI9341_BLACK);
  start = micros();
  for(i=min(tft.width(), tft.height()); i>20; i-=6) {
    i2 = i / 2;
    tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0));
    yield();
  }

  return micros() - start;
}

```

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [April 25, 2024, 6:34am UTC](https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860/6 "2024-04-25T06:34:08Z")

</div>

Okay, that leaves the first question: are you absolutely sure that your display has an ILI9341 controller?

---

<div class="post-metadata">

**Author:** ![jeff100](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@jeff100](https://forum.arduino.cc/u/jeff100)\
**Post date:** [April 25, 2024, 6:43am UTC](https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860/7 "2024-04-25T06:43:19Z")

</div>

It came to me with a bubble wrapped and only a case on it but the online store from my country only shows this without any regards to what the actual products is. I doubt that its accurate or maybe its not ILI9341at all maybe its ST7789

 ![438204685_1385112488812214_1819647864358687871_n](https://europe1.discourse-cdn.com/arduino/original/4X/8/4/0/8404c6f7c14bc77155f9ce00ffef389cd7fb8440.jpeg)  
 ![438196246_3636979266571192_5803025196588894654_n](https://europe1.discourse-cdn.com/arduino/original/4X/c/5/1/c51f3f4109278ae33eececd8f3e09a7a5aad9011.jpeg)

---

<div class="post-metadata">

**Author:** ![jeff100](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@jeff100](https://forum.arduino.cc/u/jeff100)\
**Post date:** [April 25, 2024, 12:19pm UTC](https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860/8 "2024-04-25T12:19:52Z")

</div>

Thank you for your help van\_der\_decken! It help me a lot and now it is working and now I'm learning to create a multiple button.

---

<div class="post-metadata">

**Author:** ![van\_der\_decken](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/van_der_decken/32/1006976_2.png) [@van\_der\_decken](https://forum.arduino.cc/u/van_der_decken)\
**Post date:** [April 25, 2024, 2:07pm UTC](https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860/9 "2024-04-25T14:07:35Z")

</div>

And what did the problem end up being?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [October 22, 2024, 2:08pm UTC](https://forum.arduino.cc/t/3-2-tft-spi-240x320-14p-only-shows-half-the-screen/1251860/10 "2024-10-22T14:08:08Z")

</div>

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