Problem with 3.5" tft display with ILI9488 driver

Does any one can help with my code?
I'm trying to drive a tft 3.5" display with ILI9488 driver and SPI protocol, but I can't get any sign of a correct output on screen(shape, color. Text..), even a simple changing in backround color. Down Below is my code and that is how I connected the pins. I'll be appreciate if anybody could help me with that.

Best regards
Shahryar

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


#define CS A5
#define DC/RS A3 
#define MISO 12  
#define SCK 13 
#define RST A4
#define LED -1
#define MOSI 11 
MCUFRIEND_kbv tft(A5,A3,11,12,A4);

#define BLACK   0x0000
#define BLUE    0x001F
//#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
#define NAVY    0x000F
#define MAROON  0x7800
#define PURPLE  0x780F
#define OLIVE   0x7BE0
#define LIGHTGREY 0xC618
#define DARKGREY 0x7BEF
#define ORANGE 0xFD20
#define PINK 0xF81F


void setup() 
{
uint16_t ID = tft.readID();
tft.begin(ID);
tft.fillScreen(BLACK);
delay(3000);
}

void loop() 
{
  
}


@david_prentice
@david_2018

tft.begin(0x9488)

1 Like

Hi @outbackhut
Thank for responding.
Should I fill ID with 0x9488?

Yes.

1 Like

I'll try and inform you. :pray:t3:

Please do.

1 Like

Thanks for the photos (and the code)
Photos show a 3.3V SPI Display connected to a 5V Uno.
Code shows you using MCUFRIEND_kbv library which is intended for Uno Shields with 8080-8 Parallel controllers.

First off. You MUST use level-shifters on all the logic signals. (except MISO)
Either resistor dividers like 4k7+10k.
Or dedicated level-shifter chips.

I suggest that you install ZinggJM's ILI9486_SPI library via the IDE Library Manager.
graphictest.ino example shows:

setup
tft.init() done
Benchmark                Time (microseconds)
Screen fill              9213332
Text                     265584
Lines                    4933036
Horiz/Vert Lines         423820
Rectangles (outline)     242976
Rectangles (filled)      12477140
Circles (filled)         1640640
Circles (outline)        2086276
Triangles (outline)      953288
Triangles (filled)       4687464
Rounded rects (outline)  745780
Rounded rects (filled)   12502744
Done!

Or you install Jaret Burkett's ILI9488 library via the IDE Library Manager.
graphictest.ino example shows:

Benchmark                Time (microseconds)
Screen fill              6182612
Text                     260584
Lines                    4696404
Horiz/Vert Lines         532692
Rectangles (outline)     301436
Rectangles (filled)      15072520
Circles (filled)         1874668
Circles (outline)        1985052
Triangles (outline)      915936
Triangles (filled)       5435820
Rounded rects (outline)  764320
Rounded rects (filled)   15402148
Done!
2 Likes

Thanks a lot @david_prentice for giving time to my question.
I'll check your solutions as soon as possible and inform you the result. :pray:t3::pray:t3::pray:t3::ok_hand:t2::ok_hand:t2::ok_hand:t2:

@shahribahri, @david_prentice,

I was surprised to note that David recommended my library ILI9486_SPI.
But as I was busy I didn't check. ILI9488 is not supported, sorry.

I usually don't answer technical questions in personal messages.
ILI9486_SPI doesn't support ILI9488.
ZxTFT supports ILI9488.
GFX_TFT supports ILI9488.
You could take a look at these.
I am not active on supporting TFT displays currently, but you can post questions in the Displays forum.

Jean-Marc

1 Like

Jean-Marc,

I have the same Red ILI9488 SPI display. I ran both your library and Jaret's library on the real hardware. (built with default libraries via Web Editor)

ILI9486 and ILI9488 have the same registers and are very similar.

So I am pretty confident that shahribahri should get on ok.

The real "problem" is 5V logic with 3.3V screens.

Oh, and that ILI9481, ILI9486, ILI9488 only support 6-6-6 pixels. i.e. 3 SPI bytes per pixel.
Which means that everything is SLOW.

Where did you get a SPI ILI9486 ?

David.

1 Like

https://www.aliexpress.com/item/1005001999296476.html

Hi David, I had to search through my AliExpress orders, to find it. Order date: Nov 9, 2021.

Jean-Marc

David_prentice

I'm using resitor voltage divider instead of external one.
I can see some changes when I upload the program on the display but its incoherent.

If the tft display is ok then I think I have pin connection problem. I connected them like down below, is it necessary to use Analog inputs instead of digital ones?

1 Like

Zingg

I'll appreciate your guidances.
I'll try to include your libraries and check it.:ok_hand:t2:

I tried what you said but unfortunately it didn't work.

I'll be happy if you suggest any other solutions :pray:t3:

1 Like

Ah-ha. So they let you choose ILI9486 or ILI9488.
The Touch versions omit the voltage regulator from the pictures. Which seems odd !!

My one is ILI9488 with Touch. Component placement is different.

Have you ever read the ID registers ? i.e. verify it is ILI9486

David.

1 Like

Yes, I think so. But my memory is not good enough to confirm.

Do you have an idea of how often these are or will be used? Would it be worth to extract the code for ILI9488 to a separate library ILI9488_SPI, still using Adafruit_GFX?

Jean-Marc

1 Like

The diagram in #13 is fine.

Note that you will need to edit lines 37, 38 in ILI9486_SPI graphictest.ino

#elif defined(__AVR)
ILI9486_SPI tft(/*CS*/ 8, /*DC=*/ 10, /*RST=*/ 9); // to match the wiring in #13

The resistors are not that critical. i.e. 2k2 + 3k3 are fine. Likewise 4k7 + 10k or 4k7 + 8k2 or similar combinations.

Please let me know how you get on.

David.

p.s. regarding LED pin in the #13 diagram.
Your pcb has a transistor Q1 that switches the backlight LED. So direct connection to 5V is ok.
Earlier ILI9341 boards routed LED pin directly to backlight LED without a transistor.
So a 22R - 39R series resistor is wise for 5V. (or else the LED takes too much current)

1 Like

Fortunately its working @david_prentice & @ZinggJM

Can't be better :ok_hand:t2:
I have a tough way to learn tft functions completely, maybe bother you again by my questions.

Wish I could return your favor :pray:t3:

@david_prentice @ZinggJM
Hi
I'm trying to put some colorful shape on screen and inside which place the analog input from sensor, as you can see sensor value in white color below.
But The problem is when I turn the sensor(potentiometer), the past values mix with new values because the screen don't be reset or clear to show new value, and however I tried to put a code to clear the value I couldn't do it.

When I use tft.init() to clear screen, all my shape will be refresh and blinking which is not desirable(because of low speed of tft).
How can I just refresh the input sensor value (the numbers as below)??

#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);
}


1 Like