TFT with ILI9163C and MCU control

I have tried it again with other new screen (the same model) with Arduino Pro Mini board (3.3V). I have tested the same but it doesn't works.

mont3.jpg

mont3.jpg

That looks fine. You just have to press Reset button at the right time to upload via the Pro Mini bootloader.

I have created a Branch on GitHub for you called "test_9163"

If you have cloned the library, you just need to change Branch.
If you are just using Arduino, you need to leave IDE. delete existing library. start IDE.
select correct Branch in GitHub and Download as ZIP.
Install from ZIP

The example programs should detect the ID for a ST7735 or an ILI9163
The LCD_ID_readreg program should work too.

Please tell me about colours, mirroring, etc.
Please tell me if you get a White Screen.

David.

You have the GitHub link in #0.
Select a Branch in left hand box. Select Download as ZIP in green box on the right hand side of the screen.

Ask if you have a problem.

David.

Yes I found it. I have used this library (I left the link below) and it doesn't work. The screen is white continuously :confused:

https://github.com/prenticedavid/MCUFRIEND_kbv/tree/test_9163/examples

This is the result in LCD_ID_readreg:

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 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 54 80 66 Manufacturer ID
reg(0x0009) 00 00 61 00 00 Status Register
reg(0x000A) 00 08 Get Power Mode
reg(0x000C) 00 06 Get Pixel Format
reg(0x0061) 00 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 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 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 02 Inversion Control
reg(0x00B6) 00 06 02 02 02 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 00 0A 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 09 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 00 00 NVM Read
reg(0x00D3) 00 91 63 00 ILI9341, ILI9488
reg(0x00D4) 00 00 00 00 Novatek ID
reg(0x00DA) 00 54 RDID1
reg(0x00DB) 00 80 RDID2
reg(0x00DC) 00 66 RDID3
reg(0x00E0) 00 2F 3C 3D 2A 0F 1C 5E 02 7E 07 37 2C 2D 23 21 GAMMA-P
reg(0x00E1) 00 1D 23 1A 2D 36 05 0B DD 05 02 29 0D 17 29 14 GAMMA-N
reg(0x00EF) 00 00 00 00 00 00 ILI9327
reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00 Adjust Control 2
reg(0x00F6) 00 00 00 00 Interface Control

Run graphictest_kbv. What does it say on SerialTerminal?
Run diagnose_TFT_controller. What does it say?

The good news is that you have learned how to connect a 3.3V display to a 3.3V Pro Mini and upload / run sketches like a regular Arduino.

I hope that you have not got any duplicate libraries. That is why I advised deleting old directories in #7.

David.

With diagnose_TFT_support, this is the result, it is not a compatible model:

Diagnose whether this controller is supported
There are FAQs in extras/mcufriend_how_to.txt

tft.readID() finds: ID = 0x0

MCUFRIEND_kbv version: 2.9.9


This ID is not supported
look up ID in extras/mcufriend_how_to.txt
you may need to edit MCUFRIEND_kbv.cpp
to enable support for this ID
e.g. #define SUPPORT_8347D

New controllers appear on Ebay often
If your ID is not supported
run LCD_ID_readreg.ino from examples/
Copy-Paste the output from the Serial Terminal
to a message in Displays topic on Arduino Forum
or to Issues on GitHub

Note that OPEN-SMART boards have diff pinout
Edit the pin defines in LCD_ID_readreg to match
Edit mcufiend_shield.h for USE_SPECIAL
Edit mcufiend_special.h for USE_OPENSMART_SHIELD_PINOUT

It should find the ID.

Please check your build report. I would like to see where library versions are found and used.

These are my libraries:

And the report:

In file included from C:\Users\esola\Documents\Arduino\libraries\MCUFRIEND_kbv-test_9163\MCUFRIEND_kbv.cpp:35:0,

                 from C:\Users\esola\Documents\Arduino\libraries\MCUFRIEND_kbv-test_9163\OPENSMART_kbv.cpp:16:

C:\Users\esola\Documents\Arduino\libraries\MCUFRIEND_kbv-test_9163\utility/mcufriend_shield.h:18:2: warning: #warning WE ARE USING A SPECIAL CUSTOM DRIVER [-Wcpp]

