Go Down

Topic: 1.44 inch TFT 128x128 GLCD ILI9163 (Read 63913 times) previous topic - next topic

gimpo

By adding some correction to x,y coordinates both "false" red tab TFTs works normally when the screen is rotated toward one of the four directions.

The code below illustrates what I mean (running with normal adafruit libs):

Code: [Select]

void loop()
{
    // rotation test
   
    int offset_y = 0;
    int offset_x = 0;
    for(int i = 0;i <4; i++)
    {
        tft.setRotation(i);
        tft.fillScreen(ST7735_BLACK);
        switch(i)
        {
            case 0:  offset_y = 32;  offset_x = 0;  break;
            case 1:  offset_y = 0;   offset_x = 32; break;
            case 2:  offset_y = 0;   offset_x = 0;  break;
            case 3:  offset_y = 0;   offset_x = 0;  break;
        }
        // draw a triangle pointing upward
        tft.fillTriangle(64+offset_x, 0+offset_y, 127+offset_x, 127+offset_y, 0+offset_x, 127+offset_y, GREEN);
       
        // write the current rotation value
        tft.setCursor(45+offset_x,60+offset_y);
        tft.print("rot = ");
        tft.print(i);
       
        delay(4000);
    }
}


As I understand, the main problem is the different arrangement/organization of the video memory in this new TFTs. Probably one could make this correction somehow automatic by providing a macro at the #define level of the libs.
Arduino, what else?

gimpo

#76
Apr 01, 2016, 09:07 pm Last Edit: Apr 01, 2016, 09:07 pm by gimpo
BTW. For using the above program fragment the TFT has to be initialized with the instruction

tft.initR(INITR_18BLACKTAB);
Arduino, what else?

david_prentice

#77
Apr 01, 2016, 09:47 pm Last Edit: Apr 01, 2016, 10:02 pm by david_prentice
i bought it on german ebay:

http://www.ebay.de/itm/121507144606?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

I tried playing with the  __OFFSET variable. Nothing works.
But maybe I've found a solution, tomorrow I will post my results.
Looking at your Ebay link,   their photo shows a red pcb V1.1 i.e. identical to my red v1.1 pcb.
It also looks as if that company does not deliver to the UK.

Your photos show a red pcb V2.1 that "looks" like the website V1.1 photo.   (and my V1.1 pcb)
Your photos show a red pcb V1.1 that has completely different traces and YELLOW header pins.

I am confused.    Is it the YELLOW header display that does not work with the Sumotoy library?

David.

Edit.   Just found a YELLOW header red pcb with similar traces to yours.    And ordered this display from Ebay

gimpo

#78
Apr 01, 2016, 10:33 pm Last Edit: Apr 02, 2016, 12:40 am by gimpo
Yes David the situation is quite confused.
If you look carefully at the photo on ebay you will notice that there is a printed serial number on the side of the display. That is the "good" red tab, the one working with sumotoy's libs like a charm.
Unfortunately I have received the version without that magic numbers and it doesn't work when using the setRotation instruction (even playing with almost all the definitions in the setting.h file of sumotoy's libs).

To summarize, the situation, as I remember, is the following:



                        Works with              Works with
                        adafruit libs?          Sumotoy's libs?
------------------------------------------------------------------------
TYPE A                  ?                       YES
(red pcb 1.1 with
serial numbers)
------------------------------------------------------------------------
TYPE B                  NO                      ALMOST*
(light red pcb 1.1
without serial
numbers and yellow
pin header)
------------------------------------------------------------------------
TYPE C                  ALMOST*                 ALMOST*
(red pcb 2.1
without serial
numbers and black
pin header)
------------------------------------------------------------------------
TYPE D                  ?**                     YES
(black pcb)


* = setRotation() instruction doesn't work properly
** = ask info to David Prantice

Arduino, what else?

david_prentice

