AnsweredAssumed Answered

ssd1963 display screen is white

Question asked by mohsenipur.mohammad on Feb 14, 2016
hi
i connect ssd1963 (AT070TN92 LCD) to STM32F429ZGT6 with FSMC FMC_NORSRAM_BANK2 on 8080 mode.
  
  
#define WRITE_READ_ADDR     ((uint32_t)(0x1 << 24 ))
  //starting address of  SRAM Peripheral | starting address of selected bank 2
  //                              |                     |
  #define SRAM_BANK_ADDR  ((uint32_t)(0x60000000 | 0x04000000))
  #define LCD_REG  (*((volatile uint16_t *)(SRAM_BANK_ADDR)))
  #define LCD_RAM  (*((volatile uint16_t *)(SRAM_BANK_ADDR | WRITE_READ_ADDR)))

then i test connection with Logic Analyser everything is ok.
i initialize ssd1963 with this configuration

           
#define        T3_HDP        799    //-->800
            #define        T3_HT        928
            #define        T3_HPS        46
            #define     T3_LPS        15
            #define     T3_HPW        48
 
            #define        T3_VDP        479    //-->480
            #define     T3_VT        525
            #define        T3_VPS        16
            #define        T3_FPS        8
            #define        T3_VPW        16
 
            // Return used resolution
            current_lcd_type = SSD1963_TYPE_3;    // Set type for touch handling
            *lcd_res_x = T0_HDP;
            *lcd_res_y = T0_VDP;
 
            // enable wait
            //XMCRA |= (1<<SRW00) | (1<<SRW01);// wait
 
            Write_Command(SSD1963_set_pll_mn);    //PLL multiplier, set PLL clock to 120M
            Write_Data(0x0023);                    //N=0x36 for 6.5M, 0x23 for 10M crystal
            Write_Data(0x0002);
            Write_Data(0x0004);
            Write_Command(SSD1963_set_pll);        // PLL enable
            Write_Data(0x0001);
            osDelay(1);
            Write_Command(SSD1963_set_pll);
            Write_Data(0x0003);
            osDelay(5);
            Write_Command(SSD1963_soft_reset);    // software reset
            osDelay(5);
 
            // disable wait
            //XMCRA &= ~((1<<SRW00) | (1<<SRW01));    // wait
 
            Write_Command(SSD1963_set_lshift_freq);    //PLL setting for PCLK, depends on resolution
            //Write_Data(0x0003);
            //Write_Data(0x00ff);
            //Write_Data(0x00ff);
      Write_Command(0x00E6);                                                        /* PLL setting for PCLK,        */
 
            Write_Data(0x0004);
 
            Write_Data(0x0093);
 
            Write_Data(0x00e0);
            Write_Command(SSD1963_set_lcd_mode);        //LCD SPECIFICATION
            Write_Data(0x0000);
            Write_Data(0x0000);
            Write_Data((T3_HDP>>8)&0X00FF);            //Set HDP
            Write_Data(T3_HDP&0X00FF);
            Write_Data((T3_VDP>>8)&0X00FF);            //Set VDP
            Write_Data(T3_VDP&0X00FF);
            Write_Data(0x0000);
 
            Write_Command(SSD1963_set_hori_period);    //HSYNC
            Write_Data((T3_HT>>8)&0X00FF);            //Set HT
            Write_Data(T3_HT&0X00FF);
            Write_Data((T3_HPS>>8)&0X00FF);            //Set HPS
            Write_Data(T3_HPS&0X00FF);
            Write_Data(T3_HPW);                        //Set HPW
            Write_Data((T3_LPS>>8)&0X00FF);            //Set HPS
            Write_Data(T3_LPS&0X00FF);
            Write_Data(0x0000);
 
             
 
 
            Write_Command(SSD1963_set_gpio_value);
            Write_Data(0x0005);                        //GPIO[3:0] out 1
 
            Write_Command(SSD1963_set_gpio_conf);
            Write_Data(0x0007);                        //GPIO3=input, GPIO[2:0]=output
            Write_Data(0x0001);                        //GPIO0 normal
 
            Write_Command(SSD1963_set_address_mode);    //rotation
            if (rotate) Write_Data(0x0003);
            else Write_Data(0x0000);
      
            Write_Command(SSD1963_set_pixel_data_interface);//pixel data interface
            Write_Data(0x0020);
 
 
            osDelay(5);
      Write_Command(0x00BE);   //set PWM for B/L
            Write_Data(0x0006);
            Write_Data(0x0080);
 
            Write_Data(0x0001);
            Write_Data(0x00F0);
            Write_Data(0x0000);
            Write_Data(0x0000);
      Write_Command(SSD1963_set_post_proc);
            Write_Data(0x0080);                                                  
 
        Write_Data(0x0080);                                                
 
        Write_Data(0x0080);                                                
 
        Write_Data(0x0001);                                                  
 
 
 
        osDelay(5);
            Write_Command(SSD1963_set_display_on); //display on
