• AVR Freaks

Hot!ili9341 Full Screen Error

Author
kontrol
New Member
  • Total Posts : 20
  • Reward points : 0
  • Joined: 2018/09/25 00:59:15
  • Location: 0
  • Status: offline
2019/04/09 00:27:07 (permalink)
0

ili9341 Full Screen Error

The bottom of the screen does not appear when I want to use more than 240x240 resolution pixels on the ili9341 screen. I think the problem is init function. but I can't find the solution. I will add the init function as a file.best regards.
post edited by kontrol - 2019/04/09 08:26:05
#1

12 Replies Related Threads

    Aussie Susan
    Super Member
    • Total Posts : 3541
    • Reward points : 0
    • Joined: 2008/08/18 22:20:40
    • Location: Melbourne, Australia
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/09 19:41:57 (permalink)
    0
    Unless you want a whole series of somewhat sarcastic answers to your post, I suggest that you ask your question better and also tell us a whole lot more about your set up.
    What hardware (MCU, development board of any etc.) are you using?
    Can you show us a schematic?
    What development environment are you using (IDE, programmer, compiler, source of any 3rd party code...)?
    Can you show us the code (including the config settings) for a small but complete app that exhibits the problem?
    Susan
    #2
    kontrol
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/09/25 00:59:15
    • Location: 0
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/10 01:30:31 (permalink)
    0
    Simulation Preview https://ibb.co/VW33pT5
    Mplab xc8
    18f4550 

    I tried the examples on many pages to fix the problem. The codes are a little confused. but part of the image fills up quickly. but still not working full screen. Best regards.
     

    void init_display(){
    TRIS_CS = 0; TRIS_DC = 0; TRIS_RES = 0;
    TFT_CS = 1; TFT_DC = 0; TFT_RES = 0;
    TFT_Reset();
    TFT_WriteCommand(0x28); //DISPLAY OFF
    TFT_WriteCommand(0x11); //EXIT SLEEP MODE
    TFT_WriteParameter(0x0000);
    TFT_WriteCommand(0xEF);
    TFT_WriteParameter(0x03);
    TFT_WriteParameter(0x80);
    TFT_WriteParameter(0x02);

    TFT_WriteCommand(0xCB);
    TFT_WriteParameter(0x0039);
    TFT_WriteParameter(0x002c);
    TFT_WriteParameter(0x0000);
    TFT_WriteParameter(0x0034); //VCORE = 1.6V
    TFT_WriteParameter(0x0002); //DDVDH = 5.6V


    TFT_WriteCommand(0xCF);
    TFT_WriteParameter(0x0000);
    TFT_WriteParameter(0x00C1);
    TFT_WriteParameter(0x0030);
    writecommand(ST7735_PWCTR1); // power control
    //writedata(0xA2);
    //writedata(0x02); // -4.6V
    writedata(0x84); // AUTO mode
    TFT_WriteCommand(0xE8);
    TFT_WriteParameter(0x0085);
    TFT_WriteParameter(0x0000);
    TFT_WriteParameter(0x0078);

    TFT_WriteCommand(0xEA);
    TFT_WriteParameter(0x0000);
    TFT_WriteParameter(0x0000);
    TFT_WriteCommand(0xED);
    TFT_WriteParameter(0x0064);
    TFT_WriteParameter(0x0003);
    TFT_WriteParameter(0x0012);
    TFT_WriteParameter(0x0081);
    TFT_WriteCommand(0xF7);
    TFT_WriteParameter(0x0020);
    TFT_WriteCommand(0xC0);
    //TFT_WriteParameter(0x0026);
    writedata(0x23); //A2
    //writedata(0x02); // -4.6V
    // writedata(0x84); // AUTO mode

    TFT_WriteCommand(0xC1);
    TFT_WriteParameter(0x0010);
    TFT_WriteCommand(0xC5);
    TFT_WriteParameter(0x003E);
    TFT_WriteParameter(0x0028);
    TFT_WriteCommand(0xC7);
    TFT_WriteParameter(0x0086);
    TFT_WriteCommand(0x36);
    TFT_WriteParameter(0x0048);

    TFT_WriteCommand(0x3A);
    TFT_WriteParameter(0x0055);

    TFT_WriteCommand(0xB6);
    TFT_WriteParameter(0x0008);
    TFT_WriteParameter(0x0082);
    TFT_WriteParameter(0x0027);
    TFT_WriteCommand(0xF2);
    TFT_WriteParameter(0x0000);

    TFT_WriteCommand(0x26);
    TFT_WriteParameter(0x01);

    writecommand(ST7735_GMCTRP1);
    writedata(0x0f); //writedata(0x09);
    writedata(0x1a); //writedata(0x16);
    writedata(0x0f); //writedata(0x09);
    writedata(0x18); //writedata(0x20);
    writedata(0x2f); //writedata(0x21);
    writedata(0x28); //writedata(0x1B);
    writedata(0x20); //writedata(0x13);
    writedata(0x22); //writedata(0x19);
    writedata(0x1f); //writedata(0x17);
    writedata(0x1b); //writedata(0x15);
    writedata(0x23); //writedata(0x1E);
    writedata(0x37); //writedata(0x2B);
    writedata(0x00); //writedata(0x04);
    writedata(0x07); //writedata(0x05);
    writedata(0x02); //writedata(0x02);
    writedata(0x10); //writedata(0x0E);
    writecommand(ST7735_GMCTRN1);
    writedata(0x0f); //writedata(0x0B);
    writedata(0x1b); //writedata(0x14);
    writedata(0x0f); //writedata(0x08);
    writedata(0x17); //writedata(0x1E);
    writedata(0x33); //writedata(0x22);
    writedata(0x2c); //writedata(0x1D);
    writedata(0x29); //writedata(0x18);
    writedata(0x2e); //writedata(0x1E);
    writedata(0x30); //writedata(0x1B);
    writedata(0x30); //writedata(0x1A);
    writedata(0x39); //writedata(0x24);
    writedata(0x3f); //writedata(0x2B);
    writedata(0x00); //writedata(0x06);
    writedata(0x07); //writedata(0x06);
    writedata(0x03); //writedata(0x02);
    writedata(0x10); //writedata(0x0F);

    /*
    TFT_WriteCommand(0xE0);
    TFT_WriteParameter(0x000F); //positive gamma correction
    TFT_WriteParameter(0x0031);
    TFT_WriteParameter(0x002B);
    TFT_WriteParameter(0x000C);
    TFT_WriteParameter(0x000E);
    TFT_WriteParameter(0x0008);
    TFT_WriteParameter(0x004E);
    TFT_WriteParameter(0x00F1);
    TFT_WriteParameter(0x0037);
    TFT_WriteParameter(0x0007);
    TFT_WriteParameter(0x0010);
    TFT_WriteParameter(0x0003);
    TFT_WriteParameter(0x000E);
    TFT_WriteParameter(0x0009);
    TFT_WriteParameter(0x0000);
    TFT_WriteCommand(0x00E1);
    TFT_WriteParameter(0x0000); //negative gamma correction
    TFT_WriteParameter(0x000E);
    TFT_WriteParameter(0x0014);
    TFT_WriteParameter(0x0003);
    TFT_WriteParameter(0x0011);
    TFT_WriteParameter(0x0007);
    TFT_WriteParameter(0x0031);
    TFT_WriteParameter(0x00C1);
    TFT_WriteParameter(0x0048);
    TFT_WriteParameter(0x0008);
    TFT_WriteParameter(0x000F);
    TFT_WriteParameter(0x000C);
    TFT_WriteParameter(0x0031);
    TFT_WriteParameter(0x0036);
    TFT_WriteParameter(0x000F);
    */
    TFT_WriteCommand(0xB1);
    TFT_WriteParameter(0x0000);
    TFT_WriteParameter(0x0010);
    writecommand(ST7735_CASET); // column addr set
    writedata(0x00);
    writedata(0x00); // XSTART = 0
    writedata(0x01);
    writedata(0x3F); // XEND = 127
    writecommand(ST7735_RASET); // row addr set
    writedata(0x00);
    writedata(0x00); // XSTART = 0
    writedata(0x00);
    writedata(0xEF); // XEND = 159
    writecommand(ST7735_SLPOUT);
    writecommand(ST7735_DISPON);
    Delay_us(100);
    writecommand(ST7735_NORON); // normal display on
    Delay_us(10);
    LCD_CS = 1;
    }
     
    void setAddrWindow(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1)
    {
    writecommand(ST7735_CASET); // column addr set
    writedata(0x00);
    writedata(x0+0); // XSTART
    writedata(0x00);
    writedata(x1+0); // XEND
    writecommand(ST7735_RASET); // row addr set
    writedata(0x00);
    writedata(y0+0); // YSTART
    writedata(0x00);
    writedata(y1+0); // YEND
    writecommand(ST7735_RAMWR); // write to RAM
    }

    post edited by kontrol - 2019/04/10 04:16:36
    #3
    pcbbc
    Super Member
    • Total Posts : 926
    • Reward points : 0
    • Joined: 2014/03/27 07:04:41
    • Location: 0
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/10 04:03:08 (permalink)
    0
    TIP: Please place your code in code tags [CODE]//place code here[/CODE] (the words "code" should be in lowercase) so we can read it.
     
    Also there are large numbers of commands with no comments as to what they do?  A lot of work for us to hunt through the datasheet and work out what is wrong.  A link to the datasheet you are using wouldn't be a bad idea either.
    #4
    kontrol
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/09/25 00:59:15
    • Location: 0
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/10 04:28:24 (permalink)
    0
     
    In fact all my purpose is to run with microchip series controllers on the screen, which works with arduino codes. and I used the sample codes on the following pages when compiling these codes. of course I can't get full efficiency with these.best regards.
    http://www.toughdev.com/content/2013/11/experimenting-with-st7735-1-8-inch-128x160-color-lcd-on-a-pic-microcontroller/
     
    https://gist.github.com/postmodern/ed6e670999f456ad9f13
    #5
    jack@kksound
    code tags!
    • Total Posts : 3183
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/10 07:56:25 (permalink)
    0
    Your screen dimension set commands have the wrong (too small) numbers for the size of screen you have.
    #6
    kontrol
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/09/25 00:59:15
    • Location: 0
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/10 08:40:06 (permalink)
    0
    writedata(0xEF); // XEND = 159
    I think I had to write '13f' instead of 'ef'. I think it's wrong.
    Well, the display was working very slowly in some init functions. what could be the reason.
    post edited by kontrol - 2019/04/10 08:43:10
    #7
    pcbbc
    Super Member
    • Total Posts : 926
    • Reward points : 0
    • Joined: 2014/03/27 07:04:41
    • Location: 0
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/10 09:28:05 (permalink)
    +1 (1)
    kontrolWell, the display was working very slowly in some init functions. What could be the reason?

    As you only provide part of your code, and none of your configuration settings, we can't say.
    Perhaps you only run your PIC at 1kHz?
    Perhaps you have a Delay_us(1000); in every writecommand or writedata?
    Perhaps you have the display configured in SPI mode and a very slow SPI clock rate?
    Perhaps you have _XTAL_FREQ set incorrectly?
    Perhaps the answer is 42?
    #8
    kontrol
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/09/25 00:59:15
    • Location: 0
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/11 05:30:08 (permalink)
    0
    Thank you for your interest. I'll start again with your solution suggestions in mind. Best regards.
    #9
    kontrol
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/09/25 00:59:15
    • Location: 0
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/19 03:41:12 (permalink)
    0
     
     
     
    hi, thank you for your interest in the page about ili9341. Thanks to you, I solved a big problem., but now there's another problem. In the photo there is ili9341 tft running full screen. however, some images at the bottom of the screen are repeated at the top of the screen. Why do your think it might be. I am sending init function if your want to help.

    void init_display(){ 
    TRIS_CS = 0; TRIS_DC = 0; TRIS_RES = 0;
    TFT_CS = 1; TFT_DC = 0; TFT_RES = 0;
    TFT_Reset();
    TFT_WriteCommand(0x28); //DISPLAY OFF
    TFT_WriteCommand(0x11); //EXIT SLEEP MODE 
    TFT_WriteParameter(0x0000);

    TFT_WriteCommand(0xCB); 
    TFT_WriteParameter(0x0039); 
    TFT_WriteParameter(0x002c); 
    TFT_WriteParameter(0x0000); 
    TFT_WriteParameter(0x0034); //VCORE = 1.6V 
    TFT_WriteParameter(0x0002); //DDVDH = 5.6V


    TFT_WriteCommand(0xCF); 
    TFT_WriteParameter(0x0000); 
    TFT_WriteParameter(0x00C1); 
    TFT_WriteParameter(0x0030); 
    writecommand(ST7735_PWCTR1); // power control
    //writedata(0xA2); 
    //writedata(0x02); // -4.6V
    writedata(0x84); // AUTO mode
    TFT_WriteCommand(0xE8); 
    TFT_WriteParameter(0x0085); 
    TFT_WriteParameter(0x0000); 
    TFT_WriteParameter(0x0078);

    TFT_WriteCommand(0xEA); 
    TFT_WriteParameter(0x0000); 
    TFT_WriteParameter(0x0000);
    TFT_WriteCommand(0xED); 
    TFT_WriteParameter(0x0064); 
    TFT_WriteParameter(0x0003); 
    TFT_WriteParameter(0x0012); 
    TFT_WriteParameter(0x0081);
    TFT_WriteCommand(0xF7); 
    TFT_WriteParameter(0x0020);
    TFT_WriteCommand(0xC0); 
    //TFT_WriteParameter(0x0026); 
    writedata(0x23); //A2 
    //writedata(0x02); // -4.6V
    // writedata(0x84); // AUTO mode

    TFT_WriteCommand(0xC1); 
    TFT_WriteParameter(0x0010);
    TFT_WriteCommand(0xC5); 
    TFT_WriteParameter(0x003E); 
    TFT_WriteParameter(0x0028);
    TFT_WriteCommand(0xC7); 
    TFT_WriteParameter(0x0086);
    TFT_WriteCommand(0x36); 
    TFT_WriteParameter(0x0048);

    TFT_WriteCommand(0x3A); 
    TFT_WriteParameter(0x0055);

    TFT_WriteCommand(0xB6); 
    TFT_WriteParameter(0x0008); 
    TFT_WriteParameter(0x0082); 
    TFT_WriteParameter(0x0027);
    TFT_WriteCommand(0xF2); 
    TFT_WriteParameter(0x0000); 

    TFT_WriteCommand(0x26); 
    TFT_WriteParameter(0x01); 

    writecommand(ST7735_GMCTRP1);
    writedata(0x0f);
    writedata(0x1a);
    writedata(0x0f);
    writedata(0x18);
    writedata(0x2f);
    writedata(0x28);
    writedata(0x20);
    writedata(0x22);
    writedata(0x1f);
    writedata(0x1b);
    writedata(0x23);
    writedata(0x37);
    writedata(0x00);
    writedata(0x07);
    writedata(0x02);
    writedata(0x10);
    writecommand(ST7735_GMCTRN1);
    writedata(0x0f); 
    writedata(0x1b); 
    writedata(0x0f); 
    writedata(0x17); 
    writedata(0x33); 
    writedata(0x2c); 
    writedata(0x29); 
    writedata(0x2e); 
    writedata(0x30); 
    writedata(0x30); 
    writedata(0x39); 
    writedata(0x3f); 
    writedata(0x00); 
    writedata(0x07); 
    writedata(0x03); 
    writedata(0x10); 
    TFT_WriteCommand(0xB1); 
    TFT_WriteParameter(0x0000); 
    TFT_WriteParameter(0x0010);
    writecommand(ST7735_CASET); // column addr set
    writedata(0x00);
    writedata(0x00); // XSTART = 0
    writedata(0x01);
    writedata(0xF0); //  
    writecommand(ST7735_RASET); // row addr set
    writedata(0x00);
    writedata(0x00); // XSTART = 0
    writedata(0x00);
    writedata(0x140); //  
    writecommand(ST7735_SLPOUT);
    writecommand(ST7735_DISPON);
    Delay_us(100);
    writecommand(ST7735_NORON); // normal display on
    Delay_us(10);
    LCD_CS = 1;
    }

    #10
    kontrol
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/09/25 00:59:15
    • Location: 0
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/19 03:43:20 (permalink)
    #11
    Mysil
    Super Member
    • Total Posts : 3322
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/19 05:49:42 (permalink)
    0
    Hi,
    It may seem, the first time, there was some screen dimension set too small,
    now later, there is some screen dimension set too large.
    A display controlled by ILI9341 typically have 240 pixels in one direction, and 320 pixels in the other direction.
    That is 0x00 to 0xEF in one direction, and 0x00 to 0x13F in the other direction.
    During transfer of control register address and parameters, each byte is transferred separately, so 0x13F must be transferred as 0x01, and then 0x3F.
    It is only during transfer of Display data, that 16 bit transfer is done, and that only when 16 bit parallel interface is used.
     
    Which dimension is width, and which direction is hight, is a matter of interpretation, and may be changed by control settings.
    Also, which direction is left, right, up and down may be changed by control settings.
     
    It may seem code have been put together from different sources, that may not nessesarily fit together.
    What have: ST7735_PWCTR1   have to do with code for:  ILI9341 ? 
    Rather than putting together pieces at random,
    maybe you should compare each command in the code, with ILI9341 datasheet, to understand what it is supposed to do?
    Then change those settings that are not valid for ILI9341, into comments.
    If there are constant macros that are valid for ILI9341, then they should have ILI9341 names.
     
    When writiting blocks of pixels into display memory, then you should take care to not write outside the screen,
    since it may show up on the other side of the screen.
     
    As any other (two dimensional) array, display memory in the controller is a continous sequence of memory words,
    so if you write outside of one dimension, it will show up somewhere it should not be.
     
        Mysil
     
    #12
    kontrol
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/09/25 00:59:15
    • Location: 0
    • Status: offline
    Re: ili9341 Full Screen Error 2019/04/19 21:31:27 (permalink)
    0
    Thanks a lot Mysil. I will correct the resolution again. I guess it's repeated because I'm printing too much on the screen.best regards.
    #13
    Jump to:
    © 2019 APG vNext Commercial Version 4.5