Adafruit ILI9341 not using the whole display

Hello, I have a problem using my 2.4" tft ili9341 display. I am using the Adafruit_ILI9341 and Adafruit_GFX libraries. I am trying to fill the screen with a color (using the fillScreen() function) and a part of the display remains as is. When I rotate the display and use the same function is fills the previously unchangeable part but leaves another part behind. Also text behaves the same way (as if that line was the end of the display). Thanks for your time.

CODE:

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

#define TFT_MISO 8
#define TFT_LED 7
#define TFT_SCK 6
#define TFT_MOSI 5
#define TFT_DC 4
#define TFT_RESET 3
#define TFT_CS 2

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCK, TFT_RESET, TFT_MISO);

void setup() {
  pinMode(TFT_LED, OUTPUT);
  digitalWrite(TFT_LED, HIGH);

  tft.begin();
  tft.setTextSize(4);
  tft.setRotation(0);
  tft.fillScreen(ILI9341_BLUE);
}

Please post a link to the actual screen that you have bought. e.g. Ebay sale page.

It certainly looks like a 2.4 inch Red SPI display. It probably has an ILI9341 controller.

However we don't know which 3.3V Arduino you are using.
Or whether you have a 5V Arduino and use level shifters.

I would expect Adafruit_ILI9341 library to work fine with proper 3.3V logic.

David.

Hi, could you also post a picture of what happens when you rotate, that may (or may not :innocent:) help ...

In any case, did you print out the following data, possibly with rotation set to 0 and to 1? Just to see if the driver has got the correct data for width and height ...

     int w = tft.width();
     int h = tft.height();

You could also check Adafruit's graphics test:

https://github.com/adafruit/Adafruit_ILI9341/blob/master/examples/graphicstest/graphicstest.ino

This is the display I am using (2.4" without touch). I am using it with 5V logic and no level shifters (it says its 5V compatible).

The clever sales people omit the photo of the pcb. So I don't know what chips are mounted. And they can mislead you with impunity.

Please can you identify the part numbers of any level shifter chip. Or just identify whether there are resistor-packs and the value.

David.

This is a video of what happens. Unfortunately I can't show you what happens when it rotates because I accidently shorted the nano that I was using and blew the usb diode. I will post another video when I get a replacement.


I don't really know what you are looking for...:thinking:

Thanks for the photo.

R4 is resistor
U1 is (unmounted) XPT2046 Touch Controller
U2 is 3.3V voltage regulator
Q1 is transistor (for switching the backlight on)
C1 is a 100nF capacitor
SD1 is the SD socket.

You can generally read part numbers that are printed on transistors and integrated circuits. Or resistor codes printed on resistors. Capacitors you identify by sight.

There is no level shifting circuitry. Which means that you have to provide 3.3V logic signals.

The Ilitek ILI9341 will not work with 5V logic. I am surprised that you saw any pixels at all !
Most TFT controllers are not 5V tolerant according to their datasheets.

Which is why respectable manufacturers like Adafruit provide 3.3V level shifters on their displays.

If you believe in Jewish Space Lasers you can put your trust into Ebay shops.

Incidentally, there are Red SPI displays with HC245A level shifter chips. But your photo has no 74HC245A chips.

David.

1 Like

Going from 5V to 3.3V can be solved by a simple resistor divider ... Unfortunately the other way depends on the threshold that the 5V electronics accepts as HIGH ...

There is a comprehensive article on this topic here

https://hackaday.com/2016/12/05/taking-it-to-another-level-making-3-3v-and-5v-logic-communicate-with-level-shifters/

1 Like

Ok thanks for the heads up, I will use level shifters. This setup (with the arduino nano) is temporary. I will be using a 3.3V board (Seeeduino XIAO) for my final implementation.

It is very simple to just put a few resistor dividers on your breadboard. Ensure that you have 3.3V logic signals. All of the Adafruit_ILI9341 example programs should work 100%.

I am a little surprised to see RED pixels being plotted from the bottom upwards. Especially when the screen is in PORTRAIT rotation and BLUE pixels were specified.
And of course, I was mostly surprised to see anything at all !!

So when you have 3.3V logic, please copy-paste the result from reading the "ILI9341" registers. Especially the ID. Perhaps you have a different controller.

David.

1 Like

setRotation(0) is landscape. Text appears landscape as well although I don't have a picture of it. It is, of course, entirely possible the aliexpress seller send me a different controller.

How text would look (with the help of some good old paint magic๐Ÿ˜‰):

Only in the world of Space Lasers.

Seriously, for a handful of resistors you can connect your display properly. Then you can use the display for real projects i.e. why you bought it in the first place.

The Mcufriend-style parallel displays come with random controllers.
I have never seen a Chinese Red 2.4 inch Touch SPI display with anything other than ILI9341. But with component shortages anything is possible.

David.

Ok I got a proper 3.3V board connected to the display. It appears to be able to control the full display. I tried the same program as I did with the arduino nano and this time it just shows a blank white display. Good news: backlight works. Bad news: the actual display doesn't. Full disclosure, its the first time I use this 3.3V board so idk whose (display, program or board) fault it is. I ran the adafruit graphic test and all it does is change between different shades of gray.

Is it true that solder-blobbing (shorting) J1 makes these 5V compatible ?

@mch170
It looks like your 'beetle' there is not soldered to the header pins used.

1 Like

It is not๐Ÿ˜…. I went for a quick test and it seems to make "good enough" contact.

But - as it still isn't working . . .

Yes it is the next step in troubleshooting.

NO. The ILI9341 is always 3.3V logic. If you short J1 you can connect VCC directly to a 3.3V supply.

If you connect VCC to a 5V supply with J1 shorted then you will destroy the display.

Seriously, you must make good connections to your Xiao board. e.g. soldered pin header.
You might be able to stuff a dressmakers pin into the holes to force a mechanical / electrical connection.

David.

1 Like

Thanks for clarifying.