//Write_Command(SSD1963_enter_invert_mode);
            Write_Command(SSD1963_set_dbc_conf);
        //   
            Write_Data(0x000d);


PWM of SSD1963 run and backlite ok.
i send some data to SSD1963 but nothing show on LCD my source code is.

void SSD1963_reset_init(void)
{
  /*GPIO_InitTypeDef  GPIO_InitStructure;
    RCC->AHB1ENR  |= 0x1; // Enable GPIOA
 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
  GPIO_Init(GPIOA, &GPIO_InitStructure);
    */
    GPIO_InitTypeDef GPIO_InitStruct;
    GPIO_InitStruct.Pin = GPIO_PIN_0;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_PULLUP;
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
}
 
//*******************************************************
void LCD_Write_DataA_Prepare(void)
{
    Write_Command(0x002C);
}
 
void LCD_Clear(uint16_t Color)
{
 unsigned int l=480,w;
 
    Write_Command(0X002A); 
    Write_Data(0);     
    Write_Data(0);
    Write_Data(HDP>>8);    
    Write_Data(HDP&0XFF);
 
 
  Write_Command(0X002B);   
    Write_Data(0);     
    Write_Data(0);
    Write_Data(VDP>>8);    
    Write_Data(VDP&0X00FF);
 
    Write_Command(0X002C); 
    while(l--)        /* 480ÐÐ */
    {
        for(w = 0; w < HDP+1; w++)  /* ÿÐÐ800¸öÏñËصã */
        {  
            Write_Data(Color);
        }  
    }
}
 
void LCD_SetCursor(uint16_t Xpos, uint16_t Ypos)
{
    Write_Command(0x002A); 
    Write_Data(Xpos>>8);       
    Write_Data(Xpos&0x00ff);
    Write_Data(LCD_W>>8);      
    Write_Data(LCD_W&0x00ff);
  Write_Command(0x002b);   
    Write_Data(Ypos>>8);       
    Write_Data(Ypos&0x00ff);
    Write_Data(LCD_H>>8);      
    Write_Data(LCD_H&0x00ff);
}
 