#79
Apr 01, 2016, 11:23 pm Last Edit: Apr 01, 2016, 11:32 pm by david_prentice
I have no idea what colour tab was on a display's protective film when it arrived.   The first thing that I do is remove it !!

I would have more confidence in comparing the results from my "ST7735_readreg.ino" sketch.
Unfortunately,   there are only a handful of registers that are "readable".

Anyway,   in two weeks time,  I will see what arrives in the post.

Both my Black pcb and Red pcb 1.44" displays work with Sumotoy, ILI9163_kbv libraries.
Of course there are a few rotational and OFFSET kludges required,   but I can get a readable display with both libraries.   

As far as I can see,  there is no "Adafruit ILI9163" library.    Of course,  I use Adafruit_GFX with my ILI9163_kbv library.

David.

gimpo

#80
Apr 02, 2016, 12:21 am Last Edit: Apr 02, 2016, 12:26 am by gimpo
ooops! I have to change the words "tab" with "pcb" color. It was a "lapsus calami".


Programming hint required:
what is the best way to add the offset values to all of the calls to drawing functions in my program?

I was thinking to change the code directly in the libs, but if I will install a new version all my changes will be wiped...
Maybe the smarter way is to subclass the Adafruit_ST7735 class and add the offset to the X/Y params before calling the super-method?
Arduino, what else?

david_prentice

Please run my ST7735_readreg sketch with each of your four displays.
If you get different outputs,  please paste the results here.


I have always assumed that the 1.44" 128x128 displays use an ILI9163C controller.
One of them might use a ST7735 but it is unlikely.

The ST7735S can do everything that an ILI9163C can do.
The ST7735R can NOT scroll.

David.

gimpo

#82
Apr 02, 2016, 12:48 am Last Edit: Apr 02, 2016, 12:49 am by gimpo
Please run my ST7735_readreg sketch with each of your four displays.
If you get different outputs,  please paste the results here.
Here at home now I have only the "red pcb 2.1 - type C" tft, maybe tomorrow I can make some test on the other two red pcb types.
I have not the black one (Type D), I was sure that you have one of that.  :-\


ebay.de link
Arduino, what else?

gimpo

#83
Apr 02, 2016, 01:19 am Last Edit: Apr 02, 2016, 01:19 am by gimpo
One more thing:

apart from the setRotation() failure (and scroll problems), both red pcbs v1.1 and 2.1 (types B and c in the table above) seems to work quite good with the Adafruit_ST7735 class of the Adafruit libs. How can it be?
Both vendors states that they are equipped with a generic ILI9163 display, but 99% of graphic primitives works with software written for the ST7735 by adafruit.
Arduino, what else?

david_prentice

Modern TFT controllers are MIPI-compliant.   i.e. the basic commands like SLEEP_IN, SLEEP_OUT, SETWINDOW, ... are identical.   This is why an ILI9341 screen will probably show something even though you had intended a ST7735 or ILI9163.

There are big differences between the Panel configuration registers from one make to another.    The Gamma settings register on a ILI9481 is a Power Settings register on an ILI9486.    So a program that expects to set the Gamma curve on an ILI9481 could cause mayhem on a ILI9486.

Most of these "modern" MIPI controllers can start up by themselves without any special Power Settings.    So if you avoid the non-standard registers,   your program will probably run (using defaults) on many different controllers.     You only have to watch UTFT discussions.     Punters will use a 240x400 "model" when they have a 240x320 screen.   And wonder why the display looks odd.

If you can read the ID register(s),   you can determine which controller chip is actually mounted on your display.

David.

 

pomwah

#85
Apr 02, 2016, 03:01 pm Last Edit: Apr 02, 2016, 03:09 pm by pomwah Reason: added more information.
Greetings,

I'm new to this forum and new to things Arduino.
I too had the same trouble as +gimpo and found a part solution in defining my board as a "black"

+david_prentice I got the board here: http://www.ebay.com.au/itm/182049880492?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

I'm still having trouble with the rotation in the Test sketch .... but I'm still working on it.

