Arduino Forum

Using Arduino => Displays => Topic started by: NuuSG on Feb 11, 2019, 10:21 am

Title: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 11, 2019, 10:21 am
Recently I have bought a TFT, in this case whitout touch panel. This screen doesn't have SPI comunication, it needs MCU 8 bits comunication. The controller is a ILI9163C model and I don't find a lot of information about this. I have seen that this controller is equivalent to ST7735 model but I just find SPI libraries for this. I have used MCUfriend library for other TFT with MCU 8 bits but I have checked that is not valid for this controller. Do you know other MCU library that support this controller model?

https://github.com/prenticedavid/MCUFRIEND_kbv (https://github.com/prenticedavid/MCUFRIEND_kbv)

(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=294263)
(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=294265)
(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=294267)
(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=294269)
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 11, 2019, 11:47 am
It is a mystery why anyone would buy a 128x160 display with parallel interface.
Especially when 128x160 SPI modules are cheap and available.

Yes,   I could support it in MCUFRIEND_kbv if you are prepared to do the testing.
This means that I want to see your 3.3V test platform.

ILI9163C is similar to ST7735 and several other 132x162 MIPI controllers.

David.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 11, 2019, 06:07 pm
I have tested the LCD_ID_readreg example in MCU library for check if it support the controller and this is the result:

https://github.com/prenticedavid/MCUFRIEND_kbv/blob/master/examples/LCD_ID_readreg/LCD_ID_readreg.ino (https://github.com/prenticedavid/MCUFRIEND_kbv/blob/master/examples/LCD_ID_readreg/LCD_ID_readreg.ino)

Code: [Select]
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 04           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 00           RDID2
reg(0x00DC) 00 66           RDID3
reg(0x00E0) 00 06 07 1E 2C 09 0D 79 49 4F 1E 2B 31 3C 2F 02     GAMMA-P
reg(0x00E1) 00 0F 05 28 2C 32 16 4E DA 51 11 29 23 0F 0E 36     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

The example that we have used is next:

https://github.com/prenticedavid/MCUFRIEND_kbv/blob/master/examples/diagnose_TFT_support/diagnose_TFT_support.ino (https://github.com/prenticedavid/MCUFRIEND_kbv/blob/master/examples/diagnose_TFT_support/diagnose_TFT_support.ino)

It doesn't work...


Connections are next:

(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=294332)
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 11, 2019, 06:23 pm
Yes,  you have an ILI9163.
Which Arduino are you using?   Zero,   Due,   STM32-Nucleo,   Teensy3.x,  ...

I use Chinese Uno clones with  switchable 3.3V GPIO.   (Or Zero, Due,  ...)

David.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 12, 2019, 08:08 am
I have used UNO, MEGA and PRO-MINI clones.
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 12, 2019, 08:51 am
Disconnect your 3.3V display from the  Uno, Mega.
Upload any program to your 5V Uno, Mega.
Disconnect Uno.   Connect 3.3V display.   Power the Uno with 3.3V not USB.
.
Or run the Pro Mini at 3.3V with an external 3.3V Serial dongle.
.
Or buy thirteen level converter chips.
.
It is much easier and cheaper to buy a 3.3V Zero, Due clone.    Or a switchable Uno  clone like me.
.
Please say which 3.3V strategy you have chosen.    Or post a photo.
The display may already be damaged by 5V.

David.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 14, 2019, 05:51 pm
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.

(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=294830)(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=294834)
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 14, 2019, 06:33 pm
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.
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 15, 2019, 08:35 am
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.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 15, 2019, 08:41 am
Yes I found it. I have used this library (I left the link below) and it doesn't work. The screen is white continuously :smiley-confuse:

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

This is the result in LCD_ID_readreg:

Code: [Select]

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
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 15, 2019, 09:04 am
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.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 15, 2019, 09:21 am

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

Code: [Select]

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
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 15, 2019, 09:27 am
It should find the ID.

