Author Topic: NHD-4.3-480272EF-ASXN# Displayed Skewed  (Read 738 times)

glwarren

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
NHD-4.3-480272EF-ASXN# Displayed Skewed
« on: March 13, 2017, 03:34:07 PM »
Using the display with controller that has SSD1963
Got strange display of  bitmap that is skewed to the right and seems to start pixels about 1/3 way into image but the places beginning at end part of the image. Its like the addressing of the frame memory is being read weird. Anyone ever seen this?
Init and display code below
/*******************************************************************************
* Function Name  : TFT_43M_Init
* Description    : Initializes LCD.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TFT_43M_Init(void)
{
HAL_GPIO_WritePin(GPIOG, CS1, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOG, DISP, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOG, nRD, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOG, RES, GPIO_PIN_RESET);

TFT_delay(1000);
HAL_GPIO_WritePin(GPIOG, RES, GPIO_PIN_SET);
TFT_delay(100);

TFT_43M_Write_Command(0x01);     //Software Reset
TFT_delay(10);

TFT_43M_Write_Command(0x01);     //Software Reset
TFT_delay(10);

TFT_43M_Command_Write(0xe0,0x01);    //START PLL
TFT_43M_Command_Write(0xe0,0x03);    //LOCK PLL
TFT_43M_Write_Command(0xb0);      //SET LCD MODE  SET TFT 18Bits MODE
HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
TFT_43M_Write_Data(0x0c);         //SET TFT MODE - 0x0c
TFT_43M_Write_Data(0x008);         //SET TFT MODE & hsync+Vsync+DEN MODE
TFT_43M_Write_Data(0x01);         //SET horizontal size=480-1 HightByte
TFT_43M_Write_Data(0xdf);          //SET horizontal size=480-1 LowByte
TFT_43M_Write_Data(0x01);         //SET vertical size=272-1 HightByte
TFT_43M_Write_Data(0x0f);         //SET vertical size=272-1 LowByte
TFT_43M_Write_Data(0x00);         //SET even/odd line RGB seq.=RGB
TFT_43M_Command_Write(0xf0,0x00);   //SET pixel data I/F format=8bit
TFT_43M_Command_Write(0x3a,0x06);   // SET R G B format = 6 6 6
TFT_43M_Write_Command(0xe6);         //SET PCLK freq=4.94MHz  ; pixel clock frequency
HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
TFT_43M_Write_Data(0x01);      //02
TFT_43M_Write_Data(0x45);      //ff
TFT_43M_Write_Data(0x47);      //ff
TFT_43M_Write_Command(0xb4);      //SET HBP,
HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
TFT_43M_Write_Data(0x02);         //SET HSYNC Total=600
TFT_43M_Write_Data(0x0d);         
TFT_43M_Write_Data(0x00);         //SET HBP 68
TFT_43M_Write_Data(0x2b);         
TFT_43M_Write_Data(0x28);         //SET VBP 16=15+1
TFT_43M_Write_Data(0x00);         //SET Hsync pulse start position
TFT_43M_Write_Data(0x00);
TFT_43M_Write_Data(0x00);         //SET Hsync pulse subpixel start position
TFT_43M_Write_Command(0xb6);       //SET VBP,
HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
TFT_43M_Write_Data(0x01);         //SET Vsync total=360
TFT_43M_Write_Data(0x1d);
TFT_43M_Write_Data(0x00);         //SET VBP=19
TFT_43M_Write_Data(0x0c);      
TFT_43M_Write_Data(0x09);         //SET Vsync pulse 8=7+1
TFT_43M_Write_Data(0x00);         //SET Vsync pulse start position
TFT_43M_Write_Data(0x00);
TFT_43M_Write_Command(0x2a);      //SET column address
HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
TFT_43M_Write_Data(0x00);         //SET start column address=0
TFT_43M_Write_Data(0x00);
TFT_43M_Write_Data(0x01);         //SET end column address=479
TFT_43M_Write_Data(0xdf);
TFT_43M_Write_Command(0x2b);      //SET page address
HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
TFT_43M_Write_Data(0x00);         //SET start page address=0
TFT_43M_Write_Data(0x00);
TFT_43M_Write_Data(0x01);         //SET end page address=271
TFT_43M_Write_Data(0x0f);
TFT_43M_Write_Command(0x13);      //SET normal mode
TFT_43M_Write_Command(0x38);      //SET normal mode
TFT_43M_Write_Command(0x29);      //SET display on
}

void TFT_43M_Write_Command(unsigned char command)
{
    GPIO_Write(GPIOG, command);//when using 16-bit interface (DB17:10,DB8:1)
    //when using 8-bit interface (DB17:10)//GPIO_ResetBits(GPIOC, CS1);

    HAL_GPIO_WritePin(GPIOG, CS1, GPIO_PIN_RESET);
   
    HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_RESET);

    HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_RESET);

    TFT_delay(1);

    HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_SET);

    TFT_delay(1);
   
    //HAL_GPIO_WritePin(GPIOG, CS1, GPIO_PIN_SET);
}

void TFT_43M_Write_Data(unsigned char data1)
{
    GPIO_Write(GPIOG, data1);
    HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_RESET);
    HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_SET);
}

void TFT_43M_Command_Write(unsigned char REG,unsigned char VALUE)
{
    TFT_43M_Write_Command(REG);
    HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
    TFT_43M_Write_Data(VALUE);
}

void TFT_43M_SendData(unsigned long color)
{
    HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
    GPIO_Write(GPIOG, (color>>16));
    HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_RESET);
    HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_SET);
    GPIO_Write(GPIOG, (color>>8));
    HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_RESET);
    HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_SET);
    GPIO_Write(GPIOG, (color));
    HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_RESET);
    HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_SET);
}

void TFT_43M_WindowSet(unsigned int s_x,unsigned int e_x,unsigned int s_y,unsigned int e_y)
{
TFT_43M_Write_Command(0x2a);              //SET page address
HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
TFT_43M_Write_Data((s_x)>>8);         //SET start page address=0
TFT_43M_Write_Data(s_x);
TFT_43M_Write_Data((e_x)>>8);         //SET end page address=319
TFT_43M_Write_Data(e_x);

TFT_43M_Write_Command(0x2b);              //SET column address
HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
TFT_43M_Write_Data((s_y)>>8);         //SET start column address=0
TFT_43M_Write_Data(s_y);
TFT_43M_Write_Data((e_y)>>8);         //SET end column address=239
TFT_43M_Write_Data(e_y);
}

void TFT_43M_FULL_ON(unsigned long dat)
{
    unsigned long x;
    TFT_43M_WindowSet(0x0000,0x01df,0x0000,0x010f);
    TFT_43M_Write_Command(0x2c);
    for(x=0;x<130560;x++)
    {
   HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
   GPIO_Write(GPIOG, (dat>>16));
   HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_RESET);
        HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_SET);
   GPIO_Write(GPIOG, (dat>>8));
   HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_RESET);
        HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_SET);
   GPIO_Write(GPIOG, (dat));
   HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_RESET);
        HAL_GPIO_WritePin(GPIOG, nWR, GPIO_PIN_SET);
    }
}

/*******************************************************************************
* Function Name  : GPIO_Write
* Description    : writes a 1 byte command to 2.4" TFT.
* Input          : command = one byte command (register address)
* Output         : None
* Return         : None
*******************************************************************************/
void GPIO_Write(GPIO_TypeDef* GPIOx, unsigned int command)//when using 16-bit interface (DB17:10,DB8:1)//when using 8-bit interface (DB17:10)
{
   if( command & DATA0_MASK)
   {
       HAL_GPIO_WritePin(GPIOx, DATA0, GPIO_PIN_SET);
   }
   else
   {
       HAL_GPIO_WritePin(GPIOx, DATA0, GPIO_PIN_RESET);
   }   
 
  if( command & DATA1_MASK)
   {
       HAL_GPIO_WritePin(GPIOx, DATA1, GPIO_PIN_SET);
   }
   else
   {
       HAL_GPIO_WritePin(GPIOx, DATA1, GPIO_PIN_RESET);
   }   

   if( command & DATA2_MASK)
   {
       HAL_GPIO_WritePin(GPIOx, DATA2, GPIO_PIN_SET);
   }
   else
   {
       HAL_GPIO_WritePin(GPIOx, DATA2, GPIO_PIN_RESET);
   }

   if( command & DATA3_MASK)
   {
       HAL_GPIO_WritePin(GPIOx, DATA3, GPIO_PIN_SET);
   }
   else
   {
       HAL_GPIO_WritePin(GPIOx, DATA3, GPIO_PIN_RESET);
   }
   
   if( command & DATA4_MASK)
   {
       HAL_GPIO_WritePin(GPIOx, DATA4, GPIO_PIN_SET);
   }
   else
   {
       HAL_GPIO_WritePin(GPIOx, DATA4, GPIO_PIN_RESET);
   }
   
   if( command & DATA5_MASK)
   {
       HAL_GPIO_WritePin(GPIOx, DATA5, GPIO_PIN_SET);
   }
   else
   {
       HAL_GPIO_WritePin(GPIOx, DATA5, GPIO_PIN_RESET);
   }
   
   if( command & DATA6_MASK)
   {
       HAL_GPIO_WritePin(GPIOx, DATA6, GPIO_PIN_SET);
   }
   else
   {
       HAL_GPIO_WritePin(GPIOx, DATA6, GPIO_PIN_RESET);
   }
   
  if( command & DATA7_MASK)
   {
       HAL_GPIO_WritePin(GPIOx, DATA7, GPIO_PIN_SET);
   }
   else
   {
       HAL_GPIO_WritePin(GPIOx, DATA7, GPIO_PIN_RESET);
   }     




/*******************************************************************************
* Function Name  : TFT_delay
* Description    : Delays passed ms
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TFT_delay(int delay_ms)
{
   for(int i=0; i < delay_ms; i++)
   {
       for(int j =0; j < 20; j++);
   }
}

/*******************************************************************************
* Function Name  : disp
* Description    : Display test
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void disp(void)
{
   unsigned int i, j;
       
        TFT_43M_WindowSet(0,100,0,271);               //set start/end column/page address (full screen)
   TFT_43M_Write_Command(0x2C);              //command to begin writing to frame memory
        HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);
   for(i=0;i<272;i++)         //fill screen with red pixels
   {
       for(j=0;j<480;j++)
            {
              TFT_43M_Write_Data(0xFF);
              TFT_43M_Write_Data(0x00);
              TFT_43M_Write_Data(0x00);
            }
   }
        TFT_43M_WindowSet(100,200,0,271);               //set start/end column/page address (full screen)
   TFT_43M_Write_Command(0x2C);              //command to begin writing to frame memory
        HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);//fill screen with green pixels
   for(i=0;i<272;i++)   
        {
       for(j=0;j<480;j++)
            {
              TFT_43M_Write_Data(0x00);
              TFT_43M_Write_Data(0xFF);
              TFT_43M_Write_Data(0x00);
            }
   }
       TFT_43M_WindowSet(200,479,0,271);               //set start/end column/page address (full screen)
   TFT_43M_Write_Command(0x2C);              //command to begin writing to frame memory
        HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);//fill screen with blue pixels
   for(i=0;i<272;i++)   
        {
       for(j=0;j<480;j++)
            {
              TFT_43M_Write_Data(0x00);
              TFT_43M_Write_Data(0x00);
              TFT_43M_Write_Data(0xFF);
            }
   }
       TFT_43M_WindowSet(0,479,0,271);               //set start/end column/page address (full screen)
   TFT_43M_Write_Command(0x2C);              //command to begin writing to frame memory
        HAL_GPIO_WritePin(GPIOG, D_C, GPIO_PIN_SET);  // clear screen
   for(i=0;i<272;i++)   
        {
       for(j=0;j<480;j++)
            {
              TFT_43M_Write_Data(0x00);
              TFT_43M_Write_Data(0x00);
              TFT_43M_Write_Data(0x00);
            }
   }
       
}

 

NHD‐4.3‐480272EF‐ATXL#‐CTP | FAN5333 | BBB | Nothing on the Display

Started by Alias_AliasBoard TFTs

Replies: 1
Views: 3422
Last post September 25, 2015, 03:09:24 PM
by Paul_B
Linux | Device Tree | NHD ‐ 4.3 ‐ 480272EF

Started by Alias_AliasBoard TFTs

Replies: 5
Views: 4516
Last post March 24, 2015, 07:45:50 AM
by Paul_B
help! NHD-4.3-480272EF-ATXL#-T touch panel rotates 90 degrees

Started by knightsunBoard TFTs

Replies: 3
Views: 1219
Last post September 26, 2016, 11:58:01 PM
by knightsun
Need help to interface NHD-4.3-480272EF-ATXL#-T with micro controller.

Started by pioneerBoard TFTs

Replies: 0
Views: 604
Last post December 20, 2016, 12:05:12 AM
by pioneer
NHD-4.3-480272EF-ATXL-T Linux kernel Configs

Started by AleFachiniBoard TFTs

Replies: 0
Views: 2
Last post Today at 10:50:02 AM
by AleFachini