Need a high speed ili9327 LCD library

Hi eveybody :slight_smile: .
I need some help .
I have 3.5 TFT LCD shield with ili9327 controller chip in 8 bit mode .
I used Rinky-Dink & Henning Karlsen Library to use it with Arduinu Mega2560 .
The main problem :frowning: is the performance and speed of library it's very slow .
Can you provide me with a good Library use it in (Arduino or Atmel Studio) ?
In this video show how the library is very slow .
Video " Test the library "

thanks for help .

What is the performance you would like to have?

Did you do the math to see if that is possible on a 16Mhz processor ?

Do you have a link to the datasheet of the exact LCD you have?
Have you checked the max performance possible.

How did you connect the LCD? (I2C, parallel, SPI, ...)?

Ever considered the Gameduino2 ?

http://excamera.com/sphinx/gameduino/

check the links here - http://forum.arduino.cc/index.php?topic=287752.15

Please post a link to your actual display.

From the look of your video, it is a UNO shield with the data bus on D8/9/2/3/4/5/6/7

Run this on a Uno and it will work a lot faster.

If you want to use a display on a MEGA2560, buy a Mega2560 shield that uses the proper D22-53 header.
Or a regular display with a separate Mega Adapter shield.

The latter arrangements can work at the maximum speed and efficiency. Which is dramatically better than your video. Note that UTFT is always going to be slow. It compromises speed for "universality".

David.

thanks for reply :slight_smile:

@robtillaart
@robtillaart

The lcd controller is ili9327 .
Shield use 8 bit parallel interface .
i have seen many video in youtube about an optimised library run faster than this library .
This Library
i want library like library used in this video .
optimised library
library using ASM written Routines
fast lib ASM routines

i think the problem in the library not in ability of arduino .

@david_prentice
why if run it on UNO will be better ?? and what the difference between use it on UNO or Mega ?
i get the lcd from this :
3.5 tft lcd

Looking at your link, you have "3.5 inch tft display For UNO R3 TFT LCD Shield Touch Panel Display with TF Reader,Controller ili9327"

Although there is no printing on the Green pcb, it looks very similar to the Red pcb of a "mcufriend UNO shield"
So I guess that it uses the same data bus and control pins.

Since D2-D9 on a MEGA2560 have completely random mapping to the AVR ports, it is rather complex to write to the "8-bit data bus". Hence it is slower than a UNO. Also, the microSD pins are completely wrong for your MEGA.

The "optimised" library in your video is writing to a 8-bit data bus that is mapped exactly to PORTD of the UNO. This sounds attractive but it means that you lose the Serial.
In fact, it could go faster with a 16-bit data bus mapped to PORTA, PORTC of a MEGA. e.g. with a proper MEGA display shield or Adapter shield.

David.

@david_prentice
Thanks for reply .
Yes it's mcufriend UNO shield

What do you mean by this :

since D2-D9 on a MEGA2560 have completely random mapping to the AVR ports

Can you help me to use it with Mega .

I am surprised that you posted a link to a Green pcb when you have a Red pcb
And describe it as a 3.5" when it says 3.6" on the pcb.

Please try my "new" library attached ili9488 with tuoch screen - #15 by david_prentice - Displays - Arduino Forum to this thread.

The ILI9327 is Untested because I do not own one.

Please could you run the LCD_ID_readreg.ino in the examples folder.
Copy/paste the result from the Serial window (9600 baud) and post it here.

If you have a Uno, everything will work better than the Mega.

David.

@david_prentice
Thank you very trying help me :smiley:
I'm print screen the result of test LCD_ID_readreg.ino .

I'm trying test the lcd on UNO R3 and Mega 2560 , but without any result .
When try run it on UNO serial monitor show this line :
Serial took 4999ms to start
ID = 0x493

Thankyou for running the sketch. Yes, you have a ILI9327.

Please edit any of the sketches to say tft.begin(0x9327) when you get an ID of 0x493

Then report the results of graphictest_kbv.ino and aspect_kbv.ino

I will allter the readID() to return 9327 instead of 0493. You can see where these values arise from the lcd_readID sketch.

David.

@david_prentice
Thank You Very Much :slight_smile: :smiley: :grinning:
I’m do what you say , and it’s run on UNO and Mega :smiley:
It’s faster than that library was trying in the main post :smiley:
Thank you again :smiley:
if you want to upload the video to it , i will do :smiley:

Please run:
aspect_kbv.ino
readpixel_ino

and report whether they work ok. You will need to kludge the ID.

If they are ok, I will upload a MCUFRIEND_kbv_2.1.zip that fixes the readID() method.

Thankyou very much for your help. It is impossible for me to test a controller without owning it !!!

David.

@david_prentice
No Problem Man :smiley:

I'm run

aspect_kbv.ino

"PORTRAIT", "LANDSCAPE_REV" it's appear correctly i think that
"LANDSCAPE" part of word is appear , 'L' and 'A' dons't appear , 'N' half of it appear ,the rest of word 'DSCAPE' is appear .
"PORTRAIT_REV" totally not appear .

readpixel_ino : result photo .
i note the serial monitor show this line :
g_ID = 0x493 ID = 0x9320
what that mean ?
photo



I have posted a new ZIP at the same thread: ili9488 with tuoch screen - #15 by david_prentice - Displays - Arduino Forum . Please delete the old library and install the new one.