void LCD_WindowMax (unsigned int xsta,unsigned int ysta,unsigned int xend,unsigned int yend)
{
    Write_Command(0X002A);
    Write_Data(xsta>>8);
    Write_Data(xsta&0X00FF);
    Write_Data(xend>>8);
    Write_Data(xend&0X00FF);
         
    Write_Command(0X002B); 
    Write_Data(ysta>>8);   
    Write_Data(ysta&0X00FF);
    Write_Data(yend>>8);   
    Write_Data(yend&0X00FF);           
}
void LCD_FILL1(unsigned int i)
{
  unsigned int l=480,w;
    LCD_WindowMax (0,HDP,0,VDP);
    //LCD_Write_DataA_Prepare(); 
  Write_Command(SSD1963_write_memory_start);   
    while(l--)
    {
      for(w=0;w<800;w++)
        {   
         Write_Data(i);
        }
    }
 return;   
}
void LCD_Fill(uint8_t xsta, uint16_t ysta, uint8_t xend, uint16_t yend, uint16_t colour)
{                   
  uint32_t n;
    LCD_WindowMax (xsta, ysta, xend, yend);
    LCD_Write_DataA_Prepare();                    
    n=(uint32_t)(yend-ysta+1)*(xend-xsta+1);   
    while(n--){
    //  Write_Command(0x2c);
    Write_Data(colour);}    
 
 
//---------------------------------------------
 
 
void LCD_DrawPoint(uint16_t xsta, uint16_t ysta, uint16_t color)
{
    LCD_SetCursor(xsta, ysta);  /*ÉèÖùâ±êλÖà */
    LCD_Write_DataA_Prepare();           /*¿ªÊ¼Ð´ÈëGRAM */
    Write_Data(color);
}
 
void Draw_Circle(uint16_t x0, uint16_t y0, uint8_t r, uint16_t color)
{
    int a,b;
    int di;
    a=0;b=r;
           
    di=3-(r<<1);             /*ÅжÏϸöµãλÖõıêÖ¾*/
    while(a<=b)
    {
        LCD_DrawPoint(x0-b, y0-a, color);             //3          
        LCD_DrawPoint(x0+b, y0-a, color);             //0          
        LCD_DrawPoint(x0-a, y0+b, color);             //1      
        LCD_DrawPoint(x0-b, y0-a, color);             //7          
        LCD_DrawPoint(x0-a, y0-b, color);             //2            
        LCD_DrawPoint(x0+b, y0+a, color);             //4              
        LCD_DrawPoint(x0+a, y0-b, color);             //5
        LCD_DrawPoint(x0+a, y0+b, color);             //6
        LCD_DrawPoint(x0-b, y0+a, color);
        a++;
 
        /*ʹÓÃBresenhamËã·¨»Ô²*/    
        if(di<0)di +=4*a+6;  
        else
        {
            di+=10+4*(a-b);  
            b--;
        }
        LCD_DrawPoint(x0+a, y0+b, color);
    }
}
 
 
 
void LCD_DrawLine(uint16_t xsta, uint16_t ysta, uint16_t xend, uint16_t yend, uint16_t color)
{
    uint16_t x, y, t;   
    if((xsta==xend)&&(ysta==yend))
        LCD_DrawPoint(xsta, ysta, color);
    else
        if(abs(yend-ysta)>abs(xend-xsta))/*бÂÊ´óÓÚ1 */
        {
            if(ysta>yend)
            {
                t=ysta;
                ysta=yend;
                yend=t;
                t=xsta;
                xsta=xend;
                xend=t;
            }
            for(y=ysta;y<yend;y++)            /*ÒÔyÖáΪ»ù×¼*/
            {
                x=(uint32_t)(y-ysta)*(xend-xsta)/(yend-ysta)+xsta;
                LCD_DrawPoint(x, y, color); 
            }
        }
        else     /*бÂÊСÓÚµÈÓÚ1 */
        {
            if(xsta>xend)
            {
                t=ysta;
                ysta=yend;
                yend=t;
                t=xsta;
                xsta=xend;
                xend=t;
            }  
            for(x=xsta;x<=xend;x++)  /*ÒÔxÖáΪ»ù×¼*/
            {
                y =(uint32_t)(x-xsta)*(yend-ysta)/(xend-xsta)+ysta;
                LCD_DrawPoint(x, y, color);
            }
        }
}
 
 
 
void LCD_DrawRectangle(uint16_t xsta, uint16_t ysta, uint16_t xend, uint16_t yend, uint16_t color)
{
    LCD_DrawLine(xsta, ysta, xend, ysta, color);
    LCD_DrawLine(xsta, ysta, xsta, yend, color);
    LCD_DrawLine(xsta, yend, xend, yend, color);
    LCD_DrawLine(xend, ysta, xend, yend, color);
}
void LCD_DrawColour(uint16_t StartX,uint16_t StartY,uint16_t Xend,uint16_t Yend,uint16_t colour)
{
    static  uint16_t i=0,j=0;
    for(j=0; j<Yend-StartY; j++)
    {
        for(i=0; i<Xend-StartX; i++)
        LCD_DrawPoint(StartX+i, StartY+j, colour); 
    }
}
void LCD_DrawPicture(uint16_t StartX,uint16_t StartY,uint16_t Xend,uint16_t Yend,uint8_t *pic)
{
    static  uint16_t i=0,j=0;
    uint16_t *bitmap = (uint16_t *)pic;
    for(j=0; j<Yend-StartY; j++)
    {
        for(i=0; i<Xend-StartX; i++)
        LCD_DrawPoint(StartX+i, StartY+j, *bitmap++);  
    }
}
 
//---------------------------------------------
 
void LCD_ShowHzString(uint16_t x0, uint16_t y0, uint8_t *pcStr, uint16_t PenColor, uint16_t BackColor)
{
#define MAX_HZ_POSX 224
#define MAX_HZ_POSY 304
    uint16_t usIndex;
    uint8_t size = 16;
    FNT_GB16 *ptGb16 = 0;   
    ptGb16 = (FNT_GB16 *)GBHZ_16;
 
    if(x0>MAX_HZ_POSX){x0=0;y0+=size;}                  
    if(y0>MAX_HZ_POSY){y0=x0=0;LCD_Clear(WHITE);}     
 
    usIndex = findHzIndex(pcStr);
    WriteOneHz(x0, y0, (uint8_t *)&(ptGb16[usIndex].Msk[0]),  PenColor, BackColor);
}
 
 
void LCD_ShowChar(uint8_t x, uint16_t y, uint8_t num, uint8_t size, uint16_t PenColor, uint16_t BackColor)
{      
#define MAX_CHAR_POSX 232
#define MAX_CHAR_POSY 304
    uint8_t temp;
    uint8_t pos,t;
    if(x>MAX_CHAR_POSX||y>MAX_CHAR_POSY)return;        
    num=num-' ';                         /*µÃµ½Æ«ÒƺóµÄÖµ */
    for(pos=0;pos<size;pos++)
    {
        if(size==12)
            temp=asc2_1206[num][pos];/*µ÷ÓÃ1206×ÖÌå*/
        else
            temp=asc2_1608[num][pos];        /*µ÷ÓÃ1608×ÖÌå */
        for(t=0;t<size/2;t++)
        {                
            if(temp&0x01)              /*´ÓµÍλ¿ªÊ¼*/
            {
                LCD_DrawPoint(x+t, y+pos, PenColor);  /*»×ÖÌåÑÕÉ« Ò»¸öµã*/
            }
            else
                LCD_DrawPoint(x+t, y+pos, BackColor);      /*»±³¾°ÑÕÉ« Ò»¸öµã*/    
            temp>>=1;
        }
    }          
}
 
void LCD_ShowCharString(uint16_t x, uint16_t y, const uint8_t *p, uint16_t PenColor, uint16_t BackColor)
{  
    uint8_t size = 16;    
      
    if(x>MAX_CHAR_POSX){x=0;y+=size;}                 
    if(y>MAX_CHAR_POSY){y=x=0;LCD_Clear(WHITE);}   
    LCD_ShowChar(x, y, *p, size, PenColor, BackColor);     
}
 
//============================================================================
//============================================================================
void WriteOneChar(uint16_t x, uint16_t y, uint8_t num, uint16_t PenColor, uint16_t BackColor)
{
    uint8_t size = 16;      
    uint8_t temp;
    uint8_t pos,t;
    num=num-' ';                      
    for(pos=0;pos<size;pos++)
    {
        if(size==12)
            temp=asc2_1206[num][pos];
        else
            temp=asc2_1608[num][pos];       
        for(t=0;t<size/2;t++)
        {
                if(temp&0x01){LCD_DrawPoint(x+t, y+pos, PenColor);}
            else
                LCD_DrawPoint(x+t, y+pos, BackColor);          
            temp>>=1;}
       }
}
 
uint32_t mypow(uint8_t m,uint8_t n)
{
    uint32_t result=1;  
    while(n--)result*=m;   
    return result;
}  
 
void LCD_ShowNum(uint16_t x,uint16_t y,uint32_t num,uint8_t len, uint16_t PenColor, uint16_t BackColor)
{   
    uint8_t size = 16;   /*  ÕâÀïʹÓÃĬÈϵÄ16*8  */        
    uint8_t t,temp;
    uint8_t enshow=0;                         
    for(t=0;t<len;t++)
    {
        temp=(num/mypow(10,len-t-1))%10;
        if(enshow==0&&t<(len-1))
        {
            if(temp==0)
            {
                WriteOneChar(x+(size/2)*t,y, ' ', PenColor, BackColor);
                continue;
            }else enshow=1;
              
        }
        WriteOneChar(x+(size/2)*t,y,temp+'0', PenColor, BackColor);
    }
}
 
/*uint16_t findHzIndex(uint8_t *hz)                                                                         
{
    uint16_t i=0;
    FNT_GB16 *ptGb16 = (FNT_GB16 *)GBHZ_16;      
    while(ptGb16[i].Index[0] > 0x80)
    {
        if ((*hz == ptGb16[i].Index[0]) && (*(hz+1) == ptGb16[i].Index[1]))
        {
            return i;
        }
        i++;
        if(i > (sizeof((FNT_GB16 *)GBHZ_16) / sizeof(FNT_GB16) - 1))
        {
            break;
        }
    }
    return 0;
}*/
 
uint8_t WriteOneHz(uint16_t x0, uint16_t y0, uint8_t *pucMsk, uint16_t PenColor, uint16_t BackColor)
{
    uint16_t i,j;
    uint16_t mod[16];                                     
    uint16_t *pusMsk;                                  
    uint16_t y;
    uint16_t size = 16;     
    pusMsk = (uint16_t *)pucMsk;
 
 
    for(i=0; i<16; i++)                                    /* ±£´æµ±Ç°ºº×ÖµãÕóʽ×ÖÄ£       */
    {
        mod[i] = *pusMsk;                                /* È¡µÃµ±Ç°×ÖÄ££¬°ë×Ö¶ÔÆë·ÃÎÊ   */
        mod[i] = ((mod[i] & 0xff00) >> 8) | ((mod[i] & 0x00ff) << 8);/* ×ÖÄ£½»»»¸ßµÍ×Ö½Ú*/
        pusMsk = pusMsk+1;
    }
    y = y0;
    for(i=0; i<16; i++)                                    /* 16ÐР  */
    {                                             
        for(j=0; j<16; j++)                                /* 16ÁР  */
        {
            if((mod[i] << j) & 0x8000)       /* ÏÔʾµÚiÐÐ ¹²16¸öµã */
            {
                LCD_DrawPoint(x0+j, y0+i, PenColor);
            }
            else
            {
                LCD_DrawPoint(x0+j, y0+i, BackColor);
            }
        }
        y++;
    }
    return (16);                      /* ·µ»Ø16λÁÐ¿í                 */
}
 
void LCD_ShowString(uint16_t x0, uint16_t y0, uint8_t *pcStr, uint16_t PenColor, uint16_t BackColor)
{
    uint16_t usIndex;
    uint16_t usWidth = 0;
    FNT_GB16 *ptGb16 = 0;
     
    ptGb16 = (FNT_GB16 *)GBHZ_16; 
    while(1)
    {
        if(*pcStr == 0) {break;}     
        x0 = x0 + (usWidth);                          
 
        if(*pcStr > 0x80)                              /* ÅжÏΪºº×Ö                   */
        {
            if((x0 + 16) > LCD_W)                      /* ¼ì²éÊ£Óà¿Õ¼äÊÇ·ñ×ã¹»         */
            {
                x0 = 0;
                y0 = y0 + 16;                          /* ¸Ä±äÏÔʾ×ø±ê                 */
                if(y0 > LCD_H)                         /* ×Ý×ø±ê³¬³ö                   */
                {
                    y0 = 0;
                }
            }
            usIndex = findHzIndex(pcStr);
            usWidth = WriteOneHz(x0, y0, (uint8_t *)&(ptGb16[usIndex].Msk[0]), PenColor, BackColor);
                                                       /* ÏÔʾ×Ö·û                     */
            pcStr += 2;
        }
        else
        {                                               /* ÅжÏΪ·Çºº×Ö                 */
            if (*pcStr == '\r')                         /* »»ÐР                        */
            {
                y0 = y0 + 16;                           /* ¸Ä±äÏÔʾ×ø±ê                 */
                if(y0 > LCD_H)                          /* ×Ý×ø±ê³¬³ö                   */
                {
                    y0 = 0;
                }
                pcStr++;
                usWidth = 0;
                continue;
            }
            else if (*pcStr == '\n')                    /* ¶ÔÆëµ½Æðµã                   */
            {
                x0 = 0;
                pcStr++;
                usWidth = 0;
                continue;
            }
            else
            {
                if((x0 + 8) > LCD_W)                     /* ¼ì²éÊ£Óà¿Õ¼äÊÇ·ñ×ã¹»         */
                {
                    x0 = 0;
                    y0 = y0 + 16;                        /* ¸Ä±äÏÔʾ×ø±ê                 */
                    if(y0 > LCD_H)                       /* ×Ý×ø±ê³¬³ö                   */
                    {
                        y0 = 0;
                    }
                }
                WriteOneChar(x0, y0, *pcStr, PenColor, BackColor);
                usWidth = 8;
                                                         /* ASCIIÂë±í21HµÄÖµ¶ÔÓ¦ÇøλÂë3Çø*/
                pcStr += 1;
            }
        }
    }                                                      
}
void LCD_Delay_D(){
    register int i =70;
    while(i--){
    asm("nop");
    }
}
void LCD_Delay(){
    register int i =2;
    while(i--){
    asm("nop");
    }
}
void Write_Command(uint16_t cmd)
{
 
    LCD_REG=cmd;
     
 
}
 
//;******************************************************************************
void Write_Data(uint16_t data)
{
 
    LCD_RAM=data;//(data << 8) | (data >> 8);
 
}
uint16_t Read_Reg(uint16_t cmd)
{
    uint16_t data;
 
    LCD_REG=cmd;
 
    data = LCD_RAM;
 
    return data;
 
}
uint16_t SSD1963_Read()
{
    uint16_t data;
 
     
    data = LCD_RAM;
     
    return data;
 
}
 
//==============================================================
void Command_Write(uint16_t cmd,uint16_t data)
{
     
    LCD_REG=cmd;
 
    LCD_RAM=data;
     
}
//==============================================================
void SendData(uint32_t color)
{
    Write_Data((color)>>16); // color is red
    Write_Data((color)>>8);  // color is green
    Write_Data(color);           // color is blue
}

Attachments

Outcomes