2019-10-16 05:47 AM
hi ,
i tried to interface TFT display 800X480 with stm32f401re. TFT display interface with SSD1963.
now the thing is that display does not showing anything .
i dont know the problem with initialization process or else.
the pin mainly used RS#, CS#.WR#, RST, RD# and 0-15 data pin . please go through the below pragamm suggest me where i am wrong . for initialization process of PIN i used STMcubeMX.
void Write_Command(unsigned char command) {
HAL_GPIO_WritePin(GPIOC, GPIO_CS_Pin, 0);
HAL_GPIO_WritePin(GPIOC, GPIO_RD_Pin, 1); /* make sure the RD is HIGH just to be sure */
HAL_GPIO_WritePin(GPIOC, GPIO_RS_Pin, 0);
HAL_GPIO_WritePin(GPIOC, GPIO_WR_Pin, 0);
HAL_Delay(1);
GPIOA->ODR = command;
HAL_Delay(1);
HAL_GPIO_WritePin(GPIOC, GPIO_WR_Pin, 1);
HAL_GPIO_WritePin(GPIOC, GPIO_CS_Pin, 1);
}
void Write_Data(unsigned char Data) {
HAL_GPIO_WritePin(GPIOC, GPIO_CS_Pin, 0);
HAL_GPIO_WritePin(GPIOC, GPIO_RD_Pin, 1); /* make sure the RD is HIGH just to be sure */
HAL_GPIO_WritePin(GPIOC, GPIO_RS_Pin, 1);
HAL_GPIO_WritePin(GPIOC, GPIO_WR_Pin, 0);
HAL_Delay(1);
GPIOA->ODR = Data;
HAL_Delay(1);
HAL_GPIO_WritePin(GPIOC, GPIO_WR_Pin, 1);
HAL_GPIO_WritePin(GPIOC, GPIO_CS_Pin, 1);
}
void Command_Write(unsigned char REG,unsigned char VALUE) {
Write_Command(REG);
Write_Data(VALUE);
}
static void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOC, GPIO_RST_Pin|GPIO_CS_Pin|GPIO_RS_Pin|GPIO_RD_Pin
|GPIO_WR_Pin, GPIO_PIN_RESET);
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15, GPIO_PIN_RESET);
/*Configure GPIO pins : GPIO_RST_Pin GPIO_CS_Pin GPIO_RS_Pin GPIO_RD_Pin
GPIO_WR_Pin */
GPIO_InitStruct.Pin = GPIO_RST_Pin|GPIO_CS_Pin|GPIO_RS_Pin|GPIO_RD_Pin
|GPIO_WR_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
/*Configure GPIO pins : PA0 PA1 PA2 PA3
PA4 PA5 PA6 PA7
PA8 PA9 PA10 PA11
PA12 PA13 PA14 PA15 */
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3
|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7
|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
void begin()
{
HAL_GPIO_WritePin(GPIOA, GPIO_RST_Pin, 0);
__NOP;
__NOP;
__NOP;
HAL_GPIO_WritePin(GPIOA , GPIO_RST_Pin, 1);
__NOP; __NOP; __NOP;
Write_Command(0x01); //Software Reset
Write_Command(0x01);
Write_Command(0x01);
Command_Write(0xe0,0x01); // START PLL
Command_Write(0xe0,0x03); // LOCK PLL
Write_Command(0xb0); //SET LCD MODE SET TFT 18Bits MODE
Write_Data(0x08); //SET TFT MODE & hsync+Vsync+DEN MODE
Write_Data(0x80); //SET TFT MODE & hsync+Vsync+DEN MODE
Write_Data(0x03); //SET horizontal size=800-1 HightByte
Write_Data(0x1f); //SET horizontal size=800-1 LowByte
Write_Data(0x01); //SET vertical size=480-1 HightByte
Write_Data(0xdf); //SET vertical size=480-1 LowByte
Write_Data(0x00); //SET even/odd line RGB seq.=RGB
Command_Write(0xf0,0x00); //SET pixel data I/F format=8bit
Command_Write(0x3a,0x60); // SET R G B format = 6 6 6
Write_Command(0xe2); //SET PLL freq=113.33MHz ;
Write_Data(0x22);
Write_Data(0x03);
Write_Data(0x04);
Write_Command(0xe6); //SET PCLK freq=33.26MHz ; pixel clock frequency
Write_Data(0x00);
Write_Data(0xe7);
Write_Data(0x4f);
Write_Command(0xb4); //SET HBP,
Write_Data(0x20); //SET HSYNC Total = 8367
Write_Data(0xaf);
Write_Data(0x00); //SET HBP = 163
Write_Data(0xa3);
Write_Data(0x07); //SET VBP 8 = 7 + 1
Write_Data(0x00); //SET Hsync pulse start position
Write_Data(0x00);
Write_Data(0x00); //SET Hsync pulse subpixel start position
Write_Command(0xb6); //SET VBP,
Write_Data(0x01); //SET Vsync total 496 = 495 + 1
Write_Data(0xef);
Write_Data(0x00); //SET VBP = 4
Write_Data(0x04);
Write_Data(0x01); //SET Vsync pulse 2 = 1 + 1
Write_Data(0x00); //SET Vsync pulse start position
Write_Data(0x00);
Write_Command(0x2a); //SET column address
Write_Data(0x00); //SET start column address=0
Write_Data(0x00);
Write_Data(0x03); //SET end column address=800
Write_Data(0x1f);
Write_Command(0x2b); //SET page address
Write_Data(0x00); //SET start page address=0
Write_Data(0x00);
Write_Data(0x01); //SET end page address=480
Write_Data(0xdf);
Write_Command(0x29); //SET display on
Write_Command(0x2c);
}
thanking you
2019-10-18 04:04 AM
You should check the data sheet for the SSD chip,
I think you should have delays for the PLL to start up,
you are not waiting anywhere