Please check your build report.  I would like to see where library versions are found and used.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 15, 2019, 09:36 am
These are my libraries:

(http://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=294947)


And the report:

Code: [Select]

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.


Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 15, 2019, 10:12 am
My apologies.   My ID test was wrong for ILI9163
Code: [Select]

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
Code: [Select]

    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.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 18, 2019, 04:04 pm
I have the same problem...  :smiley-confuse:  for a moment it seemed to work but it was not true ... This is the result of the diagnostic_TFT_support example:

Code: [Select]

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
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 18, 2019, 04:29 pm
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.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 18, 2019, 04:45 pm
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.
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 18, 2019, 05:01 pm
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
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 18, 2019, 06:09 pm
I got it!!  :D

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

(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=295397)

(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=295399)
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 18, 2019, 07:40 pm
Edit the CPP file.   Hint.  Look for case 0x9163:  and change the lcd_capable line to
Code: [Select]

#ifdef SUPPORT_9163
    case 0x9163:                //
        _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | INVERT_GS | READ_24BITS;
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 19, 2019, 08:59 am
I have changed this and there are no changes ... it shows the same.
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 19, 2019, 09:12 am
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:
Code: [Select]

#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.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 19, 2019, 09:33 am
This is the result on Serial Terminal:
Code: [Select]

Serial took 0ms to start
ID = 0x9163


This is my code on MCUFRIEND_kbv.cpp:
Code: [Select]

#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:
(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=295461)
(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=295463)
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 19, 2019, 10:37 am
Your version with inverted colours (REV_SCREEN) and upside down printing
Code: [Select]
        _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | REV_SCREEN | READ_24BITS;

My version with correct colours and correct Gate Scan
Code: [Select]
        _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.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 19, 2019, 11:57 am
I got it!!!  :smiley-lol:

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:

(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=295497)


Thank you very much for your help David! It has been very useful.
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 19, 2019, 12:12 pm
Please run the examples.    Make notes.

Does Vertical Scroll work?
Your photo seems to show a stationary image.

Many examples will adjust to the screen dimensions.
I have only used MCUFRIEND_kbv with 176x220, 240x320, 240x400, 320x480, 800x480

I would like to know if and how they work on your 128x160 display.

A recent question seems to be about a Mcufriend 1.8 inch display.
Your experience can help me answer.

David.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 19, 2019, 01:30 pm
I have executed different examples and it works. Yes, vertical scroll works. I think I have to modify some elements to adjust it exactly to 1.8 '', since I believe that some elements are possibly lost by the difference in screen size. Correct me if I'm wrong.

In this link you can see a short video of the working screen:

https://we.tl/t-92KoqhX0gX (https://we.tl/t-92KoqhX0gX)


(https://forum.arduino.cc/index.php?action=dlattach;topic=596969.0;attach=295512)

Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 19, 2019, 05:33 pm
Looking at your photo,   the ribbon comes out of the screen on the right hand side.
If you rotate the photo 90 degrees clockwise,  the ribbon comes out of the bottom of the screen.   Your cables come out of the top of the screen.

Your video is showing vertical scroll in the wrong direction.
For Landscape (GREEN) I would expect UP to show the screen moving right to left.
For Portrait (BLUE) I would expect UP to show the screen moving from bottom to top

I only have SPI 128x128 ILI9163C
I have an SPI 128x160 ST7735
I will run the "drawBitmap_kbv" example on the SPI screens.   (with my SPI kbv library not parallel MCUFRIEND_kbv)

I am not sure why the scroll directions are wrong.

David.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 20, 2019, 05:30 pm
I will continue working on this. If you have news please let me know.

Thanks!

Nuria.
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 24, 2019, 11:38 am
Sorry about forgetting you.    I have updated the Branch on GitHub.

Please can you try it.   I hope that it corrects the scroll directions.

David.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 26, 2019, 10:06 am
Previously I had download "test_9163" Branch and it doesn't works. Then I downloaded "master" and modified code in this and finally it works, but how you say, showing vertical scroll in the wrong direction.


Now I have tried both methods for test it but I can't get it to work, the screen is in white color. Could you tell me what lines do you have modified now and I try to modify it in my previous version?
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 26, 2019, 10:36 am
I would expect the "test_9163" to work because I have already enabled SUPPORT_9163 for you.
I would expect the "master" to work if you enable SUPPORT_9163 in MCUFRIEND_kbv.cpp

The change that I made was to
Code: [Select]

    case 0x9163:                //
        _lcd_capable = AUTO_READINC | MIPI_DCS_REV1 | MV_AXIS | 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
            0xB8, 1, 0x01,       // [00] GSCTRL
            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
        };

If you have a white screen, change it back to
Code: [Select]

    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
//            0xB8, 1, 0x01,       // [00] GSCTRL
            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
        };

  
