TI 工程师 好!
最近再用AM1808 调STN 4bpp LCD,直接用的是RASter 模式 问题是初始化之后只能看到PCLK有输出,LCD_HSYNC,LCD_VSYNC都没有变化一直为0,
觉得是controller这边设置的问题,附上我的初始化程序,请帮忙看看是哪里出问题了,谢谢!!
unsigned int i =0,j=0;
unsigned short image2[38432/2];
for(i=0;i<16;i++)
{
if(i==0)
{
image2[i] = 0x2000;
}
else
{
image2[i] = i;
}
}
for(i=16;i<(38432/2);i++)
{
image2[i] = 0xFFFF;
}
PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_LCDC, PSC_POWERDOMAIN_ALWAYS_ON,
PSC_MDCTL_NEXT_ENABLE);
LCDPinMuxSetup();
/* Configure backlight/power control pins */
ConfigRasterDisplayEnable();
/* disable raster */
RasterDisable(SOC_LCDC_0_REGS);
/* configure the pclk */
//RasterClkConfig(SOC_LCDC_0_REGS, 7833600, 150000000);
RasterClkConfig(SOC_LCDC_0_REGS, 6000000, 150000000);//最快4.5MHZ PCLK
/* configuring DMA of LCD controller */ //framebuffer size 最好是burst-size的整数倍
/* RasterDMAConfig(SOC_LCDC_0_REGS, RASTER_DOUBLE_FRAME_BUFFER,
RASTER_BURST_SIZE_16, RASTER_FIFO_THRESHOLD_8,
RASTER_BIG_ENDIAN_DISABLE);
//RASTER_SINGLE_FRAME_BUFFER,
*/
RasterDMAConfig(SOC_LCDC_0_REGS, RASTER_DOUBLE_FRAME_BUFFER,
RASTER_BURST_SIZE_8, RASTER_FIFO_THRESHOLD_8,
RASTER_BIG_ENDIAN_DISABLE);
/* configuring modes(ex:tft or stn,color or monochrome etc) for raster controller */
//RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT,
// RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED);
RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_STN,
RASTER_PALETTE_DATA, RASTER_MONOCHROME, RASTER_MONO4B);
/* frame buffer data is ordered from least to Most significant bye */
RasterLSBDataOrderSelect(SOC_LCDC_0_REGS);
/* disable nibble mode */
//RasterNibbleModeDisable(SOC_LCDC_0_REGS);
RasterNibbleModeEnable(SOC_LCDC_0_REGS);//enable nibble mode for 1 ,2, 4 bpp
/* configuring the polarity of timing parameters of raster controller */
/* RasterTiming2Configure(SOC_LCDC_0_REGS, RASTER_FRAME_CLOCK_LOW |
RASTER_LINE_CLOCK_LOW |
RASTER_PIXEL_CLOCK_LOW |
RASTER_SYNC_EDGE_RISING|
RASTER_SYNC_CTRL_ACTIVE|
RASTER_AC_BIAS_HIGH , 0, 255);
*/
//d0-d3在PCLK 上升沿打到数据线上,在下降沿被屏的PCLK latch, VSYNC/HSYNC
//都在PCLK的上升沿驱动,AC_BIAS 在STN模式下被忽略
RasterTiming2Configure(SOC_LCDC_0_REGS, RASTER_FRAME_CLOCK_HIGH |
RASTER_LINE_CLOCK_HIGH |
RASTER_PIXEL_CLOCK_HIGH |
RASTER_SYNC_EDGE_RISING|
RASTER_SYNC_CTRL_ACTIVE|
RASTER_AC_BIAS_LOW , 0, 255);
/* configuring horizontal timing parameter */
//RasterHparamConfig(SOC_LCDC_0_REGS, 480, 41, 2, 2);
RasterHparamConfig(SOC_LCDC_0_REGS, 320, 2, 1, 1);
/* configuring vertical timing parameters */
//RasterVparamConfig(SOC_LCDC_0_REGS, 272, 10, 3, 3);
RasterVparamConfig(SOC_LCDC_0_REGS, 240, 1, 0, 0);
/* configuring fifo delay to */
RasterFIFODMADelayConfig(SOC_LCDC_0_REGS, 2);
RasterDMAFBConfig(SOC_LCDC_0_REGS,
(unsigned int)image2,
(unsigned int)image2 + sizeof(image2) – 2,
0);
RasterDMAFBConfig(SOC_LCDC_0_REGS,
(unsigned int)image2,
(unsigned int)image2 + sizeof(image2) – 2,
1);
//enable End of frame interrupt////
//RasterEndOfFrameIntEnable(SOC_LCDC_0_REGS);
// enable raster
RasterEnable(SOC_LCDC_0_REGS);
while(1)
{
i = HWREG(SOC_LCDC_0_REGS + LCDC_LCD_STAT);
i = i & 0x300;
if(i!=0)
{
//HWREG(SOC_LCDC_0_REGS + LCDC_RASTER_CTRL) &=~ LCDC_RASTER_CTRL_RASTER_EN;
j = HWREG(SOC_LCDC_0_REGS + LCDC_LCD_STAT) & i ;
HWREG(SOC_LCDC_0_REGS + LCDC_LCD_STAT) = j ;
if (j & RASTER_END_OF_FRAME0_INT_STAT)
{
myRasterDMAFBConfig(SOC_LCDC_0_REGS,
(unsigned int)image2,
(unsigned int)image2 + sizeof(image2) – 2,
0);
}
else if(j & RASTER_END_OF_FRAME1_INT_STAT)
{
myRasterDMAFBConfig(SOC_LCDC_0_REGS,
(unsigned int)image2,
(unsigned int)image2 + sizeof(image2) – 2,
1);
}
}
}
Tony Tang:
上面framebuffer是全局的,还是局部的数组?检查buffer的起始内容是否为有效的调色板值。LCDC要检查调色板的起始数据,如果不对,则出错不能送出数据。