Go Down

Topic: MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields (Read 231445 times) previous topic - next topic

paulofeju

Either call tft.invertDisplay(1); in every  sketch.
Or change the REV_SCREEN attribute in the case 0x9481: block of the library CPP file. as a one-off edit

Note that there are about 4 different makes of TFT panels.    And probably about 12 different makes of Silicon chips.   So not every 9481 controller is used on the same panel.

David.
Many many Thanks Master David!!!

I called tft.invertDisplay(1) in the graphictest_kbv sketch and it worked fine!

Edit: But I coudn't find the REV_SCREEN attribute in the case 0x9481: (file mcufriend_kbv.cpp):

       So I did this modification (not sure if its the correct one):

FROM:
case 0x9481:
 _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_BGR;

TO:
case 0x9481:
_lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | READ_BGR | REV_SCREEN;

The only thing is that BMP images displayed on the screen are much clearer (paler) than they really are. But its not a great problem since the tft is working well now.

david_prentice

At the end of the case 0x9481 block you will find:
Code: [Select]

        table8_ads = ILI9481_regValues, table_size = sizeof(ILI9481_regValues);
//        table8_ads = ILI9481_CPT29_regValues, table_size = sizeof(ILI9481_CPT29_regValues);
//        table8_ads = ILI9481_PVI35_regValues, table_size = sizeof(ILI9481_PVI35_regValues);
//        table8_ads = ILI9481_AUO317_regValues, table_size = sizeof(ILI9481_AUO317_regValues);
//        table8_ads = ILI9481_CMO35_regValues, table_size = sizeof(ILI9481_CMO35_regValues);
//        table8_ads = ILI9481_RGB_regValues, table_size = sizeof(ILI9481_RGB_regValues);


Try each table one at a time.  i.e. uncomment only one line.

Run a photo program.   See which setting gives the best colours.

David.

paulofeju

Hi David!

I tried all the 6 options but unfortunately none of them solved the problem.
The strange thing is that when I force "tft.begin(0x8357)" the colours are OK (but the texts are mirrored).

Thank you so much!!!

david_prentice

What problem(s) ?
Make notes for each table.   Report back.

The inverted colours can be solved with invertDisplay() or by changing the REV_SCREEN attribute.

There is no point in using the wrong ID.

David.

paulofeju

What problem(s) ?
Make notes for each table.   Report back.

The inverted colours can be solved with invertDisplay() or by changing the REV_SCREEN attribute.

There is no point in using the wrong ID.

David.
I agree with you. I'll try each table again and let you know about each respective result.

Thanks!!!

paulofeju

After the 6 tries these were the results:


Try 1: table8_ads = ILI9481_regValues, table_size = sizeof(ILI9481_regValues);
Result: PALE COLOURS

Try 2: table8_ads = ILI9481_CPT29_regValues, table_size = sizeof(ILI9481_CPT29_regValues);
Result: +PALE COLOURS

Try 3: table8_ads = ILI9481_PVI35_regValues, table_size = sizeof(ILI9481_PVI35_regValues);
Result: VERY PALE COLOURS

Try 4: table8_ads = ILI9481_AUO317_regValues, table_size = sizeof(ILI9481_AUO317_regValues);
Result: +PALE COLOR

Try 5: table8_ads = ILI9481_CMO35_regValues, table_size = sizeof(ILI9481_CMO35_regValues);
Result: BLACK SCREEN

Option 6: table8_ads = ILI9481_RGB_regValues, table_size = sizeof(ILI9481_RGB_regValues);
Result: VERY PALE COLOURS


Thanks!

david_prentice

So it looks as if  ILI9481_regValues is the "best" GAMMA setting for your panel.

I suspect the backlight is too bright.   It is not possible to adjust the backlight current on these shields.

David

paulofeju

Its Ok. Thank you very much David!!! If I find a solution I'll tell you.

JMe87

Hello David, hello everybody
Thanks a lot David.
I follow your instructions.
Work now with OPEN-SMART (ILI9327) shield, but colors are mixed ?
Seems not to work with HX8352-B
Once again, thanks for all your work and your help

Jacques

david_prentice

Look at #2024.   The same advice applies to your ILI9327.

Did you try your HX8352-B shield yet?  i.e. with tft.begin(0x5252)

I have not compared the datasheets yet.   Himax are notorious for different commands for the same model with different suffixes.

David.

jyclop

