Pages: 1 ... 11 12 [13]   Go Down
Author Topic: LCD display with ILI9341 driver on Arduino  (Read 54030 times)
0 Members and 2 Guests are viewing this topic.
Villeurbanne (France)
Offline Offline
Full Member
***
Karma: 2
Posts: 128
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Casemod.

I followed all links. I have a raw picture made with ImageConverter 565. I installed UTFT library, too big for ProMini so I now use my MEGA2560. The program SDImageViewer seems to have some bugs so I begin with a smaller program : UTFT_TextRotation_Demo.

I wander about pins for the prototype UTFT(Byte model, RD, WR, CS, RST, SER=0)  whose name are not familiar for me.
I keep my old wirings so WR=51, CS=53, RST=48, but what are RS and SER ?
Now, I'm about trying one after each other "ILI_9341_S4P" and "ILI_9341_S5P" for Byte model and 49 or 52 as RS.

I read all pdf without finding which Henning Karlsen's pin names correspond to SPI current pin names.

« Last Edit: August 16, 2014, 01:27:35 am by micol » Logged

*** Micol *** resolutly politically NOT correct

Villeurbanne (France)
Offline Offline
Full Member
***
Karma: 2
Posts: 128
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

To use 5 V ProMini, I followed what MrBurnett said on another page : I did as if it were a 3.3 Volts.

I had like to show you the 2 ProMini working together, but amongst all my SD-cards, one only works well with ILI9340 card reader. Other card are sometimes recognised and their files listed, but pictures are never shown.
 



Logged

*** Micol *** resolutly politically NOT correct

Offline Offline
God Member
*****
Karma: 10
Posts: 736
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Amongst all my SD-cards, one only works well with ILI9340 card reader. Other card are sometimes recognised and their files listed, but pictures are never shown.

Now that you are running at 3.3V short the three resistors for the SD card under the display.
In most cases the SD card works correctly thereafter.
Logged

Villeurbanne (France)
Offline Offline
Full Member
***
Karma: 2
Posts: 128
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I shunt resistors on the card-reader and it does not works, even with the "good" Sd-card.

Then, I tried and work with UTFT and Mega2560.
I spend much time and finaly find the declaration to write in every example :

UTFT myGLCD(ILI9341_S5P, 51, 52, 53, 48, 49);

Now, I can execute all the demo given in the library and I have to write my own programms.

 
Logged

*** Micol *** resolutly politically NOT correct

Villeurbanne (France)
Offline Offline
Full Member
***
Karma: 2
Posts: 128
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I tried several ILI9340 libraries with ProMini 3.3 volts.

For text or geometrical drawing, all are OK.
When reading picture from SD-card, it is different :

Adafruit_ILI9340 works sometimes well, and sometimes does not find the card, or find it not formatted, or find not any file on it.
It seems to me that the card-reader behind ILI9340/41 is not very reliable.

UCGlib : has no fonction for reading SD-card.

UTFT : works only for pictures of 1 KO max, not for 320x240 whose size is 698 Ko when converted into file.C

On post 177, Casemod gave a link to a nice slideshow. I studied it and discovered another library. But this library is not for ILI9340 but for ILI9325. (or ST7781 or SD1963).

EDIT> a glance at ebay tells me that these TFT have 40 pins. They are not SPI. It is why they are so fast.

« Last Edit: August 23, 2014, 07:21:15 am by micol » Logged

*** Micol *** resolutly politically NOT correct

Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just to kind of clarify some unknowns a little back in the post i'd like to share my problems/solutions.

I wanted to get SPI hardware working on the UNO to obviously ILI9341.  I used the adafruit library the whole time.  However, I could only get software SPI to work.  I was using a CD4050 to step the 5v signal from the digital pins to 3.3 for the LCD.   The problem with the 4050 is that it's a buffer and not a driver. The current coming out of it is too damn small for the inputs of the  ILI9341.  I'm not certain why the 4050 let software work but the hardware mode.  However, when i went to using voltage dividers with resistors I tried two different sets of values.  The first set of values were close to 100k.  So i got the right voltage but in the micros for current.  With this setup software mode DID work, but still not hardware.  then i went way down to a reasonable current, and finally hardware worked.

So if you are having problems getting hardware to work, I think the signal current has a significant part to play.
Logged

Offline Offline
God Member
*****
Karma: 10
Posts: 736
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just to kind of clarify some unknowns a little back in the post i'd like to share my problems/solutions.

I wanted to get SPI hardware working on the UNO to obviously ILI9341.  I used the adafruit library the whole time.  However, I could only get software SPI to work.  I was using a CD4050 to step the 5v signal from the digital pins to 3.3 for the LCD.   The problem with the 4050 is that it's a buffer and not a driver. The current coming out of it is too damn small for the inputs of the  ILI9341.  I'm not certain why the 4050 let software work but the hardware mode.  However, when i went to using voltage dividers with resistors I tried two different sets of values.  The first set of values were close to 100k.  So i got the right voltage but in the micros for current.  With this setup software mode DID work, but still not hardware.  then i went way down to a reasonable current, and finally hardware worked.

