stm32f429驱动TFT问题,后小部分显示不正常
/* IO¿Ú³õʼ»¯ */LCD_GPIOInit();
LCD_DisplayOff();
/* ʹÄÜLCDʱÖÓ */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_LTDC, ENABLE);
/* ʹÄÜDMAʧ×Ù*/
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2D, ENABLE);
/* ˮƽͬ²½ÐźÅ---µÍµçƽÓÐЧ */
LTDC_InitStruct.LTDC_HSPolarity = LTDC_HSPolarity_AL;
/* ´¹Ö±Í¬²½ÐźÅ---µÍµçƽÓÐЧ */
LTDC_InitStruct.LTDC_VSPolarity = LTDC_VSPolarity_AL;
/* Êý¾ÝʹÄÜÐźÅ---µÍµçƽÓÐЧ */
LTDC_InitStruct.LTDC_DEPolarity = LTDC_DEPolarity_AL;
/* ÏñËØÊ±ÖÓÅäÖÃ--- */
LTDC_InitStruct.LTDC_PCPolarity = LTDC_PCPolarity_IPC;
/* LCD±³¹âÉèÖà */
LTDC_InitStruct.LTDC_BackgroundRedValue = 0;
LTDC_InitStruct.LTDC_BackgroundGreenValue = 0;
LTDC_InitStruct.LTDC_BackgroundBlueValue = 0;
/*
****************************************************************************
*PLLSAI_VCO = HSE*PLLSAI_N / PLL_M = 8 * 192 / 8 = 192MHz
*PLLLCDCLK = PLLSAI_VCO / PLLSAI_R = 192 / 3 = 64 Mhz
*LTDC clock frequency = PLLLCDCLK / RCC_PLLSAIDivR = 64 / 8 = 8 Mhz
****************************************************************************
*/
RCC_PLLSAIConfig(250, 2, 8);//RCC_PLLSAIConfig(192, 7, 4);
RCC_LTDCCLKDivConfig(RCC_PLLSAIDivR_Div4);
/* ʹÄÜPLLSAIʱÖÓ */
RCC_PLLSAICmd(ENABLE);
/* µÈ´ýPLLSAIʱÖÓ */
while(RCC_GetFlagStatus(RCC_FLAG_PLLSAIRDY) == RESET){}
//-- Timing configuration --//
//-- Configure horizontal synchronization width --//
/**/
LTDC_InitStruct.LTDC_HorizontalSync = HSYNC;
/**/
LTDC_InitStruct.LTDC_VerticalSync = VSYNC;
/**/
LTDC_InitStruct.LTDC_AccumulatedHBP = HBP;
/**/
LTDC_InitStruct.LTDC_AccumulatedVBP = VBP;
/**/
LTDC_InitStruct.LTDC_AccumulatedActiveW = LCDX + HBP;
/**/
LTDC_InitStruct.LTDC_AccumulatedActiveH = LCDY + VBP;
/**/
LTDC_InitStruct.LTDC_TotalWidth = LCDX + HBP + HFP;
/**/
LTDC_InitStruct.LTDC_TotalHeigh = LCDY + VBP + VFP;
LTDC_Init(<DC_InitStruct);
LTDC_Layer_InitStruct.LTDC_HorizontalStart = HBP+1;
LTDC_Layer_InitStruct.LTDC_HorizontalStop = (LCDX + HBP);
LTDC_Layer_InitStruct.LTDC_VerticalStart = VBP+1;
LTDC_Layer_InitStruct.LTDC_VerticalStop = (LCDY + VBP);
/* Pixel Format configuration*/
LTDC_Layer_InitStruct.LTDC_PixelFormat = LTDC_Pixelformat_RGB888;
/* Alpha constant (255 totally opaque) */
LTDC_Layer_InitStruct.LTDC_ConstantAlpha = 255;
/* Default Color configuration (configure A,R,G,B component values) */
LTDC_Layer_InitStruct.LTDC_DefaultColorBlue = 0x0000ff;
LTDC_Layer_InitStruct.LTDC_DefaultColorGreen = 0;
LTDC_Layer_InitStruct.LTDC_DefaultColorRed = 0;
LTDC_Layer_InitStruct.LTDC_DefaultColorAlpha = 0;
/* Configure blending factors */
LTDC_Layer_InitStruct.LTDC_BlendingFactor_1 = LTDC_BlendingFactor1_CA;
LTDC_Layer_InitStruct.LTDC_BlendingFactor_2 = LTDC_BlendingFactor2_CA;
/* the length of one line of pixels in bytes + 3 then :
Line Lenth = Active high width x number of bytes per pixel + 3
Active high width = LCD_PIXEL_WIDTH
number of bytes per pixel = 2 (pixel_format : RGB565)
*/
LTDC_Layer_InitStruct.LTDC_CFBLineLength = ((LCDX * 2) + 3);
/*the pitch is the increment from the start of one line of pixels to the
start of the next line in bytes, then :
Pitch = Active high width x number of bytes per pixel
*/
LTDC_Layer_InitStruct.LTDC_CFBPitch = (LCDX * 2);
/* configure the number of lines */
LTDC_Layer_InitStruct.LTDC_CFBLineNumber = LCDY;
/* Input Address configuration */
LTDC_Layer_InitStruct.LTDC_CFBStartAdress = LCD_FRAME_BUFFER;
LTDC_LayerInit(LTDC_Layer1, <DC_Layer_InitStruct);
/* Configure Layer2 */
LTDC_Layer_InitStruct.LTDC_CFBStartAdress = LCD_FRAME_BUFFER + BUFFER_OFFSET;
LTDC_Layer_InitStruct.LTDC_BlendingFactor_1 = LTDC_BlendingFactor1_PAxCA;
LTDC_Layer_InitStruct.LTDC_BlendingFactor_2 = LTDC_BlendingFactor2_PAxCA;
LTDC_LayerInit(LTDC_Layer2, <DC_Layer_InitStruct);
LTDC_ReloadConfig(LTDC_IMReload);
/* Enable foreground & background Layers */
LTDC_LayerCmd(LTDC_Layer1, ENABLE);
//LTDC_LayerCmd(LTDC_Layer2, ENABLE);
LTDC_ReloadConfig(LTDC_IMReload);
LCD_DisplayOn();
试过驱动800 X480的TFT,写数据只显示到320行,驱动800 X 600 的TFT数据像是到400行,请问是什么问题???????????????,用SDROM做内存显示
weizhiwuxian 发表于 2015-7-11 11:06
问题解决,配置错误,R888模式,对应需要修改TDC_Layer_InitStruct.LTDC_CFBLineLength = ((LCDX * 2) + 3); ...
RGB888模式要修改为下面的吧,
TDC_Layer_InitStruct.LTDC_CFBLineLength = ((LCDX * 3) + 3);
楼主可以试一试只开一层, 不是很懂,但是感觉下面的几个参数设置是不是有问题,
LTDC_Layer_InitStruct.LTDC_HorizontalStart = HBP+1;
LTDC_Layer_InitStruct.LTDC_HorizontalStop = (LCDX + HBP);
LTDC_Layer_InitStruct.LTDC_VerticalStart = VBP+1;
LTDC_Layer_InitStruct.LTDC_VerticalStop = (LCDY + VBP);
从手册上看的2个图看
应该为下面的公式吧,
Horizontal start = horizontal synchronization + Horizontal back porch
Vertical start = vertical synchronization + vertical back porch
Horizontal stop = Horizontal start + window width -1
Vertical stop = Vertical start + window height -1
问题解决,配置错误,R888模式,对应需要修改TDC_Layer_InitStruct.LTDC_CFBLineLength = ((LCDX * 2) + 3); 是的,正解!!!!!!!!!! 注释乱码 还能这样玩 不懂,帮顶…… 学习了..
页:
[1]
2