ILI9488_t3 - Support for the ILI9488 on T3.x and beyond...

@mjs513 @KurtE

I think there was a little bit of confusion on what I had did the other day.

I used the below code and attached library to operate the adafruit display with the t3.6 but still had the touchscreen from the ili9488 connected to the t3.6 instead of the one on the adafruit display. I did not have any rotation or mirror problems. I used the same jumper wires with the adafruit display as I did with the ili9488 which would lead me to believe that the problem is in the display library and that the touchscreen and the touchscreen library are fine. Unfortunately I'm not experienced enough to understand everything that is going on in the library. I might be better off trying to incorporate a touch screen controller.

Code:
#include "SPI.h"
#include "HX8357_t3.h"
#include "TouchScreen.h"

#define TFT_DC 9
#define TFT_CS 10
HX8357_t3 tft = HX8357_t3(TFT_CS, TFT_DC);

#define YP A18
#define XM A19
#define YM 5
#define XP 6

#define TS_MINX 120
#define TS_MINY 50
#define TS_MAXX 920
#define TS_MAXY 940

TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

#define MINPRESSURE 10
#define MAXPRESSURE 1000

void setup(){
  tft.begin(HX8357D);
  tft.setRotation(3);
  tft.fillScreen(HX8357_BLACK);
  tft.setTextColor(HX8357_GREEN, HX8357_BLACK); tft.setTextSize(3);
}

void loop(){
  touchscreen();
}


void touchscreen(){
  TSPoint p = ts.getPoint();
  pinMode(XM, OUTPUT);
  pinMode(YP, OUTPUT);
  tft.setCursor(0,25);
  tft.print("Z=");
  tft.print(p.z);
  tft.print("  ");    
  if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
    tft.setCursor(0,0);
    tft.print("X=");
    tft.print(p.x);
    tft.print("  ");
    tft.setCursor(200,0);
    tft.print("Y=");
    tft.print(p.y);
    tft.print("  ");
  }
}


I did try this with ili9488 but I still ended up with the rotation and mirror problem.
Code:
#include "SPI.h"
#include "ILI9488_t3.h"
#include "TouchScreen.h"

#define TFT_RST 8
#define TFT_DC 9
#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);

unsigned long time = 0;
unsigned long ptouchtime = 0;

#define YP A18
#define XM A19
#define YM 5
#define XP 6

#define TS_MINX 120
#define TS_MINY 50
#define TS_MAXX 920
#define TS_MAXY 940

TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

#define MINPRESSURE 10
#define MAXPRESSURE 1000

int screenx = 0;
int screeny = 0;
int screenz = 0;

void setup(){
  tft.begin();
  tft.setRotation(3);
  tft.fillScreen(ILI9488_BLACK);
  tft.setTextColor(ILI9488_GREEN, ILI9488_BLACK); tft.setTextSize(3);
}

void loop(){
  tftdisplay();
  touchscreen();
}

void tftdisplay(){
  tft.setCursor(0,0);
  tft.print("X=");
  tft.print(screenx);
  tft.print("  ");
  tft.setCursor(200,0);
  tft.print("Y=");
  tft.print(screeny);
  tft.print("  ");
  tft.setCursor(0,25);
  tft.print("Z=");
  tft.print(screenz);
  tft.print("  "); 
}
void touchscreen(){
  time = millis();
  unsigned long touchtime = time;
  if(touchtime - ptouchtime >= 1000){
    TSPoint p = ts.getPoint();
    pinMode(XM, OUTPUT);
    pinMode(YP, OUTPUT);
    screenz = p.z;
    if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
      screenx = p.x;
      screeny = p.y;
    }
    else{
      screenx = 0;
      screeny = 0;
    }
  ptouchtime = touchtime;
  }
}
 

Attachments

  • HX8357_t3.zip
    984.1 KB · Views: 97
@Slapstick

Think I mentioned this before but the ILI9488 driver was designed for the ILI9488 controller not the HX8357 controller. There are differences at the controller level that may be causing an issue. There may be enough in common that the HX8357 will work with the 9488 library but there is no guarantee that it will work right or 100%. Your best course of action is to use the display library designed for the HX8357 controller not try and use the ILI9488 library.

In addition the touchscreen drivers are not part of the ILI9488 library but are separate libraries to support the different touch controllers on the different displays - resistive or capacitive.

Think from what you said the HX8357 library worked - no screen rotation.

Unfortunately I don't have a HX8357 to test maybe somebody else does.
 
@mjs513

Using the HX8357 display is not what I'm trying to do. I'm trying to use a display with a ili9488 chip. I have another display which is the adafruit with a HX8357D driver.

I understand that the touchscreen drivers are not part of the ili9488 library but for some reason there is something in the ili9488 library that doesn't like the touchscreen library. I had the display running by itself without any problems for about a day when I was making sure everything was working. As soon as I added the touchscreen library to the sketch is when I started having problems. It's the same touchscreen library I have used with the HX8457D display so I know it works.

If I used the HX8357D display and the proper HX8357 library but wired the ili9488 touchscreen to the t3.6 instead of the touchscreen from the HX8357. I could operate the touchscreen that is fixed to the ili9488 display and display the touch points on HX8357 without rotation and mirroring problems. In doing so verified that the touchscreen on the ili9488 is not the problem as well as the touchscreen library. Both displays that I have are using resistive touchscreens.

Do you think there is any way that I will be able to get the touchscreen library to work properly with the ili9488?
 
Maybe not related - not sure I have a clear pic of using "T_3.6 instead" portion... or the rest of what is at hand ...

Some tested ili9488's were not set up with tri-stated SPI lines - the display worked alone with no touch connect/use - but when display's MISO was connected the output from active touch sensor was conflicted with the Touch MISO.

Solution was to not connect the Display MISO to the Teensy disabling display read - but allowing valid read of the Touch MISO output.
 
I could be wrong, but my understanding is that you have the BuyDisplay ILI9488 display: https://www.buydisplay.com/default/...cd-module-in-320x480-optl-touchscreen-ili9488
Which has the ILI9488 and a raw resistive touch controller. That is there is a ribbon connector with 50 connections on it. Of which there are 4 pins (44-47) which are setup to read this be using analogRead... So there is no conflict on SPI.

Personally I don't have the patience to try to solder up all of those IO pins.

My guess is there is something marginal on one or more of the connections, or maybe your not 100% setup to their specifications.

Example it shows pins 40-42 saying provide with 2.8V.
There are also at least ground pins shown. Are all of them hooked up to GND?
Are all of the pins that your not using that say fix to DGND hooked up to some form of GND?
Likewise those that say connect to IOCV?

Also with many of these displays not all are created equal. That is some may work great to 30mhz and another one may not... So again hard to know. exactly what is going on.

Sorry not much help here.
 
@Slapstick

Ok confused here are 2 questions that should clarify the situation:
1) HX8357 works with both Adafruit touchscreen.h and their HX8357 driver? From your description you said it was still hooked up to the ILI9488 touchscreen????

2) ILI9488: Without touch pins attached to the display (just the 9488 SPI wires) does it work at 30Mhz? Think you said at the beginning the just the display driver works. But the problem is when you attach the touch pins. Just confirming this.

As @KurtE stated the touchscreen lib is only doing analogreads but there is some port manipulation in there as well. But on the T3.6 that should not be a issue to conflict with SPI that the 9488 library uses.

Right now you I would say try using pins A2 and A3 as opposed to A18 and A19. Also just double check your wiring connections in addition to wht @KurtE stated in his post.

Again... not sure what else I can do to help since I don't have one of these displays.

Not sure
 
I'm getting the following errors when I try to compile this for Teensy 3.2:

C:\....\libraries\ILI9488_t3-master\ILI9488_t3.cpp:185:33: error: variable or field 'setFrameBuffer' declared void

void ILI9488_t3::setFrameBuffer(RAFB *frame_buffer)

^

