Jump to content

Distorted image with ILI9325


shilow

Recommended Posts

Hi!

I try to connect devboard HY-STM32F103VE to µGFX with ChibiOS/RT. This board contains LCD with ILI9325 controller.

To some extent, I got it.

I use current µGFX from GIT.

The Startup logo shows OK, but my graphics and text -- no:

documents-export-2013-07-29.zipHY-STM32F103VE.7z[/attachment]

What could be the problem? Perhaps there is another controller installed?

img_31581.thumb.jpg.e0558926e77ff9779188

HY-STM32F103VE.7z

Link to comment
Share on other sites

This happens sometimes. Please try the following three things in that order:

  • Try all four orientations using gdispSetOrientation().
  • It already occurred several times that suppliers used different versions of the ILI93xx chip. For example, some claimed to sell ILI9325 displays but what was really delivered was an ILI9320. Please make sure that you got the correct one. You can read out the display controllers revision register (datasheet).
  • Usually you get some demo code shipped with the display. If none of the above lead to a positive result, please swap the initialisation code inside /drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c with the one from the demo code. Look for the gdisp_lld_init() function.

One more thing: How does your hardware setup look like? Is it a PCB or some breadboard setup? I'm curious that the filling options appear to work correctly. This could mean that there is noise on the bus. Are you using SPI or FSMC? You could also try to lower your bus frequency should the points above not work.

~ Tectu

Link to comment
Share on other sites

Hi!

Helped:

GDISP_REG = 0x0003;

GDISP_RAM = 0x1030; // for GDISP_DEFAULT_ORIENTATION == GDISP_ROTATE_PORTRAIT

immediately after

gfxInit();

with GDISP_ROTATE_LANDSCAPE and 0x1038 -- image flipped vertically.

This happens sometimes. Please try the following three things in that order:

  • Try all four orientations using gdispSetOrientation().
gdispSetOrientation() -- spoils the image
It already occurred several times that suppliers used different versions of the ILI93xx chip. For example, some claimed to sell ILI9325 displays but what was really delivered was an ILI9320. Please make sure that you got the correct one. You can read out the display controllers revision register (datasheet).
it really ili9325
Usually you get some demo code shipped with the display. If none of the above lead to a positive result, please swap the initialisation code inside /drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c with the one from the demo code. Look for the gdisp_lld_init() function.

initialisation code the same -- one to one.

One more thing: How does your hardware setup look like? Is it a PCB or some breadboard setup? I'm curious that the filling options appear to work correctly. This could mean that there is noise on the bus. Are you using SPI or FSMC? You could also try to lower your bus frequency should the points above not work.

~ Tectu

my board HY-STM32 -- its a development board, display connetcted via FSMC.

Link to comment
Share on other sites

When I checked last night there was no button to reply and when I tried to compose a new PM I got a message saying that I wasn't allowed.

It seems to be working now.

I may need some help getting a project set up to test this.

I downloaded the driver but when I tried to use it in one of my existing projects I get the following:

Compiling gdisp_lld_ILI9325.c
../../ext/ugfx/drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c:23:52: fatal error: drivers/gdisp/ILI9325/gdisp_lld_config.h: No such file or directory
compilation terminated.
make: *** [build/obj/gdisp_lld_ILI9325.o] Error 1

I don't really want to start messing around with the driver itself so I may need to adjust the paths that I am using.

My projects are all in subdirectories under the $(CHIBIOS)/demos directory.

Link to comment
Share on other sites

If I replace

#include "drivers/gdisp/ILI9325/gdisp_lld_config.h"

with

#include "gdisp_lld_config.h"

I get

Compiling gdisp_lld_ILI9325.c
../../ext/ugfx/drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c:25:30: fatal error: src/gdisp/driver.h: No such file or directory
compilation terminated.
make: *** [build/obj/gdisp_lld_ILI9325.o] Error 1

I can't find a file called driver.h anywhere.

I can't test a driver that I can't compile. :cry:

Link to comment
Share on other sites

You should take your current working project and just replace the gdisp_lld_ILI9325.c file inside /drivers/gdisp/ILI9325 (You should back up your current one). Everything should compile just fine then assuming that your current project with the current driver compiles as well (Is that the case?).

I'm currently not able to test it. Probably shilow can help.

Thank you very much for your time guys. It helps us a lot to improve the quality of the project.

~ Tectu

Link to comment
Share on other sites

Yes that is what I expected. I replace my existing driver with the one that shilow provided.

I had some issues getting that to compile.

I needed to adjust some of the include statements for incorrect path and non-existent header files (driver.h)

I also needed to replace gdispColor2Native() and gdispNative2Color() with COLOR2NATIVE() and NATIVE2COLOR().

Now it compiles fine but it doesn't seem to initialize my display correctly.

p.s. The "good news" is that it turns out that my "working" ILI9325 driver has the same issue as shilow is having. Anything other than GDISP_ROTATE_0 doesn't display correctly. It's good news because now I am more motivated to fix the damn thing. :D The only problem is that I am not sure how much time I can devote to this issue.

Link to comment
Share on other sites

I needed to adjust some of the include statements for incorrect path and non-existent header files (driver.h)

it is standart include in gdisp_lld_ILI9325.c

#include "src/gdisp/driver.h"

that refers to the file in ugfx/src/gdisp/

Link to comment
Share on other sites

I don't understand why it doesn't compile for you either as the file includes the same headers. I'm sadly not able to compile it myself before the weekend and I still couldn't try it as I don't have such a display.

However, when I understand you guys correctly - we need two separate drivers?

~ Tectu

Link to comment
Share on other sites

I fought with this most of the day and I think I may have it worked out.

I started with the driver that shilow had provided it and "fiddled" until it seemed to work for all four orientations.

I have tested this on two boards and three displays and it seems OK.

STM3241G-EVAL -> FSMC Interface -> Built-in 3.2" display with 9325 chip. Tested OK

STM32F4-Discovery -> SPI Interface -> HY28B display with 9325 chip (X2) Tested OK.

STM32F4-Discovery -> SPI Interface -> HY28B display with 9328 chip. Not working.

I am pretty sure that my old driver worked on both the 9325 and the 9328 chips before so I need to dig further into that issue.

The code could stand some cleanup and more testing but I am much happier now.

ILI9325.zip

Link to comment
Share on other sites

STM32F4-Discovery -> SPI Interface -> HY28B display with 9328 chip. Not working.

This is working now, sort of. I think I am having wiring or timing issues on the SPI.

Stepping through the code, the chip id is now being read as 9329, not 9328.

Whatever is causing that apparently didn't mess with the 9325 id because it's LSB is set anyway.

The driver appears to be fine.

Link to comment
Share on other sites

Glad to hear that you got it working! Shilow, could you give the driver attached in xlh1460s post a final try? We'll replace the one in the repository then.

to successfully launch I had to change the reset procedure and add the initialization section for "Devicecode == 4532"

screen rotation function did not work correctly

image has been mirrored

I attach a simple demonstration project with a working driver for my LCD.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...