Update your Library via the Library Manager.   (currently v2.9.7)
HX8357-B has ID = 0x8357
HX8357-D has ID = 0x9090

I have never seen a HX8357-B.   I rely on feedback from owners.
Please can you confirm whether v2.9.7 is correct for your display.

David.
David,

As you suspected, I had an old version of the library installed (v2.9.3 to be exact)
When I updated to v2.9.7 via the library manager, everything worked perfectly, just as expected!

Thank you! :)

-Jacob

JMe87

Hello David,
i try your propositions in msg #2034 refer to #2024 without succes.

Quote
Either call tft.invertDisplay(1); in every  sketch.
no change with 0 or 1, same reversed colors.

Quote
Or change the REV_SCREEN attribute in the case 0x9481
unable to found what to change. I search, of course, after 0x9327  ;)

I have a look at ILI9327 datasheet, very easy, just put D0 to 1 in reg 21H but how to do ..... ??

I look also at datasheet of HX8352A and B. They are VERY VERY different.

Thanks in advance
Jacques

N.B.: i forgot to say you, serial monitor display wrong screen size ?
Quote
TFT LCD test
Using OPENSMART 3.2" TFT Breakout Board Pinout
TFT size is 240x320
Serial took 0ms to start
ID = 0x9327
and it is a 240x400 display


david_prentice

Most programs call invertDisplay() in setup.   As a one-off.

The graphictest_kbv example changes rotations, inversions,  ... in every loop().
So you should call invertDisplay() at the start of loop()

I have an ILI9327.   I can test it for myself later.

I don't have a HX8352-B or even an HX83252-A.   Please can you run the LCD_ID_readreg sketch to confirm what controller you have.

I am without internat access on a PC.   I am replying on a Tablet.

David.

JMe87

Bingo !!
I place "invertDisplay() at the start of loop()" and work perfectly. Hat down  ;)

Test of shield labeled "HX8352B" (sketch modified for OPEN-SMART wiring)
Quote
Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 65   ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 65 00 00 00   Manufacturer ID
reg(0x0009) 00 8F 8F 8F 8F   Status Register
reg(0x000A) 8F 00   Get Power Mode
reg(0x000C) 00 01   Get Pixel Format
reg(0x0061) 01 00   RDID1 HX8347-G
reg(0x0062) 00 00   RDID2 HX8347-G
reg(0x0063) 00 00   RDID3 HX8347-G
reg(0x0064) 00 00   RDID1 HX8347-A
reg(0x0065) 00 04   RDID2 HX8347-A
reg(0x0066) 04 00   RDID3 HX8347-A
reg(0x0067) 00 20   RDID Himax HX8347-A
reg(0x0070) 20 00   Panel Himax HX8347-A
reg(0x00A1) 00 00 00 00 00   RD_DDB SSD1963
reg(0x00B0) 00 00   RGB Interface Signal Control
reg(0x00B4) 00 00   Inversion Control
reg(0x00B6) 00 00 00 00 00   Display Control
reg(0x00B7) 00 00   Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00   ILI9481, HX8357-B
reg(0x00C0) 00 00 00 00 00 00 00 00 00   Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00   GAMMA
reg(0x00CC) 00 00   Panel Control
reg(0x00D0) 00 00 00   Power Control
reg(0x00D2) 00 00 00 00 00   NVM Read
reg(0x00D3) 00 00 00 00   ILI9341, ILI9488
reg(0x00D4) 00 00 00 00   Novatek ID
reg(0x00DA) 00 00   RDID1
reg(0x00DB) 00 00   RDID2
reg(0x00DC) 00 00   RDID3
reg(0x00E0) 00 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03   GAMMA-P
reg(0x00E1) 03 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08   GAMMA-N
reg(0x00EF) 08 48 48 48 48 48   ILI9327
reg(0x00F2) 48 00 00 00 00 00 00 00 00 00 00 00   Adjust Control 2
reg(0x00F6) 00 00 00 00   Interface Control

Jacques

david_prentice

The HX8352-B has an ID = 0x0065 ??

The control registers are VERY different to the HX8352-A.

You will have to wait until I get Internet access.   Then I will create a test_8352B Branch on GitHub.
What shape is your screen?   

The 9327 can do 240x432 but panels are commonly 240x400.
The 8352-A can do 240x480.   I have never seen a 240x480.   The 8352-B can do 240x432.

David.

Go Up