Skip to main content
Topic: 1.8" TFT display register values (Read 5583 times) previous topic - next topic

1.8" TFT display register values

Hello to everyone! This is my first post here but I am following the blog for a couple of months already. You are doing a great job!!!

My question is about the initialization parameters of the 1.8inch TFT display that you present in Workshop Video #38. I am writing my own C driver and I manage to draw lines, circles, squares and write characters. The problem is that I am not sure about the correct register values of gamma, frame rate, boost voltages etc.

Till now my screen looks terrible. The contrast is low and the characters are like you wash them! Even the colors (I am using 16bit ones) are out of normal specs. I’ve played a little bit with different register values but the results were not worth it! At the workshop video the characters were crisp and clear with a nice contrast between them and the background!

Is it possible to post the init process of the screen or only the register values in order to have a look at the appropriate ones? Are you using 8x8 letters or bigger ones?

Thanks in advance!

Re: 1.8" TFT display register values

Reply #1
I lend the init-code from adafruit :) I also borrowed the 7x5 font they used.

Code: [Select]
    lcdreset();
    write_command(ST7735_SWRESET); // software reset
    delayms(150);

    write_command(ST7735_SLPOUT); // out of sleep mode
    delayms(500);

    write_command(ST7735_FRMCTR1); // frame rate control - normal mode
    write_data(0x01); // frame rate = fosc / (1 x 2 + 40) * (LINE + 2C + 2D)
    write_data(0x2C);
    write_data(0x2D);

    write_command(ST7735_FRMCTR2); // frame rate control - idle mode
    write_data(0x01); // frame rate = fosc / (1 x 2 + 40) * (LINE + 2C + 2D)
    write_data(0x2C);
    write_data(0x2D);

    write_command(ST7735_FRMCTR3); // frame rate control - partial mode
    write_data(0x01); // dot inversion mode
    write_data(0x2C);
    write_data(0x2D);
    write_data(0x01); // line inversion mode
    write_data(0x2C);
    write_data(0x2D);

    write_command(ST7735_INVCTR); // display inversion control
    write_data(0x07); // no inversion

    write_command(ST7735_PWCTR1); // power control
    write_data(0xA2);
    write_data(0x02); // -4.6V
    write_data(0x84); // AUTO mode

    write_command(ST7735_PWCTR2); // power control
    write_data(0xC5); // VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD

    write_command(ST7735_PWCTR3); // power control
    write_data(0x0A); // Opamp current small
    write_data(0x00); // Boost frequency

    write_command(ST7735_PWCTR4); // power control
    write_data(0x8A); // BCLK/2, Opamp current small & Medium low
    write_data(0x2A);

    write_command(ST7735_PWCTR5); // power control
    write_data(0x8A);
    write_data(0xEE);

    write_command(ST7735_VMCTR1); // power control
    write_data(0x0E);

    write_command(ST7735_INVOFF); // don't invert display

//    write_command(ST7735_MADCTL); // memory access control (directions)
//    write_data(0xC8); // row address/col address, bottom to top refresh
    rotate(rot); // we need to choose something :)

    write_command(ST7735_COLMOD); // set color mode
    write_data(0x05); // 16-bit color

    write_command(ST7735_CASET); // column addr set
    write_data(0x00);
    write_data(0x00); // XSTART = 0
    write_data(0x00);
    write_data(0x7F); // XEND = 127

    write_command(ST7735_RASET); // row addr set
    write_data(0x00);
    write_data(0x00); // XSTART = 0
    write_data(0x00);
    write_data(0x9F); // XEND = 159

    write_command(ST7735_GMCTRP1);
    write_data(0x02);
    write_data(0x1c);
    write_data(0x07);
    write_data(0x12);
    write_data(0x37);
    write_data(0x32);
    write_data(0x29);
    write_data(0x2d);
    write_data(0x29);
    write_data(0x25);
    write_data(0x2B);
    write_data(0x39);
    write_data(0x00);
    write_data(0x01);
    write_data(0x03);
    write_data(0x10);
    write_command(ST7735_GMCTRN1);
    write_data(0x03);
    write_data(0x1d);
    write_data(0x07);
    write_data(0x06);
    write_data(0x2E);
    write_data(0x2C);
    write_data(0x29);
    write_data(0x2D);
    write_data(0x2E);
    write_data(0x2E);
    write_data(0x37);
    write_data(0x3F);
    write_data(0x00);
    write_data(0x00);
    write_data(0x02);
    write_data(0x10);

    clearscreen(0x0000);

    write_command(ST7735_DISPON);
    delayms(100);

    write_command(ST7735_NORON); // normal display on
    delayms(10);

    write_command(ST7735_RAMWR);


Remind me that I should clean the code and upload to our svn :) You are sure you have the same display as we have?

Re: 1.8" TFT display register values

Reply #2
Thanks for your answer Sjaak! Actually two values of my code (at the FRMCTR1 register) were slightly wrong compared to your code, but still the end result is not good. Probably I will try to upload a couple of photos in order to describe the problem better in case someone recognise it...

I am sure that the display is the correct one. Same look and mechanical dimensions and same driver name as well (at least it says that). Maybe a driver variation is causing the problem...

Re: 1.8" TFT display register values

Reply #3
Been a while since i played with the board, but afaik the colors wre a bit off. Also the viewing angle was terrible and the pixelsize (you can notice the subpixels).

Btw are you aware the green channel has more bits then red and blue?

Re: 1.8" TFT display register values

Reply #4
Yes, the viewing angle is terrible++!!! But the display is cheap and very easy to use even with a small 8bit micro. I can find better ones with almost same complexity at the driver side, but the cost at the best case scenario is 2 times more expensive or even more.

For me the cost is very important together with the low operating voltage. This display can even work from 2.8V (for the driver and around 3V for the backlight) but the contrast and viewing angles are disappointing...