#warning WE ARE USING A SPECIAL CUSTOM DRIVER

  ^

El Sketch usa 17608 bytes (57%) del espacio de almacenamiento de programa. El máximo es 30720 bytes.
Las variables Globales usan 416 bytes (20%) de la memoria dinámica, dejando 1632 bytes para las variables locales. El máximo es 2048 bytes.

My apologies. My ID test was wrong for ILI9163

Controllers like ILI9341 have the ID like this: i.e. xx 00 93 41
reg(0x00D3) 00 00 93 41 RDID4

Your controller has : xx 91 63 00
reg(0x00D3) 00 91 63 00 ILI9341, ILI9488

Please change these lines in MCUFRIEND_kbv.cpp to

    ret32 = readReg32(0xD3);      //[xx 91 63 00]
	ret = ret32 >> 8;
	if (ret == 0x9163) return ret;
    ret = readReg32(0xD3);      //for ILI9488, 9486, 9340, 9341
    msb = ret >> 8;
    if (msb == 0x93 || msb == 0x94 || msb == 0x98 || msb == 0x77 || msb == 0x16)
        return ret;             //0x9488, 9486, 9340, 9341, 7796

I have updated the test_9163 Branch. You can either replace the whole MCUFRIEND_kbv.cpp
or hand-edit those lines.

The example sketches should detect the correct ID now.

David.

I have the same problem... :confused: for a moment it seemed to work but it was not true ... This is the result of the diagnostic_TFT_support example:

Diagnose whether this controller is supported
There are FAQs in extras/mcufriend_how_to.txt

tft.readID() finds: ID = 0x0

MCUFRIEND_kbv version: 2.9.9


This ID is not supported
look up ID in extras/mcufriend_how_to.txt
you may need to edit MCUFRIEND_kbv.cpp
to enable support for this ID
e.g. #define SUPPORT_8347D

New controllers appear on Ebay often
If your ID is not supported
run LCD_ID_readreg.ino from examples/
Copy-Paste the output from the Serial Terminal
to a message in Displays topic on Arduino Forum
or to Issues on GitHub

Note that OPEN-SMART boards have diff pinout
Edit the pin defines in LCD_ID_readreg to match
Edit mcufiend_shield.h for USE_SPECIAL
Edit mcufiend_special.h for USE_OPENSMART_SHIELD_PINOUT

Did you edit the CPP file?
Or replace the file from GitHub?
Or delete directory and download ZIP again?

The purpose of GitHub is to show each individual change to a file.
You can select Branch and click on the change.
Or read the new version of CPP file

Alternatively you could just tft.begin(0x9163); in graphictest_kbv sketch.

David.

I deleted the directory and downloaded the ZIP again, with the test_9163 branch.

In graphictest_kbv sketch I have two problems, it is for SPI and reports an error that is too big for Arduino Pro Mini.

How big is it?

Change graphictest to show wifi_full[ ] instead of penguin[ ]

But the diagnose_TFT_controller sketch should work if you have replaced the ZIP.

David.

Did you select "test_9163" Branch when you downloaded the new ZIP ?
The Arduino IDE "Install from ZIP" requires you to leave IDE, delete directory, start IDE, install from ZIP

I got it!! :smiley:

But this is the result in Font_simple and graphictest_kbv examples, Is it possible that dimensions are not well defined?

Edit the CPP file. Hint. Look for case 0x9163: and change the lcd_capable line to

#ifdef SUPPORT_9163
    case 0x9163:                //
        _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | INVERT_GS | READ_24BITS;

I have changed this and there are no changes ... it shows the same.

I don't believe you.
What is printed on the Serial Terminal?

Please copy-paste the lines from your MCUFRIEND_kbv.cpp that correspond to #20.

This is what the whole block should look like:

#ifdef SUPPORT_9163
    case 0x9163:                //
        _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | INVERT_GS | READ_24BITS;
        static const uint8_t PROGMEM table9163C[] = {
            //  (COMMAND_BYTE), n, data_bytes....
            0x26, 1, 0x04,       // [01] GAMMASET
            0xF2, 1, 0x01,       // [00] GAMRSEL
            0xE0, 16, 0x0f, 0x1a, 0x0f, 0x18, 0x2f, 0x28, 0x20, 0x22, 0x1f, 0x1b, 0x23, 0x37, 0x00, 0x07, 0x02, 0x10,
            0xE1, 16, 0x0f, 0x1b, 0x0f, 0x17, 0x33, 0x2c, 0x29, 0x2e, 0x30, 0x30, 0x39, 0x3f, 0x00, 0x07, 0x03, 0x10,
            0xB1, 2, 0x08, 0x02,  //[0E 14] FRMCTR1 if GM==011 61.7Hz
            0xB4, 1, 0x07,       // [02] INVCTR
            0xC0, 2, 0x0A, 0x02, // [0A 05] PWCTR1 if LCM==10
            0xC1, 1, 0x02,       // [07] PWCTR2
            0xC5, 2, 0x50, 0x63, // [43 4D] VMCTR1
            0xC7, 1, 0,          // [40] VCOMOFFS
            //  0x33, 6, 0, 0, 0, 128 + 0, 0, 0, //VSCLLDEF
        };
        table8_ads = table9163C, table_size = sizeof(table9163C);   //
        p16 = (int16_t *) & HEIGHT;
        *p16 = 160;
        p16 = (int16_t *) & WIDTH;
        *p16 = 128;
        break;
#endif

David.

This is the result on Serial Terminal:

Serial took 0ms to start
ID = 0x9163

This is my code on MCUFRIEND_kbv.cpp:

#ifdef SUPPORT_9163
    case 0x9163:                //
        _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | REV_SCREEN | READ_24BITS;
        static const uint8_t PROGMEM table9163C[] = {
            //  (COMMAND_BYTE), n, data_bytes....
            0x26, 1, 0x04,       // [01] GAMMASET
            0xF2, 1, 0x01,       // [00] GAMRSEL
            0xE0, 16, 0x0f, 0x1a, 0x0f, 0x18, 0x2f, 0x28, 0x20, 0x22, 0x1f, 0x1b, 0x23, 0x37, 0x00, 0x07, 0x02, 0x10,
            0xE1, 16, 0x0f, 0x1b, 0x0f, 0x17, 0x33, 0x2c, 0x29, 0x2e, 0x30, 0x30, 0x39, 0x3f, 0x00, 0x07, 0x03, 0x10,
            0xB1, 2, 0x08, 0x02,  //[0E 14] FRMCTR1 if GM==011 61.7Hz
            0xB4, 1, 0x07,       // [02] INVCTR
            0xC0, 2, 0x0A, 0x02, // [0A 05] PWCTR1 if LCM==10
            0xC1, 1, 0x02,       // [07] PWCTR2
            0xC5, 2, 0x50, 0x63, // [43 4D] VMCTR1
            0xC7, 1, 0,          // [40] VCOMOFFS
            //  0x33, 6, 0, 0, 0, 128 + 0, 0, 0, //VSCLLDEF
        };
        table8_ads = table9163C, table_size = sizeof(table9163C);   //
        p16 = (int16_t *) & HEIGHT;
        *p16 = 160;
        p16 = (int16_t *) & WIDTH;
        *p16 = 128;
        break;
#endif

And this is my screen:
screen1_.jpg

screen1_.jpg

Your version with inverted colours (REV_SCREEN) and upside down printing

        _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | REV_SCREEN | READ_24BITS;

My version with correct colours and correct Gate Scan

        _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | INVERT_GS | READ_24BITS;

I am 99.9% confident that this should fix the display.

Does the Vertical Scroll and Band Scroll work ?
I am not sure if you will be able to see Software Scroll.
I was expecting to see the "WiFi Full" icon instead of a Penguin.
Or was it too big for your Pro Mini? (the Pro Mini bootloader is bigger than a Uno bootloader)

David.

I got it!!! :grinning:

Right, that was the problem. I don't know why the changes had not been saved and the previous version was running.

This is the result:

f_1.jpg

Thank you very much for your help David! It has been very useful.

f_1.jpg