I did run +david-prentice's register id sketch but it came back with a lot of nothing.

I'll keep playing with it.

Cheers

Edit: I inadvertently removed the VCC supply (5v, I'm using a Uno) and the display kept working quite happily on the 3.3v I was supplying to the LED backlight pin.

david_prentice

Your pcb and display panel "looks" like my old Red pcb.    It should work just fine with Sumotoy's TFT_ILI9163C library.   

Define __144_RED_PCB__ or __144_BLACK_PCB__ in the "_settings/TFT_ILI9163C_settings.h" file.

My "ST7735_readreg.ino" will only work with proper 3.3V GPIO levels. 
 
If you are using "level-converter" chips,  it will not change the read/write direction.
If you are using 2k2 series resistors it will probably work.

And of course,   I hard-wire my interface.   You must copy my SCK=13, SDA=11, A0=9, RESET=8, CS=10 wiring.

I have just tried my BLACK_PCB with the Sumotoy's "bigtest" and scrolltest example.   They work fine but are in PORTRAIT_REV.

David.

gimpo

- HELP REQUIRED -

I need some help about CPP programming, I'm not so smart about it...  :smiley-sad:

To add the proper shift along X and Y axis (upon the current rotation used) I thought that the simplest solution was to subclass the adafruit class and override all of the geometric functions.

My new TFT144 class add the shift for me and then call the original method in the base class.
In this way I have not to change a single line of the code I wrote before.
For example:

Code: [Select]
void TFT144::fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color) {
    Adafruit_ST7735::fillRoundRect(x0+offset_x, y0+offset_y, w, h, radius, color);
}

Whereas the offset_x/y variables are updated everytime the setRotation function is called.


Easy, isn't it? Unfortunately this approach doesn't work properly. Some functions works, some other does not.
For example, the drawTriangle code in the base class contains some calls the drawLine method. At runtime it call the method contained in the derived class, not in the base class itself!
As result the shift values are added twice... what a mess!  :o

How I can force a method of the base class to not call the overridden methods???
Arduino, what else?

david_prentice

Why do you want to create a new class?

Why do you not use the TFT_ILI9163C library with your ILI9163 display?

Have you read the ID register(s) from each of your 1.44" displays yet?

If you are determined to add an __OFFSET to the Adafruit_ST7735 library,  just look at how Sumotoy does it.
If you put the __OFFSET into a private class variable e.g. __offset,   you can add a single method() to turn it on and off.

David.

gimpo

false Red PCB 2.1:


Bi-directional Read registers
controller reg(0x01) = 0x00
ST7735R reg(0x04) = 0x7C89F0
ST7735R reg(0x09) = 0x610000
ST7735R reg(0x0A) = 0x08
ST7735R reg(0x0B) = 0x00
ST7735R reg(0x0C) = 0x06
ST7735R reg(0x0D) = 0x00
ST7735R reg(0x0E) = 0x00
ST7735R reg(0x0F) = 0x00
ST7735R reg(0x2E) = 0xEC2826
ST7735R reg(0xD3) = 0x663530
ST7735R reg(0xDA) = 0x7C
ST7735R reg(0xDB) = 0x89
ST7735R reg(0xDC) = 0xF0


false Red PCB 1.1 (the one with yellow headers):


Bi-directional Read registers
controller reg(0x01) = 0x00
controller reg(0x04) = 0x9101
controller reg(0x09) = 0x610000
controller reg(0x0A) = 0x08
controller reg(0x0B) = 0x00
controller reg(0x0C) = 0x06
controller reg(0x0D) = 0x00
controller reg(0x0E) = 0x00
controller reg(0x0F) = 0x00
controller reg(0x2E) = 0xFFFFFF
controller reg(0xD3) = 0x9101FF
controller reg(0xDA) = 0x00
controller reg(0xDB) = 0x91
controller reg(0xDC) = 0x01



No time to check the "true Red PCB 1.1", I have not it here at home... :(

Arduino, what else?

Go Up