So if you are having problems getting hardware to work, I think the signal current has a significant part to play.

Good point in describing!
This is why I tell people to attach a scope and read the waveform before asking impossible questions.
If they cant afford a second hand unit from ebay then this is the wrong hobby  smiley-mr-green

« Last Edit: August 28, 2014, 07:47:46 am by casemod » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe my information helps somebody. I tested it on UNO and MEGA.

Display fully works if it is alone connected to the arduino with CD4050 or 4k7 resistors with these libraries:
UTFT
Multi LCD
TFTv2
But if I connected more modules to the arduino (BT, 433 MHz module etc..) it stops working, only with UTFT works fine.

SD card sometimes worked, sometimes not. If it was connected alone without any other modules, there was no problem. If I connected the display, it stops working. But if I turned off the backlight, it was woking always, but as I said, only if no other module was connected to the arduino.

So I think that there is design problem on the display board and is dependent on very clean signals or on very stable power.  But maybe it is problem only of mine unit.
Logged

Offline Offline
God Member
*****
Karma: 10
Posts: 736
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe my information helps somebody. I tested it on UNO and MEGA.

Display fully works if it is alone connected to the arduino with CD4050 or 4k7 resistors with these libraries:
UTFT
Multi LCD
TFTv2
But if I connected more modules to the arduino (BT, 433 MHz module etc..) it stops working, only with UTFT works fine.

SD card sometimes worked, sometimes not. If it was connected alone without any other modules, there was no problem. If I connected the display, it stops working. But if I turned off the backlight, it was woking always, but as I said, only if no other module was connected to the arduino.

So I think that there is design problem on the display board and is dependent on very clean signals or on very stable power.  But maybe it is problem only of mine unit.

As above, you are not providing a solution.
Clearly some modules are corrupting the signal. Why do you think the manufacturer is to blame? Can you show us a signal going to the TFT to back up your statments? What SPI speed are you using? The UTFT may actually be slower and thats why you get it working.

I have a video shopwing how to dramatically boost UTFT speeds for an SSD1289, that should give you an idea that the library itself is not very efficient. Even with SPI Using digitalWrite functions for the CS line.... is Slow!

I think this kind of posts only confuse people more. If you find a solution post it, dont just say: "my observations led me to believe it does not work, but I dont know why. Probably the display board is to blame as it requires very clean signals".

There are many alternatives to the CD4050. 75LVC245 is an example, HC245 is used in comertial modules, and adafruit sells a TXB0108 breakout board which is bi-directional and avoids issues with wiring od SD cards
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe my information helps somebody. I tested it on UNO and MEGA.

Display fully works if it is alone connected to the arduino with CD4050 or 4k7 resistors with these libraries:
UTFT
Multi LCD
TFTv2
But if I connected more modules to the arduino (BT, 433 MHz module etc..) it stops working, only with UTFT works fine.

SD card sometimes worked, sometimes not. If it was connected alone without any other modules, there was no problem. If I connected the display, it stops working. But if I turned off the backlight, it was woking always, but as I said, only if no other module was connected to the arduino.

So I think that there is design problem on the display board and is dependent on very clean signals or on very stable power.  But maybe it is problem only of mine unit.

As above, you are not providing a solution.
Clearly some modules are corrupting the signal. Why do you think the manufacturer is to blame? Can you show us a signal going to the TFT to back up your statments? What SPI speed are you using? The UTFT may actually be slower and thats why you get it working.

I have a video shopwing how to dramatically boost UTFT speeds for an SSD1289, that should give you an idea that the library itself is not very efficient. Even with SPI Using digitalWrite functions for the CS line.... is Slow!

I think this kind of posts only confuse people more. If you find a solution post it, dont just say: "my observations led me to believe it does not work, but I dont know why. Probably the display board is to blame as it requires very clean signals".

There are many alternatives to the CD4050. 75LVC245 is an example, HC245 is used in comertial modules, and adafruit sells a TXB0108 breakout board which is bi-directional and avoids issues with wiring od SD cards