and I will have to find another way to fix the scroll direction.

David.

Edit.   I have changed GSCTRL on an SPI ILI9163 and it works fine.   So I see no problem.

The first steps in ANY test is to read the ID and any messages written on the Serial Terminal.
Then make careful notes on paper about what you have done.

Life is much simpler (for me) if you are a GitHub member and have cloned the project.   You can access my Branch at any time.

You can always re-install a library from GitHub and start again.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Feb 26, 2019, 11:19 am
I have run SUPPORT_9163.

This is the result. But I am not sure what you say that it's not ok.

https://we.tl/t-TejTbMAji8 (https://we.tl/t-TejTbMAji8)
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Feb 26, 2019, 11:58 am
The scroll directions are still wrong.

BLUE SCROLL DN  moves up (instead of DOWN)
BLUE BAND moves down (instead of UP)
GREEN SCROLL UP is to the right (instead of to the left)
GREEN SCROLL DN is to the left (instead of to the right)
RED SCROLL UP moves down (instead of UP)
RED BAND moves down (instead of UP)

I presume that you have used today's "master" from GitHub (with SUPPORT_9163)

Thanks for the feedback.   I will have to think hard !!

David.
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Mar 01, 2019, 11:54 am
I was looking at the ILI9163 data sheet and noticed that you reported:
Code: [Select]

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

The ILI9163 datasheet says that reg(0xD3) should be
Code: [Select]

reg(0x00D3) xx 01 21 YY xx    //RDID4 where YY is Driver IC version ID

So perhaps your controller was not made by Ilitek.

Unfortunately I can only read certain registers with the SPI interface.  e.g. 0x04, 0xDA, 0xDB, 0xDC which are all correct.
I would be very interested in reading all the other registers via LCD_ID_readreg.   This is only possible with a parallel interface.

Yes,  I can correct the directions in #34 on my SPI ILI9163.
Did you make the video in #33 with the current "test_9163" Branch from GitHub?
This branch has already enabled SUPPORT_9163

David.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Mar 01, 2019, 12:12 pm

Yes, the video in #33 is done with "test_9163" Branch from GitHub.

I will continue trying it, if I have news I say to you.

Thanks!




Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Mar 01, 2019, 01:07 pm
Please can you run the LCD_ID_readnew.ino sketch from the examples.
Replace setup() with this function.
Code: [Select]

void setup()
{
    Serial.begin(9600);
    while (!Serial) ;
    Serial.println(F("Read Registers on MCUFRIEND UNO shield"));
    Serial.println(F("controllers either read as single 16-bit"));
    Serial.println(F("e.g. the ID is at readReg(0)"));
    Serial.println(F("or as a sequence of 8-bit values"));
    Serial.println(F("in special locations (first is dummy)"));
    Serial.println(F(""));
    lcdInit();
    lcdReset();      //ensures that controller is in default state
    //    unlock = unlock_1520;
    //    unlock = unlock_1526;
    //    unlock = unlock_8357;
    //    unlock = unlock_5310;
    //    page_N = d5310_1_in;
    //    for (uint16_t i = 0x00; i <= 0xFE; i++) readReg(i, 10, "f.k");
//    read_regs("diagnose any controller");
    //    read_xxxx("mystery");
    //    read_5310_P0("NT35310 P0");
    //    read_5310_P1("NT35310 P1");
    //    read_61509("R61509 / ILI9326");
    //    read_61526("R61520 / R61526");
    //    read_8357("HX8357X");
    //    read_9320("ILI9320");
    //    read_9327("ILI9327");
    read_9338("ILI9302 / ILI9329 / ILI9338 / ILI9341");
    //    read_9481("ILI9481 / HX8357-B / R61581");
    //    read_9486("ILI9486 / 1LI9488");
}

