SPI Library for 240x320 TFT LCD with ILI9320, ILI9325 and ILI9328 chip

Dependencies:   BurstSPI

Dependents:   KL25Z_ILI9320_Demo Mini-DK

Issue: Display problems with ILI9320 : image is mirrored, then disappears (Closed: Fixed)

Hello guys,

I've just made a board using the LPCXpresso 1769 module (running binaries compiled with the MBED online compiler for now).

An ILI9320 LCD from the same brand as the Mini-DK2 board is connected to the LPC1769's SPI (pins 11..14) with a GPIO to control LCD reset.

I've used the example program for this library (and imported the library and fonts).

Upon reset, the LCD goes white (no backlight dimming on my board) then the demo program's text flashes once (less than half a second) and then the display goes white again.

I've tried looping the locate and printf statements to cover the display, but it just flashes the string once then goes white.

Also, the string is displayed mirrored.

Clearly this isn't a hardware problem, or there would just be garbage on the LCD, or even nothing. So it has to be software-related. It's very late and I'll look more into it tomorrow but for right now it's very late and I just wanted to get the ball rolling before I hit the sack.

Have you ever seen anything like that ?

Jean

5 comments:

07 Oct 2014

Hi Jean,

When you imported the program, did you update the mbed lib to the latest revision? I did not test the demo using the latest mbed lib, so, in case you did update the mbed library, import the demo again and keep the mbed library that was used with the demo program.

I assume you did not change any code from the imported demo?

As for the LCD going white, it seems to me the reset pin is driven incorrectly. Can you try with the LCD reset pin connected to a fixed level instead of controlling it with a GPIO pin.

Can you provide a link to the ILI9320 LCD you used? Perhaps some LCD registers are different from the original, hence the mirrored text (i doubt this but it doesn't harm to check).

Frank

Edit : Tying the reset pin to a GPIO pin is probably causing your issue because the LCD is initialised when its constructor is called. Unless your reset pin is set correctly before the constructor call, things will go wrong. When i ported the demo to the KL25Z board, i wired the LCD reset pin to the KL25Z reset pin.

07 Oct 2014

I wouldn't rule out hardware issues. Since it worked fine on ours (and others), the software in itself should be fine. So either something changed (as Frank said, make sure you used the same mbed lib as we did, jut to rule that out), or you have adifferent version.

Alternatives would I think be hardware. Either connections which are not properly made, or interference from example servos, motors, etc.

07 Oct 2014

Hello Guys, Erik your name is familiar... have we been in contact before on MBED.org ?

Thank you guys, your suggestion work : I imported your demo program and it worked right away without any change to the hardware. The LCD's reset pin is still connected to the LPC1769 GPIO but your program doesn't use it so it appears the LCD's own pull-up is keeping it high.

As I wrote, it was very late at night when I did my first tests, so my brain wasn't working properly : for instance I too caught the fact that my reset pin had to be set before the your constructor ran, but then I messed up and made it an active-high reset for some reason... never a good idea to do this kind of work with a tired brain :-)

Your demo displays the text correctly, I don't know why mine displayed it mirrored. I'll fix the reset control in my own program and get back to you. It's happened to me once or twice to have problems with updated MBED libraries breaking a program, but here I don't think that's the case.

In any case MBED saves me so much time... I have a Mini-DK2 board with an ILI9320 LCD demo that I was thinking of porting to MBED when I realized someone might have had the same idea. MBED is just so cool. I hope you guys are as excited as I am about the MBED 3.0 announcement.

Anyway, thanks again for your help, I'll let you know how it ends.

Jean

07 Oct 2014

After a playing with the soldering iron for a couple minutes to tie the LCD reset to a 10K pull-up, I went back to my first program and it works.

So, good news : we can rule out any compatibility issue between your library and the latest MBED library. That didn't seem likely to have caused the problem anyway.

For the mirrored text, my guess it that it was due to the reset problem too : I haven't checked but I'd expect that the default values in the ILI9320 scanning setup registers have it going in the "wrong direction". I certainly hadn't touched the initialization code and now it works, so that must be it.

My LCD came from here :

http://www.hotmcu.com/28-touch-screen-tft-lcd-with-spi-interface-p-42.html?cPath=6_16

$10 a pop, hard to beat that price. It's discontinued now but only because they have a newer version that also supports the parallel interface :

http://www.hotmcu.com/28-touch-screen-tft-lcd-with-all-interface-p-63.html?cPath=6_16

Unfortunately the pinout is different for the LCD's 4 SPI pins so it's not a drop-in replacement, but close enough though. Controller is an ILI9325.

So there you have it guys, your library works on the LPCXpresso 1769 module :-)

Take care, and keep up the good work !

Jean

08 Oct 2014

Glad to hear the problem is solved. The replacement LCD you mentioned should also work with the library as it auto detects what driver chip is connected (ILI9320, 9325 or 9328) - SPI mode only.