You are right, this is no final solution. But it is very strange, that if I connect other modules, for example BT module HC-05 to the RX, TX pins and power, the example codes provided by TFTv2 and multiLCD libraries stops working and UTFT no. The module is only wire connected, with no code for it. So therefore I think that "mine cheap chinese copy"  (and maybe others too) has some HW problems. BTW I have too another chinese copy of the other LCD shield and there is no wire connection to the CS pin of SD card and shield was selling with library for old arduino version (working on 0.smiley-cool. Seller send me step by step 5 new libraries, saying directly from manufacturer, but none was good. So I think that someone from Chineses comrades makes mystake. And I know, that UTFT is very slow, because multiLCD is based on UTFT and one of the objectives was speed it up.
P.S. If I have time, I will try connect oscilloscope and find out, If I am right or no.
Logged

Offline Offline
God Member
*****
Karma: 10
Posts: 736
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I never received any faulty screen from china.
In my experience most of the problems are related to the fact that the manufacturer just trows whatever display they can get a best deal. mcufriend.com are number one doing that! You get a screen from them today and I can guarantee you next month you'll get a different controller and the seller has has no software or even knows about this change.

Add to this that some sellers get more stock than others so you are likely to find several sellers all selling different versions!

Then, there are software issues.
I had a project that has some strange bug. I could not find the problem! It was actually a TFT driver that was causing the issue!

I like to advise people to plug the arduino at 3.3V and go from there. That clears any hardware issues right away. Working with a buffer on a breadboard and assuming poor decoupling is away from ideal and only makes matters worse for beginners.

Here is a good example of a 3.3/5V selectable arduino mini
http://www.ebay.co.uk/itm/230795578198?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT although this can be easily made on any arduino board.

Not wishing to do so the other option is to get a REAL buffer from adafruit or whatever. Anyone who values their time will soon realize paying $10 or $15 for a proper buffer will save more than enough hassle in the long term.

Anything else is not even worth to bother with. Its the typical: it works for me, but its likely not to work for you approach.

And after we have all this things sorted we can start worrying about software issues, which in my opinion are much less severe than hardware issues. I can replicate x problem using a 'y' IDE version with a 'z' library running on a 'n' operating system, but I can assure you I wont be able to replicate anyone's hardware problem.
Logged

Offline Offline
God Member
*****
Karma: 10
Posts: 736
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To make it easier on the folks here I modified the adafruit library.
The result is not as drastic as the parallel displays, but I managed to score a 2.40x speed increase.

The pins are defaulted to the hardware SPI.
9 and 10 are DC and CS. 13 is SCLK and 11 is MOSI. Simple

The SD card library can be used as usual, with the default pinouts.

https://www.youtube.com/watch?v=9RIKzXANbOY

Modified Library:

Code:
ILI9341 Test!
Display Power Mode: 0x0
MADCTL Mode: 0x0
Pixel Format: 0x0
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark                Time (microseconds)
Screen fill              1522152
Text                     121600
Lines                    921592
Horiz/Vert Lines         126996
Rectangles (outline)     81808
Rectangles (filled)      3160352
Circles (filled)         501916
Circles (outline)        396440
Triangles (outline)      293484
Triangles (filled)       1163048
Rounded rects (outline)  183788
Rounded rects (filled)   3473156
Done!



Sketch uses 19,358 bytes (60%) of program storage space.
Global variables use 596 bytes (29%) of dynamic memory.

Default Library:

Code:
ILI9341 Test!
Display Power Mode: 0x0
MADCTL Mode: 0x0
Pixel Format: 0x0
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark                Time (microseconds) Performance increase
Screen fill              2561344 1.68x
Text                     319432 2.62x
Lines                    3118828 3.38x
Horiz/Vert Lines         222976 1.75x
Rectangles (outline)     148504 1.81x
Rectangles (filled)      5319692 1.68x
Circles (filled)         1168236 2.32x
Circles (outline)        1357636 3.42x
Triangles (outline)      990332 3.74x
Triangles (filled)       2083636 1.79x
Rounded rects (outline)  511700 2.78x
Rounded rects (filled)   5964712 1.71x

AVERAGE 2.40x faster
Done!


Sketch uses 19,008 bytes (58%) of program storage space.
Global variables use 596 bytes (29%) of dynamic memory.

Loading a BMP file from SD takes about the same time. About 200ms quicker.

The current library only works with arduino UNO, Mini and Nano.
The previous version, posted in May works with the mega. For the Due there is an improved version using DMA.

* Adafruit_ILI9341.rar (128.74 KB - downloaded 2 times.)
« Last Edit: September 25, 2014, 11:42:52 am by casemod » Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 56
Posts: 1847
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The result is not as drastic as the parallel displays, but I managed to score a 2.40x speed increase.

Wow!  Nice improvement.  The for the effort.

Ray
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 24
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Amazing results Casemod. Thxs.

My personal ring: Due + HY32D + 2.2 TFT SPI
library modified: Adafruit_ILI9340 for arduino Due

Adafruit_ILI9340.cpp without changes

Code:
#ifdef __AVR__
    SPI.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz (full! speed!)
#endif
#if defined(__SAM3X8E__)
    SPI.setClockDivider(11); // 85MHz / 11 = 7.6 MHz (full! speed!)


Adafruit_ILI9340.cpp modified for Arduino Due  (amazing!)

Code:
#ifdef __AVR__
    SPI.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz (full! speed!)
#endif
#if defined(__SAM3X8E__)
    SPI.setClockDivider(3); // 85MHz / 3 = 23.33 MHz (full! speed!)


PD: amazing TFT Casemod, congratulatios.  Wow 2.4" SPI with touch IC!!!  smiley-wink  
Logged

Pages: 1 ... 11 12 [13]   Go Up
Jump to: