Author Topic: Vertical colored lines  (Read 3969 times)

erps

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Vertical colored lines
« on: December 04, 2014, 12:44:02 PM »
Hi:

As a general question, what would be the reason to get vertical colored lines on a display? (see attached)
I am using NHD-5.7-320240WFB-ETXI #-T-1 with SSD1963 controller board.
Display is connected to the STM3221G-EVAL board from ST, FSMC 16-bit interface. I checked the connections and everything looks ok.

Thanks,

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: Vertical colored lines
« Reply #1 on: December 04, 2014, 03:28:02 PM »
Other than electrical issues, I'd say it is a result of improper initialization.  I've responded to your previous post with some example code; I've also included it below:

Code: [Select]
//---------------------------------------------------------
/*
NHD_5_7_320240WFB_mega.ino
Program for writing to Newhaven Display 5.7 TFT with NHD-5.7-320240WFB-20 Controller Board (SSD1963, 8-bit)

(c)2013 Michael LaVine - Newhaven Display International, Inc.

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
*/
//---------------------------------------------------------

// The 8 bit data bus is connected to PORTA of the Arduino Mega2560
// 5V voltage regulator on Arduino Mega has been replaced with a 3.3V regulator to provide 3.3V logic

int RS  = 30;    // RS signal connected to Arduino digital pin 30
int WR  = 31;    // /WR signal connected to Arduino digital pin 31
int RD  = 32;    // /RD signal connected to Arduino digital pin 32
int RES = 33;    // /RES signal connected to Arduino digital pin 33

// /CS signal tied to GND

//;******************************************************************************
void TFT_Write_Command(unsigned char command)
{
  digitalWrite(RS, LOW);
  PORTA = command;
  digitalWrite(WR, LOW);
  digitalWrite(WR, HIGH);
}
//;******************************************************************************
void TFT_Write_Data(unsigned char data)
{
  //digitalWrite(RS, HIGH);
  PORTA = data;
  digitalWrite(WR, LOW);
  digitalWrite(WR, HIGH);
}
//====================================================
void TFT_Command_Write(unsigned char REG,unsigned char VALUE)
{
        TFT_Write_Command(REG);
        digitalWrite(RS, HIGH);
        TFT_Write_Data(VALUE);
}
//======================================================
void WindowSet(unsigned int s_x,unsigned int e_x,unsigned int s_y,unsigned int e_y)
{
TFT_Write_Command(0x2a); //SET column address
digitalWrite(RS, HIGH);
TFT_Write_Data((s_x)>>8); //SET start column address
TFT_Write_Data(s_x);
TFT_Write_Data((e_x)>>8); //SET end column address
TFT_Write_Data(e_x);

TFT_Write_Command(0x2b); //SET page address
digitalWrite(RS, HIGH);
TFT_Write_Data((s_y)>>8); //SET start page address
TFT_Write_Data(s_y);
TFT_Write_Data((e_y)>>8); //SET end page address
TFT_Write_Data(e_y);
}
void disp()
{
unsigned int i, j;
        WindowSet(0,319,0,239);               //set start/end column/page address (full screen)
TFT_Write_Command(0x2C);              //command to begin writing to frame memory
        digitalWrite(RS, HIGH);
for(i=0;i<240;i++)         //fill screen with blue pixels
{
    for(j=0;j<320;j++)
            {
              TFT_Write_Data(0xFF);
              TFT_Write_Data(0x00);
              TFT_Write_Data(0x00);
            }
}
        WindowSet(0,319,0,239);               //set start/end column/page address (full screen)
TFT_Write_Command(0x2C);              //command to begin writing to frame memory
        digitalWrite(RS, HIGH);
        for(i=0;i<240;i++)         //fill screen with green pixels
{
    for(j=0;j<320;j++)
            {
              TFT_Write_Data(0x00);
              TFT_Write_Data(0xFF);
              TFT_Write_Data(0x00);
            }
}
        WindowSet(0,319,0,239);               //set start/end column/page address (full screen)
TFT_Write_Command(0x2C);              //command to begin writing to frame memory
        digitalWrite(RS, HIGH);
        for(i=0;i<240;i++)         //fill screen with red pixels
{
    for(j=0;j<320;j++)
            {
              TFT_Write_Data(0x00);
              TFT_Write_Data(0x00);
              TFT_Write_Data(0xFF);
            }
}
}
//======================================================
void setup()
{
  DDRA = 0xFF;
  PORTA = 0x00;
  DDRC = 0xFF;
  PORTC = 0x00;
  digitalWrite(RD, HIGH);
  digitalWrite(WR, LOW);
  digitalWrite(RES, LOW);
  delay(120);
  digitalWrite(RES, HIGH);
  delay(120);
  TFT_Write_Command(0x01);         //Software reset
  delay(120);
  TFT_Write_Command(0xe2);         //set multiplier and divider of PLL
  digitalWrite(RS, HIGH);
  TFT_Write_Data(0x1d);
  TFT_Write_Data(0x02);
  TFT_Write_Data(0x04);
  TFT_Command_Write(0xe0,0x01);    //Enable PLL
  delay(1);
  TFT_Command_Write(0xe0,0x03);    //Lock PLL
  TFT_Write_Command(0x01);         //Software reset
  delay(120);
  TFT_Write_Command(0xb0); //SET LCD MODE  SET TFT 18Bits MODE
  digitalWrite(RS, HIGH);
  TFT_Write_Data(0x0c); //SET TFT MODE & hsync+Vsync+DEN MODE
  TFT_Write_Data(0x80); //SET TFT MODE & hsync+Vsync+DEN MODE
  TFT_Write_Data(0x01); //SET horizontal size=320-1 HightByte
  TFT_Write_Data(0x3f);         //SET horizontal size=320-1 LowByte
  TFT_Write_Data(0x00); //SET vertical size=240-1 HightByte
  TFT_Write_Data(0xef); //SET vertical size=240-1 LowByte
  TFT_Write_Data(0x00); //SET even/odd line RGB seq.=RGB
  TFT_Command_Write(0xf0,0x00);         //SET pixel data I/F format=8bit
  TFT_Command_Write(0x36,0x09);         //SET address mode=flip vertical 
  TFT_Write_Command(0xe6);    //SET PCLK freq
  digitalWrite(RS, HIGH);
  TFT_Write_Data(0x00);
  TFT_Write_Data(0xe7);
  TFT_Write_Data(0x4f);
  TFT_Write_Command(0xb4); //SET HBP
  digitalWrite(RS, HIGH);
  TFT_Write_Data(0x01); //SET HSYNC Total=440
  TFT_Write_Data(0xb8);
  TFT_Write_Data(0x00); //SET HBP 68
  TFT_Write_Data(0x44);
  TFT_Write_Data(0x0f);  //SET HSYNC Pulse Width=128=127pixels+1
  TFT_Write_Data(0x00); //SET Hsync pulse start position
  TFT_Write_Data(0x00);
  TFT_Write_Data(0x00); //SET Hsync pulse subpixel start position
  TFT_Write_Command(0xb6); //SET VBP
  digitalWrite(RS, HIGH);
  TFT_Write_Data(0x01); //SET Vsync total
  TFT_Write_Data(0x08);
  TFT_Write_Data(0x00); //SET VBP=19
  TFT_Write_Data(0x13);
  TFT_Write_Data(0x07);  //SET VSYNC Pulse Width= 8=7lines+1
  TFT_Write_Data(0x00); //SET Vsync pulse start position
  TFT_Write_Data(0x00);
  TFT_Write_Command(0x13); //SET display on
  //TFT_Write_Command(0x38); //SET display on
  TFT_Write_Command(0x29); //SET display on
  delay(10);
}

