|
先上效果图。 NES 模拟器,用的原子哥的代码,很流畅(为了USB超频的192M)。PS 用论坛里的那个模拟器,卡的不能看,超频到260M都不行。
stm32f4disco 的demo。800x600@60Hz 超频了,180M很花。这是配置到260M。
原本想说下历史的,想想还是不废话了。 LTDC 接口的行场同步对应VGA的行场同步,数据用电阻网络接到VGA数据引脚。 图中R10 R16 应该是33R。
VGA电阻网络这里就不介绍了,这里只说stm32 怎么配置VGA时序。 左边是VGA的,右边是RM文档的。图是一样的,就是说LTDC参数合适,VGA就正常了。
关于VGA需要的参数大家可以从http://www.tinyvga.com/vga-timing 上找。上面demo配置的是800x600@60Hz。 需要配置的是 Pixel freq 和下面2个表格的。如果看过RM文档LTDC部分,肯定能发现LTDC 中也有对应的参数。
下面是我的配置部分。红色部分是要配置的。 **************************************************************************** /* LTDC Configuration *********************************************************/ /* Polarity configuration */ /* Initialize the horizontal synchronization polarity as active low */ LTDC_InitStruct.LTDC_HSPolarity = LTDC_HSPolarity_AH; // 网上的图是低有效,我试过的几个显示器是高有效 ? /* Initialize the vertical synchronization polarity as active low */ LTDC_InitStruct.LTDC_VSPolarity = LTDC_VSPolarity_AH; // 网上的图是低有效,我试过的几个显示器是高有效 ? /* Initialize the data enable polarity as active low */ LTDC_InitStruct.LTDC_DEPolarity = LTDC_DEPolarity_AL; /* Initialize the pixel clock polarity as input pixel clock */ LTDC_InitStruct.LTDC_PCPolarity = LTDC_PCPolarity_IPC; /* Configure R,G,B component values for LCD background color */ LTDC_InitStruct.LTDC_BackgroundRedValue = 0; LTDC_InitStruct.LTDC_BackgroundGreenValue = 0; LTDC_InitStruct.LTDC_BackgroundBlueValue = 0; /* Configure PLLSAI prescalers for LCD */ /* Enable Pixel Clock */ /* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */ /* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAI_N = 192 Mhz */ /* PLLLCDCLK = PLLSAI_VCO Output/PLLSAI_R = 192/4 = 48 Mhz */ /* LTDC clock frequency = PLLLCDCLK / RCC_PLLSAIDivR = 48/8 = 6 Mhz */ RCC_PLLSAIConfig(160, 7, 2); // 我是12M晶振 PLL_M=6 RCC_LTDCCLKDivConfig(RCC_PLLSAIDivR_Div4); /* Enable PLLSAI Clock */ RCC_PLLSAICmd(ENABLE); /* Wait for PLLSAI activation */ while(RCC_GetFlagStatus(RCC_FLAG_PLLSAIRDY) == RESET) { } /* Timing configuration */ /* Configure horizontal synchronization width */ LTDC_InitStruct.LTDC_HorizontalSync = 127; /* Configure vertical synchronization height */ LTDC_InitStruct.LTDC_VerticalSync = 3; /* Configure accumulated horizontal back porch */ LTDC_InitStruct.LTDC_AccumulatedHBP = 215; /* Configure accumulated vertical back porch */ LTDC_InitStruct.LTDC_AccumulatedVBP = 26; /* Configure accumulated active width */ LTDC_InitStruct.LTDC_AccumulatedActiveW = 1015; /* Configure accumulated active height */ LTDC_InitStruct.LTDC_AccumulatedActiveH = 626; /* Configure total width */ LTDC_InitStruct.LTDC_TotalWidth = 1055; /* Configure total height */ LTDC_InitStruct.LTDC_TotalHeigh = 627; LTDC_Init(<DC_InitStruct); 同步 前沿后沿那些可以看下RM文档483页,也就是下面这个截图。
Pixel freq 误差要尽量小,最简单的方式用cube配,不关心怎么算的。 最后来个板子的靓照。
|
微信公众号
手机版
sdram 的速度是瓶颈。