It should read the ID correctly now.

Please run the new aspect_kbv.ino and readpixel_kbv.ino. One screenshot from readpixel_kbv would be useful.

I really do not know why the LANDSCAPE and PORTRAIT_REV is not displaying. Your screen is supposed to be 240x400. You appear to have something "wrong" at one end of the screen.

David.

@david_prentice
Yes , i run aspect_kbv the result in photo , i delete this line
tft.fillScreen(0x0000);
to display it in one screen :slight_smile: .
it's still a same problem ?

readpixel_ino : result photo .
why part of text in the left not display ? ?

The ILI9327 can control 240x432 pixels. Your display is 240x400. I am not sure how to solve the “missing area”. When you set the MY bit (LANDSCAPE or PORTRAIT_REV), it is displaying from 431-32 instead of 399-0.

I tried “telling” an ILI9488 that it is using a 240x320 screen instead of the real-life 320x480 screen. It displays 319-0 quite happily. So the 9327 is different to the 9488.

One kludge would be to set the scroll_start address to 32 when in these orientations. Another would be to set ML=1 (B4 in reg(0x36))

In practice, you can just limit yourself to PORTRAIT and LANDSCAPE_REV for the moment. Have you tried the “GLUE_Demo_240x400” sketch ?

Please edit the readpixel_kbv.ino sketch:

#include <avr/power.h>
void loop(void)
{
    uint16_t iter, color;
    char buf[80];
    clock_prescale_set(clock_div_4);   //try reading VERY SLOW
    aspect = (aspect + 1) & 3;
    tft.setRotation(aspect);
    if (g_identifier == 0x9327) {
        //        if (aspect == 1) tft.WriteCmdData(0x36, 0xF8);
        //        if (aspect == 2) tft.WriteCmdData(0x36, 0x98);
        if (aspect == 1 || aspect == 2)
            tft.vertScroll(0, 400, 32);
        else tft.vertScroll(0, 400, 0);
    }
    for (iter = 0; iter < sizeof(colors) / sizeof(uint16_t); iter++) {
        color = colors[iter];
        tft.fillScreen(color);
        tft.setTextColor(WHITE);
        tft.setTextSize(1);
        tft.setCursor(0, 0);
        sprintf(buf, "ID=0x%04X Background=%04X %s",
                tft.readID(), color, aspectname[aspect]);
        tft.println(buf);
        colordump(6 * 6, 0);
        //    duffcolor(color);
        delay(5000);
    }
}

The ILI9327 is VERY slow when reading the Frame Memory. (compared to other controllers). With luck, slowing the AVR might get the reading ok. Doing a vertical scroll might put the Frame memory into view. Meanwhile, I will think of a proper solution.

David.

@david_prentice
This is test of GLUE_Demo_240x400 on Mega 2560 and test edit the readpixel_kbv code you are suggest before .
It's still part of LCD disappear and don't used .
Test Video

Why graphictstest_kbv.ino in UNO complete in 7.88 sec :slight_smile:

while in Mega 2560 complete in 18.52 sec :o :frowning: >:(
the speed of graphictest_kbv on UNO is very good for me :smiley:
what can i do to make the speed in Mega 2560 same as in UNO ?

Your screen is 240x400 so it obviously takes longer than the smaller 240x320 screens.

The MEGA2560 is always going to be slow with a UNO shield. At least it works for the TFT and Touch. It does not work for the microSD.

I took a regular MEGA Protoshield and removed the D2-D13 male pins. Then hand wired the D2-D9 female pins to PORTA (D22-D29) and hand-wired the D10-D13 pins to SPI (D50-D53). This means that I can run the UNO shields on a MEGA. The graphicstest_kbv.ino sketch takes 5.22sec for a 240x400 screen (R61509V). Note that the pin-mapping is LCD_D0->D22 and the SPI mapping is SD_SS->D53 etc.

Why do you want to use a UNO shield on a MEGA when you clearly own a UNO ?

My "vertical scroll kludge" did not work with the "missing area". Nor did the "slow CPU kludge" read the GRAM memory correctly.

In the colordump() function you will see some conditional code to use readPixel() or readGRAM(). Please force the readPixel() by saying: #if 0 &&

In "GLUE_Demo_400x240" please change line in setup() to : myGLCD.InitLCD(3);
This will make the Demo run in LANDSCAPE_REV mode.

I am guessing that you are not in Europe. I am sure that I could fix the 0x9327 driver easily if I had the display on my desk. At least you can always use PORTRAIT and LANDSCAPE_REV modes ok.

David.

p.s. your Video is not very readable. Do you see a vertical scroll in the graphicstest_kbv sketch?

The MEGA2560 is always going to be slow with a UNO shield.

Can you explain to my why Mega2560 slow with UNO shield ? ?
I think the problem in Library not in ATmega2560.

thanks for you suggest to modify connecting wires , but i want used it as shielded .

Why do you want to use a UNO shield on a MEGA when you clearly own a UNO ?

MEGA2560 has more I/O header , and i will used in my project .
UNO has less I/O header .

Yes , i change to myGLCD.InitLCD(3) and now run correctly in LANDSCAPE_REV mode.

I am guessing that you are not in Europe.

Yes , I'm not in Europe , i'm from EGYPT :smiley: .
I plan to travel to Germany :smiley:
Thank you for GREAT Help .