C:\....\libraries\ILI9488_t3-master\ILI9488_t3.cpp:185:33: error: 'RAFB' was not declared in this scope

C:\....\libraries\ILI9488_t3-master\ILI9488_t3.cpp:185:39: error: 'frame_buffer' was not declared in this scope

void ILI9488_t3::setFrameBuffer(RAFB *frame_buffer)

^

Is there any configuration which needs to be done with this? I understand the frame buffer function is not available in T3.2
 
Looks like there is probably an issue with some that should have been removed by #if type statements.

However if whatever program your are trying to compile actually tries to use frame buffer... That will for sure fail...

But I extracted a real simple one and sure enough it does not compile...

@mjs513 - should I take a quick look? Or do you want to?
 
Can anyone with the ILI9488 on a 480x320 display and a T4 test out the gauge sketch from the ILI9341 thread and post the results? (and perhaps set SPI clock to 30000000)

I want to see how they compare and perhaps move to a bigger display if the performance is not impacted by much
 
Gave it a try on the T4/ILI9488 combo with the following results:
Code:
CS:10, DC:9 RST:8 MOSI:11, SCLK:13 MISO:12
ILI9488_t3n: (T4) SPI automatically selected



MOSI:11 MISO:12 SCK:13

center(240, 160) offset(120 40)
Press any key to continue

elapsed full updateScreen 9509
elapsed full updateScreenAsync 9635
elapsed clip updateScreen 387
elapsed clip updateScreen 390
Press any key to continue
As expected a lot slower for the full update screen but seems to be a lot faster than for clip update screen. On the default SPI clock is 30Mhz in the lib
 
Gave it a try on the T4/ILI9488 combo with the following results:
Code:
CS:10, DC:9 RST:8 MOSI:11, SCLK:13 MISO:12
ILI9488_t3n: (T4) SPI automatically selected



MOSI:11 MISO:12 SCK:13

center(240, 160) offset(120 40)
Press any key to continue

elapsed full updateScreen 9509
elapsed full updateScreenAsync 9635
elapsed clip updateScreen 387
elapsed clip updateScreen 390
Press any key to continue
As expected a lot slower for the full update screen but seems to be a lot faster than for clip update screen. On the default SPI clock is 30Mhz in the lib

Thanks for running the test, really appreciate it! 390ms doesn't seem that bad TBH.
Here is what the clip update looks like on the 9341 using a potentiometer on an analog input - I don't think it would look that bad with the 9488.
[video]https://drive.google.com/file/d/1dNeHOo61AOfjPhZBwaA8tcbuKqjo1RHm/view[/video]
 
I am wondering if anyone has played much with ILI9486 displays?

I know when we were developing this library that I purchased one that has it. I purchased from Amazon, but I think it is the same as this one: https://www.alibaba.com/product-detail/TFT-LCD-ILI9486-Module-FOR-Arduino_62162052751.html.

When I looked at it earlier, I believe this one was setup to only work in 16 bit parallel mode? Not sure if there is a way to make it work with SPI. I received some issues up on the ili9341_t3n library about trying to use that library for it, but I think this one would be closer.

Does anyone have one of these that works in SPI mode? Like the WaveShare version? It supposedly works on Ardumo mega using the library: https://github.com/ImpulseAdventure/Waveshare_ILI9486

I will take a quick look to see if I see anything obvious, to say which library best to start from? i.e. does it support 16 bit color mode or 18 bit? ...

Edit, I believe that their library is setting it up to use 16 bit color mode. Wonder now if HX8257 code would be a closer match?
 
Last edited:
Hello everybody,

I have a 4inch ILI9486 with SPI from Waveshare. I have already asked KurtE at Github how I can get it to work with a Teensy 4.0.
As KurtE already wrote, I got the display to work with the Waveshare lib and an Arduino Mega, but not with the t3n lib.

Hello KurtE,

I have already tried to transfer the init commands from Waveshare lib to t3n lib. Unfortunately it doesn't help me. The display remains white.

Edit:
KurtE, you're right. They configure 16 bits per pixel. But the chip also supports 18bit. So that shouldn't be the problem, should it?
 
But the interesting question, is which libary is the best starting point. I am thinking you may want to look at our newer HX8357 library. Probably needs an equivalent of a sub-class, with the correct init data, and maybe probably stuff for setting the rotation... But the HX8357 (See the Adafruit display) is very similar, except that it also works with 16 bit mode (or 24 bit color mode). As I mentioned the only ILI9486 display I have is I believe 16 bit 8080 interface. Not sure if it can be changed. Not much info on it. The only WaveShare one I have is for RPI and 3.2" so guessing ILI9341 Again not much docs on what it is internally...
 
Hi there,
I have now carried out several tests. I have transferred the init commands from the waveshare lib to your HX8357 lib. Without success.
Then I tested the original Waveshare lib with the teensy. Does not work either. Is it even possible with a lib written for Arduino to use it for a teensy?
I'm sorry I know so little about it ...
Thank you
 
Is it normal for the displayed settings to differ from the configuration?

17:51:32.809 -> Display Power Mode: 0x80
17:51:32.809 -> MADCTL Mode: 0x80
17:51:32.809 -> Pixel Format: 0x87
17:51:32.809 -> Image Format: 0x87
17:51:32.809 -> Self Diagnostic: 0x87

Edit: I think may i have a problem with mosi

Edit2: Wiring okay. Is it possible that the display only works with 5V logic?
 
Last edited:
Maybe? Although I would guess not. Although I would probably guess it may require +5v to Voltage pin on display which than probably coverts it down with voltage regulator.

Also need to check to see if any other pins are connected and are needed?
 
Of course I connected 5V to the power supply of the display. On the board of the display is a Voltage Regulator (AMS1117) which makes it 3.3V. What I mean is MISO and MOSI. Do they run on 5V on Arduino and 3.3V on Teensy? I can't imagine it, but I don't know what to do ...

I actually made all the necessary connections. SCLK, MISO, MOSI, CS, RST and DC, as well as 5V and GND.
I connected the backlight to 5V with a resistor.

I do not understand why the config does not reach the display.
 
Again if it were me, I would probably try running one of their examples and see what it tries to output. That is does it actually output something to the display?

Which example are you trying?

I won't be able to see it on display but might be able to verify that it is outputting valid SPI data.
 
Therefore I asked if it is theoretically possible to use lib for Arduino.
I've tried almost everything in the meantime ... The original lib from Waveshare (which works with Mega) and the associated graphicstest example. Just changed the pin config in lib.
I'm currently trying the HX8357. Adjusted SPI clock and init commands.
In all cases I have a white screen. It only works normally on the Mega.

19:46:31.979 -> HX8357 Test!
19:46:31.979 -> _t3n::begin mosi:11 miso:12 SCLK:13 CS:10 DC:9 SPI clocks: 16000000 6500000
19:46:31.979 -> T4 setup CS/DC
19:46:32.575 -> _t3n::begin - completed
19:46:32.763 -> Display Power Mode: 0x80
19:46:32.763 -> MADCTL Mode: 0x80
19:46:32.763 -> Pixel Format: 0x87
19:46:32.763 -> Image Format: 0x4
19:46:32.763 -> Self Diagnostic: 0x87
19:46:32.763 -> Benchmark Time (microseconds)
19:46:32.763 -> Screen fill 768666
19:46:33.703 -> Text 150819
19:46:34.597 -> Lines 226274
19:46:36.334 -> Horiz/Vert Lines 63325
19:46:36.766 -> Rectangles (outline) 35375
19:46:37.142 -> Rectangles (filled) 1857296
19:46:39.394 -> Circles (filled) 237241
19:46:39.769 -> Circles (outline) 182297
19:46:40.144 -> Triangles (outline) 48321
19:46:40.557 -> Triangles (filled) 610190
19:46:41.588 -> Rounded rects (outline) 75722
19:46:42.013 -> Rounded rects (filled) 2024213
19:46:44.363 -> Done!
 
Back
Top