Go Down

Topic: ILI9325 color picture issue. (Read 1 time) previous topic - next topic

Magician

I've been playing with cheap tft lcd recently, and all was working more or less correctly till I try to reproduce this project:
http://apcmag.com/arduino-project-make-digital-photo-frame.htm/#null

Issue:
1. Pictures look absolutely wrong about color mapping. I try both library, TFTLCD and Adafruit_TFTLCD, last one helps to get   chipset ID = ILI9325.
2. I also noticed, that this two grey shadow:
#define LIGHTGREY   0xC618      /* 192, 192, 192 */
#define DARKGREY    0x7BEF      /* 128, 128, 128 */
shows on display like violet and dark-green.

 Question:
Have someone experienced same problem with similar TFT LCD?
If yes, what was the solution?

Poking around a few hours, I get pretty close to the roots, and it's so disagree with datasheet, that I want to hear other opinion before I post my work-around.

zoomx

#1
Sep 05, 2015, 08:07 pm Last Edit: Sep 07, 2015, 11:42 am by zoomx
I have bitmap color problems too, I described them here
https://forum.arduino.cc/index.php?topic=338835.0

I read in the datasheet that this chip has an 8 color mode and I suspect that the library use this mode (not intentionally) instead of the 65535 one.

Magician

Yes, exactly like on your picture in another thread, the image is "greenish".
I run a few tests, changing RGB colors from 0 to 255 in three for-loops, and it turns out that color map isn't what declared in the data sheet. Supposed to be:  rrrrr.gggggg.bbbbb  but I get : rrrrr.0ggggg.bbbbb  as you can see, the highest bit in green field is not associated, though insted of RGB565 I have something like RGB5.55
 I have two display from the same seller, and both have similar issue. It's difficult to trace what is the cause, may be wiring in between controller ILI9325 and LCD or it could be not ILI9325 at all, but some kind of a clone, with wrong internal registers width. 
 I solve a problem by changing adafruit library ADAFRUIT_TFTLCD.cpp
Code: [Select]
// Pass 8-bit (each) R,G,B, get back 16-bit packed color
uint16_t Adafruit_TFTLCD::color565fix(uint8_t r, uint8_t g, uint8_t b) {
//  return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
  return ((r & 0xF8) << 8) | ((g & 0xF8) << 2) | (b >> 3);
}

Now all colors are correct, bitmaps look like  miracles  :)

zoomx

#3
Sep 06, 2015, 11:28 pm Last Edit: Sep 07, 2015, 12:04 pm by zoomx
I will try it in next days. Thanks!


IT WORKS!!!!
A BIG THANK

mclee1004

...Mannnnn, you will not believe how much time I spend on this issue.
I was sure it had to do with the 565 coding, but somehow never homed in on the root cause.
Thanks so much for providing this solution!!!

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy