logo elektroda
logo elektroda
X
logo elektroda

White screen on the 3.2 "TFT display ILI9341 for Arduino

daadane 10194 18
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 16436386
    daadane
    Level 9  
    Hello, I have a problem with the 3.2 "LCD display 320x240 TFT_320QVT_9341 with a touch panel. Today I received a package with a display and a TFT LCD shield MEGA SHIELD V2.2. The case is very simple because I downloaded the library supporting the display (UTFT) and touch (URTouch), but it turned out a bit wrong. After putting the Arduino Mega2560 on the system and uploading any example from the UTFT library, the display shows a white background and light up pale. There is no reaction on its part. When initializing the display, the function requires entering 5 parameters, Model, RS, WR, CS, RST. The last four are only the pin numbers on the Arduino that will communicate with the display. I prefer not to dwell on this because I came to the general conclusion that I have the pin numbers according to the library's recommendations all the fun and the problem begins when giving the model. As I wrote before it is ILI9431 and its support is confirmed by the code library em in the UTFT.cpp and UTFT.h files. After providing all parameters, which theoretically are all needed to run, the screen on the display is still unchanged - a pale white background. I have probably tried everything, including the fact that I changed models from the whole ILI family. I don't remember exactly where the screen started flashing black - his only reaction today. I sit on it for 5 hours and I am running out of ideas. If anyone made any layouts with this set, please help. PS The touch works without any complaints. Very rarely only the position x = -1 y = -1 crashes. However, if you turn a blind eye and look at the price and quality, the touch works sensational in my opinion. Only this display ....... I am asking for help.
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • #2 16436396
    Anonymous
    Anonymous  
  • ADVERTISEMENT
  • #3 16436418
    daadane
    Level 9  
    I understand this is an idea. I don't understand just one. The UTFT library supports this display and despite so many attempts and searching for information on the internet, it failed to wake up. I have downloaded a very nice project based on this library and I really want it to work on it.
  • #4 16437167
    tzok
    Moderator of Cars
    I would start by checking if the default TFT pin numbers correspond to those on the flag. Especially since Mega2560 probably has SPI pins elsewhere than UNO.
  • #5 16437199
    daadane
    Level 9  
    The shield itself is made just to connect exactly this display to the arduino mega 2560: /

    
    // UTFT_Demo_320x240 
    // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
    // web: http://www.RinkyDinkElectronics.com/
    //
    // This program is a demo of how to use most of the functions
    // of the library with a supported display modules.
    //
    // This demo was made for modules with a screen resolution 
    // of 320x240 pixels.
    //
    // This program requires the UTFT library.
    //
    
    #include 
    
    // Declare which fonts we will be using
    extern uint8_t SmallFont[];
    
    // Set the pins to the correct ones for your development shield
    // ------------------------------------------------------------
    // Standard Arduino Mega/Due shield            : ,38,39,40,41
    // CTE TFT LCD/SD Shield for Arduino Due       : ,25,26,27,28
    // Teensy 3.x TFT Test Board                   : ,23,22, 3, 4
    // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33
    


    Here are the comments from the beginning of the example from the UTFT library. When connecting the Arduino Mega and Shielda to the display, the pins should be: , 38,39,40,41.
  • #7 16437247
    daadane
    Level 9  
    Thank you for your help. Something with this display, however, is wrong ... I checked the pins, ok adasikp - I was, read, downloaded modified library and nothing! Pale display all the time ...
  • #8 16437249
    Anonymous
    Anonymous  
  • ADVERTISEMENT
  • #9 16437253
    daadane
    Level 9  
    Pffff ... how to say it. I will say so, I'm sorry that someone like you speaks on this topic. As the only person you have not contributed to this topic. By people like you I realize that it's not worth ... You know, I came here in the forum because I needed quick help, I just had an idea and I wanted to implement it quickly. Look at the statements of others above, can you? Well, I don't ... I have knowledge or an idea, say something that will lead me to solve the problem.


    Moderated By dondu:

    When asking a forum you should be aware of several things:

    - by the form of the query, experienced users recognize the level of sophistication of the questioner and provide appropriate answers

    - if they state that the problem is a lack of grounds, they will inevitably indicate it, because there is nothing worse than to discourage the asking person from a too complicated project,

    - show materials for analysis that your colleague did not attach.

  • #10 16437254
    Anonymous
    Anonymous  
  • #11 16438311
    daadane
    Level 9  
    Okay, maybe I have misrepresented my problem. I have been creating projects for Arduino for 3 years (true - I copy some of the interesting ones found). I am neither an electronics engineer nor a programmer. I bought the display I wrote about earlier (TFT 3.2 "with touch panel on the ILI9341 chip). As I mentioned earlier, I additionally bought a shield dedicated for the display - for convenience because I do not need any additional logic converters or even cables. Shield is prepared for connecting under the Arduino Mega 2560 board. The whole after assembly, without downloading the code to operate the display activates the backlight under the display which gives the impression of a white pale background. Searching for information about the LCD and the system that is to handle it, I came to the UTFT and URTouch library - for touch The library documentation confirmed the information found (the layout from my display is on the list of supported controllers) The case looks trivial I put the code as an example from the "touch calibration" demo from the URTouch library:
    [syntax=c]
    // URTouch_Calibration
    // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
    // web: http://www.RinkyDinkElectronics.com/
    //
    // This program can be used to calibrate the touchscreen
    // of the display modules.
    // This program requires the UTFT library and a touch
    // screen module that is compatible with UTFT.
    //
    // It is assumed that the display module is connected to an
    // appropriate shield or that you know how to change the pin
    // numbers in the setup.
    //
    // Instructions will be given on the display.
    //

    #include
    #include

    // Define the orientation of the touch screen. Further
    // information can be found in the instructions.
    #define TOUCH_ORIENTATION PORTRAIT

    // Initialize display
    // ------------------
    // Set the pins to the correct ones for your development board
    // -----------------------------------------------------------
    // Standard Arduino Uno/2009 Shield : ,19,18,17,16
    // Standard Arduino Mega/Due shield : ,38,39,40,41
    // CTE TFT LCD/SD Shield for Arduino Due : ,25,26,27,28
    // Teensy 3.x TFT Test Board : ,23,22, 3, 4
    // ElecHouse TFT LCD/SD Shield for Arduino Due : ,22,23,31,33
    //
    // Remember to change the model parameter to suit your display module!
    UTFT myGLCD(ITDB32S,38,39,40,41);

    // Initialize touchscreen
    // ----------------------
    // Set the pins to the correct ones for your development board
    // -----------------------------------------------------------
    // Standard Arduino Uno/2009 Shield : 15,10,14, 9, 8
    // Standard Arduino Mega/Due shield : 6, 5, 4, 3, 2
    // CTE TFT LCD/SD Shield for Arduino Due : 6, 5, 4, 3, 2
    // Teensy 3.x TFT Test Board : 26,31,27,28,29
    // ElecHouse TFT LCD/SD Shield for Arduino Due : 25,26,27,29,30
    //
    URTouch myTouch( 6, 5, 4, 3, 2);

    // ************************************
    // DO NOT EDIT ANYTHING BELOW THIS LINE
    // ************************************

    // Declare which fonts we will be using
    extern uint8_t SmallFont[];

    uint32_t cx, cy;
    uint32_t rx[8], ry[8];
    uint32_t clx, crx, cty, cby;
    float px, py;
    int dispx, dispy, text_y_center;
    uint32_t calx, caly, cals;
    char buf[13];

    void setup()
    {
    myGLCD.InitLCD();
    myGLCD.clrScr();
    myGLCD.setFont(SmallFont);

    myTouch.InitTouch(TOUCH_ORIENTATION);
    dispx=myGLCD.getDisplayXSize();
    dispy=myGLCD.getDisplayYSize();
    text_y_center=(dispy/2)-6;
    }

    void drawCrossHair(int x, int y)
    {
    myGLCD.drawRect(x-10, y-10, x+10, y+10);
    myGLCD.drawLine(x-5, y, x+5, y);
    myGLCD.drawLine(x, y-5, x, y+5);
    }

    void readCoordinates()
    {
    int iter = 5000;
    int failcount = 0;
    int cnt = 0;
    uint32_t tx=0;
    uint32_t ty=0;
    boolean OK = false;

    while (OK == false)
    {
    myGLCD.setColor(255, 255, 255);
    myGLCD.print("* PRESS *", CENTER, text_y_center);
    while (myTouch.dataAvailable() == false) {}
    myGLCD.print("* HOLD! *", CENTER, text_y_center);
    while ((myTouch.dataAvailable() == true) && (cnt=10000)
    fail();
    }

    cx = tx / iter;
    cy = ty / iter;
    }

    void calibrate(int x, int y, int i)
    {
    myGLCD.setColor(255, 255, 255);
    drawCrossHair(x,y);
    myGLCD.setBackColor(255, 0, 0);
    readCoordinates();
    myGLCD.setColor(255, 255, 255);
    myGLCD.print("* RELEASE *", CENTER, text_y_center);
    myGLCD.setColor(80, 80, 80);
    drawCrossHair(x,y);
    rx[i]=cx;
    ry[i]=cy;
    while (myTouch.dataAvailable() == true) {}
    }

    void waitForTouch()
    {
    while (myTouch.dataAvailable() == true) {}
    while (myTouch.dataAvailable() == false) {}
    while (myTouch.dataAvailable() == true) {}
    }

    void toHex(uint32_t num)
    {
    buf[0] = '0';
    buf[1] = 'x';
    buf[10] = 'U';
    buf[11] = 'L';
    buf[12] = 0;
    for (int zz=9; zz>1; zz--)
    {
    if ((num & 0xF) > 9)
    buf[zz] = (num & 0xF) + 55;
    else
    buf[zz] = (num & 0xF) + 48;
    num=num>>4;
    }
    }

    void startup()
    {
    myGLCD.setColor(255, 0, 0);
    myGLCD.fillRect(0, 0, dispx-1, 13);
    myGLCD.setColor(255, 255, 255);
    myGLCD.setBackColor(255, 0, 0);
    myGLCD.drawLine(0, 14, dispx-1, 14);
    myGLCD.print("URTouch Calibration", CENTER, 1);
    myGLCD.setBackColor(0, 0, 0);

    if (dispx==220)
    {
    myGLCD.print("Use a stylus or something", LEFT, 30);
    myGLCD.print("similar to touch as close", LEFT, 42);
    myGLCD.print("to the center of the", LEFT, 54);
    myGLCD.print("highlighted crosshair as", LEFT, 66);
    myGLCD.print("possible. Keep as still as", LEFT, 78);
    myGLCD.print("possible and keep holding", LEFT, 90);
    myGLCD.print("until the highlight is", LEFT, 102);
    myGLCD.print("removed. Repeat for all", LEFT, 114);
    myGLCD.print("crosshairs in sequence.", LEFT, 126);
    myGLCD.print("Touch screen to continue", CENTER, 162);
    }
    else
    {
    myGLCD.print("INSTRUCTIONS", CENTER, 30);
    myGLCD.print("Use a stylus or something similar to", LEFT, 50);
    myGLCD.print("touch as close to the center of the", LEFT, 62);
    myGLCD.print("highlighted crosshair as possible. Keep", LEFT, 74);
    myGLCD.print("as still as possible and keep holding", LEFT, 86);
    myGLCD.print("until the highlight is removed. Repeat", LEFT, 98);
    myGLCD.print("for all crosshairs in sequence.", LEFT, 110);

    myGLCD.print("Further instructions will be displayed", LEFT, 134);
    myGLCD.print("when the calibration is complete.", LEFT, 146);

    myGLCD.print("Do NOT use your finger as a calibration", LEFT, 170);
    myGLCD.print("stylus or the result WILL BE imprecise.", LEFT, 182);

    myGLCD.print("Touch screen to continue", CENTER, 226);
    }

    waitForTouch();
    myGLCD.clrScr();
    }

    void done()
    {
    myGLCD.clrScr();
    myGLCD.setColor(255, 0, 0);
    myGLCD.fillRect(0, 0, dispx-1, 13);
    myGLCD.setColor(255, 255, 255);
    myGLCD.setBackColor(255, 0, 0);
    myGLCD.drawLine(0, 14, dispx-1, 14);
    myGLCD.print("URTouch Calibration", CENTER, 1);
    myGLCD.setBackColor(0, 0, 0);

    if (dispx==220)
    {
    myGLCD.print("To use the new calibration", LEFT, 30);
    myGLCD.print("settings you must edit the", LEFT, 42);
    myGLCD.setColor(160, 160, 255);
    myGLCD.print("URTouchCD.h", LEFT, 54);
    myGLCD.setColor(255, 255, 255);
    myGLCD.print("file and change", 88, 54);
    myGLCD.print("the following values. The", LEFT, 66);
    myGLCD.print("values are located right", LEFT, 78);
    myGLCD.print("below the opening comment.", LEFT, 90);
    myGLCD.print("CAL_X", LEFT, 110);
    myGLCD.print("CAL_Y", LEFT, 122);
    myGLCD.print("CAL_S", LEFT, 134);
    toHex(calx);
    myGLCD.print(buf, 75, 110);
    toHex(caly);
    myGLCD.print(buf, 75, 122);
    toHex(cals);
    myGLCD.print(buf, 75, 134);
    }
    else
    {
    myGLCD.print("CALIBRATION COMPLETE", CENTER, 30);
    myGLCD.print("To use the new calibration", LEFT, 50);
    myGLCD.print("settings you must edit the", LEFT, 62);
    myGLCD.setColor(160, 160, 255);
    myGLCD.print("URTouchCD.h", LEFT, 74);
    myGLCD.setColor(255, 255, 255);
    myGLCD.print("file and change", 88, 74);
    myGLCD.print("the following values.", LEFT, 86);
    myGLCD.print("The values are located right", LEFT, 98);
    myGLCD.print("below the opening comment in", LEFT, 110);
    myGLCD.print("the file.", LEFT, 122);
    myGLCD.print("CAL_X", LEFT, 150);
    myGLCD.print("CAL_Y", LEFT, 162);
    myGLCD.print("CAL_S", LEFT, 174);

    toHex(calx);
    myGLCD.print(buf, 75, 150);
    toHex(caly);
    myGLCD.print(buf, 75, 162);
    toHex(cals);
    myGLCD.print(buf, 75, 174);
    }

    }

    void fail()
    {
    myGLCD.clrScr();
    myGLCD.setColor(255, 0, 0);
    myGLCD.fillRect(0, 0, dispx-1, 13);
    myGLCD.setColor(255, 255, 255);
    myGLCD.setBackColor(255, 0, 0);
    myGLCD.drawLine(0, 14, dispx-1, 14);
    myGLCD.print("URTouch Calibration FAILED", CENTER, 1);
    myGLCD.setBackColor(0, 0, 0);

    myGLCD.print("Unable to read the position", LEFT, 30);
    myGLCD.print("of the press. This is a", LEFT, 42);
    myGLCD.print("hardware issue and can", 88, 54);
    myGLCD.print("not be corrected in", LEFT, 66);
    myGLCD.print("software.", LEFT, 78);

    while(true) {};
    }

    void loop()
    {
    startup();

    myGLCD.setColor(80, 80, 80);
    drawCrossHair(dispx-11, 10);
    drawCrossHair(dispx/2, 10);
    drawCrossHair(10, 10);
    drawCrossHair(dispx-11, dispy/2);
    drawCrossHair(10, dispy/2);
    drawCrossHair(dispx-11, dispy-11);
    drawCrossHair(dispx/2, dispy-11);
    drawCrossHair(10, dispy-11);
    myGLCD.setColor(255, 255, 255);
    myGLCD.setBackColor(255, 0, 0);
    myGLCD.print("***********", CENTER, text_y_center-12);
    myGLCD.print("***********", CENTER, text_y_center+12);

    calibrate(10, 10, 0);
    calibrate(10, dispy/2, 1);
    calibrate(10, dispy-11, 2);
    calibrate(dispx/2, 10, 3);
    calibrate(dispx/2, dispy-11, 4);
    calibrate(dispx-11, 10, 5);
    calibrate(dispx-11, dispy/2, 6);
    calibrate(dispx-11, dispy-11, 7);

    if (TOUCH_ORIENTATION == LANDSCAPE)
    cals=(long(dispx-1)
  • #12 16438386
    tzok
    Moderator of Cars
    Do you have a 5V to 3.3V converter? Try connecting the display without a shield. A white screen means that the display is not working at all. You do not have to connect the touch, only the SPI interface of the display, the reset can be permanently up to 3.3V, if the display is the only device on the SPI then the CS can also be permanently active.

    http://adatum.ru/podklyuchenie-displeya-240x320-2-2-tft-spi-ili9340-k-arduino-mega-2560.html
    http://www.jarzebski.pl/arduino/komponenty/wyswietlacz-tft-2-2-spi-ili9341.html
  • ADVERTISEMENT
  • #13 16438404
    daadane
    Level 9  
    No. Unfortunately I don't have a converter. I will probably have to buy to diagnose whether the display itself works. I am a bit afraid to ask if the properly selected resistors can replace the converter for the time of diagnosis?
  • Helpful post
    #14 16438417
    tzok
    Moderator of Cars
    This is not a 100% secure solution but many descriptions suggest it, so you can conclude that it works.
  • #15 16438432
    Anonymous
    Anonymous  
  • #16 16440488
    pyton
    Level 21  
    Hello

    I don't know if it will help ... My TFT purchased from the Chinese was also to be ILI9341 but it turned out differently ... With the help of the future library: SPFD5408

    One more hint:

    In the examples of this library (SPFD5408) you have: "SPFD5408_tftbmp"

    Where does the function describe how to check what chip you actually have.

    greetings
  • #18 16481863
    andy014
    Level 13  
    Hello, what voltage do you supply the display with, from two purchased units none of them started with 5v (despite the Chinese wrote that 3.3 / 5v power supply), white screen, 3.3v power supply from pina arduino helped http: //sp7pki.iq24 .com / podglad_posta.asp? id_komentarza = 2407441
  • #19 16482159
    daadane
    Level 9  
    For me, the problem with the white display continued until I connected it through a logic level converter. It turned out that the soft on the Arduino to operate the display was good and calmly would have handled it were it not for the defective shield, which was sending the signal from one input (on the shield) to several outputs (from the shield). On the converter or the newly purchased shieldzie it is nice :) but what I experienced with him was mine, just like everything I learned about him and his controls :) in any case, thanks to everyone who participated in the discussion and helped revive the "pale" corpse :)

Topic summary

The discussion revolves around troubleshooting a 3.2" TFT display (model ILI9341) connected to an Arduino Mega 2560, which is showing a persistent white screen. The user has attempted to use the UTFT and URTouch libraries but has encountered issues with display initialization. Suggestions include verifying pin connections, checking voltage levels (noting that the display may require 3.3V instead of 5V), and using a logic level converter for proper communication. Some users recommend consulting the display's datasheet and exploring alternative libraries if the display is not functioning as expected. Ultimately, the user resolved the issue by using a logic level converter, indicating that the original shield was defective.
Summary generated by the language model.
ADVERTISEMENT