ILI9325 color picture issue.

I've been playing with cheap tft lcd recently, and all was working more or less correctly till I try to reproduce this project:

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.

I have bitmap color problems too, I described them here

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.

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

// 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 :)

I will try it in next days. Thanks!


...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!!!