Go Down

Topic: MCUFriend 3.5" Touchscreen Intermittent when Turned On  (Read 123 times) previous topic - next topic

gusgaglio

Hello,
Sorry for not providing a better description of issue on subject line.
This is the issue I am experiencing with this screen:
MCUFRIEND 3.5" TFT LCD for arduino mega 2560
working with UTFT driver(s) using either ILI9486 or R61581 all OK.
The issue I have, on initial Power up, the screen may or may NOT display any information.
Remove power, or disconnect once or twice and it comes on in perfect working order!
Also once it is running it will run for many days without any issues.

The sole problem is the initial start up.

I have tried to see anything obvious with the driver(s) initialization code but that in NOT
an area with any knowledge at all, so I dare NOT make any changes.

Any suggestions will be gratefully welcomed.
Attached are pix of module.

david_prentice

It looks like a regular Red Mcufriend Mega Shield with 16-bit parallel interface.
These shields are write-only.   You have no way to read the ID to see what controller is mounted.

The Ilitek ILI9486 and the Renesas R61581 are very different controllers.
Personally,  I would run some diagnostic tests that might determine which controller you have.

Then you can use the appropriate init sequence.

The "user" commands are the same for any MIPI controller.   But the "manufacturer" commands (as used in init sequence) are different for for each model and make.

David.

gusgaglio

Thank you for the response David,
Do you have any suggestions on a diagnostic program I can try?

gusgaglio

Hello David,
Thank you for the reply to my problem, very much appreciated. From what I see in the many many posts you seem to have the "best" and perhaps the most knowledge on the many varieties of displays.

You suggested I would try some diagnostic programs to try and determine what controller it "truly" has.
However, I don't have any ideas on where to start.
Can you guide me in a starting point or direction?
Any help is greatly appreciated.

Gus

david_prentice

An easy test is to XOR bits in the MADCTL register (0x36)

Different controllers implement bit 0 and bit 1 as Vertical and Horizontal Flip.
This shows up quite well.   But there are specific Manufacture registers that behave differently.

Here is a UTFT sketch:

Code: [Select]

#include <UTFT.h>

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

//UTFT myGLCD(model,RS,WR,CS,RST,[ALE]);  //assumes that nRD is tied high
//UTFT myGLCD(ILI9481, 38, 39, 40, 41);
//UTFT myGLCD(ILI9486, 38, 39, 40, 41);
UTFT myGLCD(R61581, 38, 39, 40, 41);

void setup()
{
    myGLCD.InitLCD(PORTRAIT);
    myGLCD.clrScr();
    myGLCD.setFont(BigFont);
}

void WriteCmdParamN(uint16_t cmd, int8_t N, uint8_t *block)
{
    cbi(myGLCD.P_CS, myGLCD.B_CS);
    myGLCD.LCD_Write_COM(cmd);
    while (N-- > 0) {
        myGLCD.LCD_Write_DATA(*block++);
    }
    sbi(myGLCD.P_CS, myGLCD.B_CS);
}

char *msgs[] = {
    "0: Flip Vert",
    "1: Flip Horiz",
    "2: Horiz refresh",
    "3: RGB-BGR order",
    "4: Vert refresh",
    "5: Row Col Xchange",
    "6: Column Order",
    "7: Row Order",
};

void loop()
{
    uint8_t initval = 0x0A;     //what is in your initlcd.h for 0x36

    int w = myGLCD.getDisplayXSize(), h = myGLCD.getDisplayYSize();
    uint8_t i = 0, madctl;
    for (i = 0; i < 8; i++) if (initval & (1 << i)) msgs[i][2] = '!';
    for (i = 0; i < 2; i++) {
        WriteCmdParamN(0x36, 1, &initval);
        myGLCD.clrScr();
        myGLCD.setColor(255, 255, 255);   //WHITE
        myGLCD.setFont(SevenSegNumFont);
        myGLCD.print("4", 0, 0);
        myGLCD.setFont(BigFont);
        myGLCD.print(msgs[i], 0, h / 2);
        delay(2000);
        myGLCD.clrScr();
        madctl = (1 << i) ^ initval;
        WriteCmdParamN(0x36, 1, &madctl);
        myGLCD.setColor(0, 0, 255);
        myGLCD.setFont(SevenSegNumFont);
        myGLCD.print("4", 0, 0);
        myGLCD.setFont(BigFont);
        myGLCD.print(msgs[i], 0, h / 2);
        delay(5000);
    }
}


David.


Go Up