AnsweredAssumed Answered

STM32F4 discovery + SSD1963

Question asked by feixas.bernat on Aug 22, 2016

Good morning, 

I'm developing a product which will have thet TFT WF35QTIBCDBN0# with the SSD1963 as controller.

In order to test it I have connected the display to the discovery board of the STM32F4 microcontroler. 

I have tried with several examples but by now I haven't been able to see anything on the screen apart of a full white screen when I powered it up. 

I attach here my interconnections (I have used the 8 bit mode) and the my code. Anyone could guide me? I can't fins what I am doing wrong :( 

My connections:

D_C_DISPPB13    
TFT_WR   PB8     
TFT_RD  PB7   

 

TFT_DB0 PD6  
TFT_DB1  PB5   
TFT_DB2  PB4 
TFT_DB3  PD3    
TFT_DB4  PD2   
TFT_DB5  PB15 
TFT_DB6  PB14
TFT_DB7 PB12

 

CSD    PC9                  Chip select
RESETD  PA15           Reset controller chip

The display:

WF35QTIBCDBN0#
https://www.texim-europe.com/getfile.aspx?id=103029

The code:

main.c

// SysTick end of count event each1ms 
RCC_GetClocksFreq(&RCC_Clocks);   
SysTick_Config(RCC_Clocks.HCLK_Frequency /1000);
 RCC_ENABLE();
   
initTFTports();
TFT_35M_Init();
draw_rectagle(0,799,0,479,255,255,255);
   

SSD1963.c
#define Set_Cs GPIO_SetBits(GPIOC,GPIO_Pin_9);
#define Clr_Cs GPIO_ResetBits(GPIOC,GPIO_Pin_9);

#define Set_Data  GPIO_SetBits(GPIOB,GPIO_Pin_13);   //DATA/COmand  ----  DATA/COmand       D_C_DISP
#define Set_Comand GPIO_ResetBits(GPIOB,GPIO_Pin_13);

#define Set_nWr GPIO_SetBits(GPIOB,GPIO_Pin_8);
#define Clr_nWrGPIO_ResetBits(GPIOB,GPIO_Pin_8);

#define Set_nRd GPIO_SetBits(GPIOB,GPIO_Pin_7);
#define Clr_nRdGPIO_ResetBits(GPIOB,GPIO_Pin_7);

#define Set_Rst GPIO_SetBits(GPIOA,GPIO_Pin_15);
#defineClr_Rst GPIO_ResetBits(GPIOA,GPIO_Pin_15);

void initTFTports(void){

  GPIO_InitTypeDef GPIO_InitStructure;

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_8 |GPIO_Pin_7 | GPIO_Pin_5 | GPIO_Pin_4 | GPIO_Pin_15 | GPIO_Pin_14 |GPIO_Pin_12;
  GPIO_InitStructure.GPIO_Mode =GPIO_Mode_OUT;
  GPIO_InitStructure.GPIO_Speed =GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_OType =GPIO_OType_PP;
 //GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
  GPIO_Init(GPIOB, &GPIO_InitStructure); 
   
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 |GPIO_Pin_3 | GPIO_Pin_2;
  GPIO_InitStructure.GPIO_Mode =GPIO_Mode_OUT;
  GPIO_InitStructure.GPIO_Speed =GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_OType =GPIO_OType_PP;
 //GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
  GPIO_Init(GPIOD, &GPIO_InitStructure); 
   
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
 GPIO_InitStructure.GPIO_OType =GPIO_OType_PP;
 //GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
  GPIO_Init(GPIOC, &GPIO_InitStructure); 
   
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
 GPIO_InitStructure.GPIO_OType =GPIO_OType_PP;
 //GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
  GPIO_Init(GPIOA, &GPIO_InitStructure); 
   
}

void TFT_DataPort(char value)
{
    u8i,j;
    for(i=6;i<2;i--){
       if( value    & (1<<(6-i))){ j=1; }
       else{    j=0; }
       port_set(PORT_G,i,j);
    }
   for(i=15;i<13;i--){ // 15-10 ..point05
       if( value    & (1<<(20-i))){ j=1; }
       else{    j=0; }
       port_set(PORT_D,i,j);
    }
   
    
}
    