Copy-paste the Serial Terminal to your message.

Then run the sketch in the attachment.    
I suspect that all the scroll directions will be wrong.   Which are correct?
Please observe Marilyn.   Different Gammas (1 - 4) are used. Which is the best picture?

David.
Title: Re: TFT with ILI9163C and MCU control
Post by: NuuSG on Mar 01, 2019, 02:00 pm
I have tested LCD_ID_readnew.ino with replacement, this is the message in Serial Terminal.

Code: [Select]

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)

ILI9302 / ILI9329 / ILI9338 / ILI9341
reg(0x0004) 00 54 80 66 Manufacturer ID
reg(0x0009) 00 00 61 00 00 Status Register
reg(0x000A) 00 08 Get Powsr Mode
reg(0x000B) 00 00 Get Address Mode
reg(0x000C) 00 06 Get Pixel Format
reg(0x000D) 00 00 Get Display Mode
reg(0x000E) 00 00 Get Signal Mode
reg(0x000F) 00 00 Get Diagnostic Result
reg(0x00B0) 00 00 Interface Mode
reg(0x00B1) 00 0E 14 Frame Rate Normal
reg(0x00B2) 00 0E 14 Frame Rate Idle
reg(0x00B3) 00 0E 14 Frame Rate Partial
reg(0x00B4) 00 02 02 Inversion Control
reg(0x00B5) 00 08 03 00 00 Blanking Porch
reg(0x00B6) 00 06 02 02 Display Control
reg(0x00B7) 00 00 Entry Mode Set
reg(0x00C0) 00 0A Power Control 1
reg(0x00C1) 00 05 Power Control 2
reg(0x00C2) 00 00 Power Control 3
reg(0x00C3) 00 00 Power Control 4
reg(0x00C4) 00 00 Power Control 5
reg(0x00C5) 00 3C 48 VCOM Control 1
reg(0x00C7) 00 40 VCOM Control 2
reg(0x00D2) 00 00 00 NVM Status
reg(0x00D3) 00 91 63 00 RDID4
reg(0x00DA) 00 54 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 66 RDID3
reg(0x00E0) 00 0F 1A 0F 18 2F 08 20 22 1F 1B 23 37 00 07 02 GAMMA-P
reg(0x00E1) 00 0F 1B 0F 17 33 0C 29 2E 30 10 39 3F 00 07 03 GAMMA-N
reg(0x00F2) 00 00 GAMMA-3G
reg(0x00F6) 00 00 00 00 Interface Control


This is a video of the result of the attached example.
https://we.tl/t-gEOOPFJQ46 (https://we.tl/t-gEOOPFJQ46)

It's ok, true?
Title: Re: TFT with ILI9163C and MCU control
Post by: david_prentice on Mar 01, 2019, 02:39 pm
Woo-hoo.   The Rotations are correct.   The Directions are correct.

Gamma set #2 looks best from the video.    Which is best from your real-life eyes ?

Please edit the setGamma() function to change to tft.pushCommand(0xF2, &on, 1); 
Run the sketch again.    It will use the Gamma settings from begin() instead of the fixed curves.

I am a little surprised by reg(0xDB).   I expected to see 0x80
Code: [Select]

reg(0x0004) 00 54 80 66 Manufacturer ID
...
reg(0x00DA) 00 54 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 66 RDID3


Thanks for the feedback.

David.