void loop()
{
  disp();
  delay(1000); 
}

You will notice it is for the 8-bit interface, however, the initialization/sequence/timing will be the same because even in 16-bit mode the commands are sent using only 8-bits.

erps

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Re: Vertical colored lines
« Reply #2 on: December 17, 2014, 10:24:56 AM »
Thanks, it works now but still an issue during power on. Sometimes the display doesn't come up after a power cycle. I have to try several times either power cycling it or reset the board, for the display to come alive.
Is there any particular signal sequence during power on we need to consider?
Thanks,

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: Vertical colored lines
« Reply #3 on: December 18, 2014, 09:15:18 AM »
As long as you follow the sequence as provided in the example code it should work every time.  Take special note of the RESET line being toggled in the beginning and also the delays around it (in ms).

rtilson

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
    • View Profile
Re: Vertical colored lines
« Reply #4 on: December 18, 2014, 11:32:07 AM »
How was the issue with the vertical lines resolved?

erps

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Re: Vertical colored lines
« Reply #5 on: December 22, 2014, 09:32:34 AM »
It was an initialization issue. Once the correct initialization code was set on place the display start working.

rtilson

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
    • View Profile
Re: Vertical colored lines
« Reply #6 on: December 22, 2014, 09:55:37 AM »
Awesome, specifically what what the initialization issue. I'm using the FT800 Eve gfx engine to drive my display and I have been able to eliminate the part as the problem. I've reduced the issue down to initialization but I'm not sure what aspect of initialization I have wrong.

 What are the technical details of your initialization issue?

Thanks.

erps

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Re: Vertical colored lines
« Reply #7 on: January 23, 2015, 08:27:17 AM »
Nothing in particular with the initialization code itself but where this code was place. I am using some ST code examples using the STemWin library and I was placing the initialization code in the wrong spot.

 

NHD‐0420DZW‐AB5 Lines

Started by RickJBoard OLEDs

Replies: 1
Views: 2277
Last post January 09, 2015, 04:18:32 PM
by Michael_L
NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines

Started by stylonurusBoard OLEDs

Replies: 5
Views: 5569
Last post June 18, 2014, 10:09:49 AM
by Michael_L
NHD-0420H1Z-FL-GBW-33V3 - 2 Lines Mode Problem

Started by gnyturanBoard Character LCDs

Replies: 6
Views: 3231
Last post October 29, 2015, 01:23:58 PM
by Saurabh_B
NHD-4.3-480800EF-CTXP#-T only shows two lines

Started by pcproaBoard TFTs

Replies: 0
Views: 727
Last post November 30, 2016, 09:37:38 AM
by pcproa
Lines on Brighter Part of Display

Started by us.guptaBoard TFTs

Replies: 0
Views: 666
Last post February 15, 2017, 05:41:16 AM
by us.gupta