voidSend_TFT_Command(char index)
{
    Clr_Cs;          //TFT_CS = 0;
   Set_Comand;    //TFT_RS = 0; D_C_DISP
   TFT_DataPort(index);
    Clr_nWr;    //TFT_WR = 0;
    __NOP; //asm nop
   Set_nWr;    //TFT_WR = 1;
   Set_Cs;     //TFT_CS = 1;
}

void Send_TFT_Data_8(unsigned char index)
{
   Clr_Cs;        //TFT_CS = 0;
   Set_Data;    //TFT_RS = 1;  D_C_DISP
   TFT_DataPort(index);    //TFT_DataPort =index;
    Clr_nWr;    //TFT_WR =0;
    __NOP; //asm nop;
   Set_nWr;    //TFT_WR = 1;
   Set_Cs;    //TFT_CS = 1;
}

/*******************************************************************************

*******************************************************************************/
voiddraw_rectagle(unsigned int X1,unsigned int X2,unsigned intY1,unsigned int Y2,unsigned char red,unsigned char green,unsignedchar blue)
{
unsigned char X_point_1_1;
unsigned charX_point_1_2;
unsigned char X_point_2_1;
unsigned charX_point_2_2;

unsigned char Y_point_1_1;
unsigned char Y_point_1_2;
unsignedchar Y_point_2_1;
unsigned char Y_point_2_2;

unsigned long temp1;
unsigned long temp2;
unsigned longframe_pixel;
unsigned long pixel_CNT;
    
temp1=X2-X1+1;
temp2=Y2-Y1+1;
frame_pixel=temp1*temp2;
X_point_1_1=X1>>8;
X_point_1_2=X1&0x00FF;
X_point_2_1=X2>>8;
X_point_2_2=X2&0x00FF;
Y_point_1_1=Y1>>8;
Y_point_1_2=Y1&0x00FF;
Y_point_2_1=Y2>>8;
Y_point_2_2=Y2&0x00FF;

Send_TFT_Command(0x2A);//Setup the frame buffer verticaladdressingrange
Send_TFT_Data_8(X_point_1_1);
Send_TFT_Data_8(X_point_1_2);
Send_TFT_Data_8(X_point_2_1);
Send_TFT_Data_8(X_point_2_2);
Send_TFT_Command(0x2B);//Setup the frame buffer horizontal addressrange
Send_TFT_Data_8(Y_point_1_1);
Send_TFT_Data_8(Y_point_1_2);
Send_TFT_Data_8(Y_point_2_1);
Send_TFT_Data_8(Y_point_2_2);
Send_TFT_Command(0x2C);

pixel_CNT=0;
    while(pixel_CNT<=frame_pixel)
   {
        Send_TFT_Data_8(red);
       Send_TFT_Data_8(green);
       Send_TFT_Data_8(blue);
       pixel_CNT++;
    }

}
/*******************************************************************************
*Function Name  : TFT_35M_Init
* Description    :InitializesLCD.
*******************************************************************************/
voidTFT_35M_Init(void)
{
    Clr_Rst;    //TFT_RST = 0;     // Hold in reset
   Set_Data; //TFT_RS = 1;     // Enable dataaccess
    Set_Cs;       //TFT_CS = 1;     // Disable LCD
   Set_nRd;  //TFT_RD = 1;
    Set_nWr;   //TFT_WR = 1;
    // Release from reset
   Delay(100); //100ms  Delay_ms(100);
   Set_Rst;  //TFT_RST = 1;
    Delay(100);   //Delay_ms(100);
        
   Send_TFT_Command(0x01); //Software Reset
   Send_TFT_Command(0x01); //Software Reset
   Send_TFT_Command(0x01); //Software Reset
   Delay(100);    //Delay_ms(100);
   Send_TFT_Command(0xE2);//SET PLL freq=110MHz
   Send_TFT_Data_8(0x21); //N=33, 33X10=330Mhz
   Send_TFT_Data_8(0x02); //M=3 330/3=110Mhz
   Send_TFT_Data_8(0x54);
    Delay(100);   //Delay_ms(100);
    Send_TFT_Command(0xE0);//PLLsettings
    Send_TFT_Data_8(0x01);//START PLL
   Delay(100);    //delay_ms(1);// Wait to let thePLL stable
    Send_TFT_Command(0xE0);//PLLsettings
    Send_TFT_Data_8(0x03); //LOCK PLL
   Delay(100);    //delay_ms(1);

    Send_TFT_Command(0xB0); //LCD MODE Settings
   Send_TFT_Data_8(0x20); //TFT panel data width 24bit, FRC,dithering disable
    Send_TFT_Data_8(0x00);//hsync+Vsync+DEN
    Send_TFT_Data_8(0x03);//horizontal panel size(horizontal lines) HightByte
   Send_TFT_Data_8(0x1F); //LowByte
   Send_TFT_Data_8(0x01); //vertical panel size(vertical lines)HightByte
    Send_TFT_Data_8(0xDF); //SET verticalsize LowByte
    Send_TFT_Data_8(0x00); //avaibleif serial RGB mode is selected.
    Delay(100);   //delay_ms(1);

    Send_TFT_Command(0xF0);
   Send_TFT_Data_8(0x00);//SSD1963 data input format data 8 bit
   Delay(100);    //delay_ms(1);

    Send_TFT_Command(0x3A);//Pixel format
   Send_TFT_Data_8(0x60);
    Delay(100);   //delay_ms(1);
    Send_TFT_Command(0xE6);//SETPCLK freq=33MHz = 110MHz * LCDC_FPR / 2^20
   Send_TFT_Data_8(0x04);
   Send_TFT_Data_8(0xD7);
   Send_TFT_Data_8(0xF9);
    Delay(100);   //delay_ms(1);

    Send_TFT_Command(0xB4);
   Send_TFT_Data_8(0x04); //horizontal total period (display +non-display)-1 highbyte
    Send_TFT_Data_8(0x1F);//low byte
    Send_TFT_Data_8(0x00); //HorizontalPulse Width + Horizontal Back Porch highbyte
   Send_TFT_Data_8(0x58); //low byte 7” 8 bit TFT DIGITAL DRIVERBOARD SPECIFICATION

    Send_TFT_Data_8(0x27); //Horizontal Sync PulseWidth
    Send_TFT_Data_8(0x00); //Hsync pulsestart position
    Send_TFT_Data_8(0x00);//lowbyte
    Send_TFT_Data_8(0x00); //for serialRGB mode
    Delay(100);   //delay_ms(1);

    Send_TFT_Command(0xB6);
   Send_TFT_Data_8(0x02); //vertical total period (display +non-display)-1 highbyte
    Send_TFT_Data_8(0x0C);//low byte
    Send_TFT_Data_8(0x00); //verticalPulse Width + vertical Back Porch highbyte
   Send_TFT_Data_8(0x20); //low byte
   Send_TFT_Data_8(0x00); //vertical Sync Pulse Width
   Send_TFT_Data_8(0x00); //Vsync pulse start position
   Send_TFT_Data_8(0x00); //lowbyte
    Delay(100);   //delay_ms(1);

    Send_TFT_Command(0x36); // Address Mode
   Send_TFT_Data_8(0x00);
    Delay(1);  //delay_ms(1);

    Send_TFT_Command(0x29); //SET display on
   //backlight PWM setting.
   Send_TFT_Command(0xBE);
    Send_TFT_Data_8(0x01);//PLL clock / (256 * (PWMF[7:0] + 1)) / 256
   Send_TFT_Data_8(0x64); //PWM duty cycle
   Send_TFT_Data_8(0x01); //PWM, DBC enable/disable setting.
   Send_TFT_Data_8(0x00); //DBC manual brightness
   Send_TFT_Data_8(0x00); //DBC minimum brightness
   Send_TFT_Data_8(0x00); //Brightness prescaler

}


Outcomes