大学生
最后登录1970-1-1
在线时间 小时
注册时间2017-9-18
|
本帖最后由 小希希爱自己 于 2018-5-30 11:11 编辑
DCMI配置如下所示:
void DCMI_Init(void)
{
__HAL_RCC_DCMI_CLK_ENABLE();
DCMI_Handle.Instance = DCMI;
DCMI_Handle.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;
DCMI_Handle.Init.PCKPolarity = DCMI_PCKPOLARITY_RISING;
DCMI_Handle.Init.VSPolarity = DCMI_VSPOLARITY_LOW;
DCMI_Handle.Init.HSPolarity = DCMI_HSPOLARITY_LOW;
DCMI_Handle.Init.CaptureRate = DCMI_CR_ALL_FRAME;
DCMI_Handle.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
HAL_DCMI_Init(&DCMI_Handle);
HAL_NVIC_SetPriority(DCMI_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DCMI_IRQn);
}
DMA配置如下:
void OV2640_DMA_Config(uint32_t DMA_Memory0BaseAddr,uint32_t DMA_BufferSize)
{
__HAL_RCC_DMA2_CLK_ENABLE();
__HAL_LINKDMA(&DCMI_Handle, DMA_Handle, DMA_Handle_dcmi);
DMA_Handle_dcmi.Instance = DMA2_Stream1;
DMA_Handle_dcmi.Init.Channel = DMA_CHANNEL_1;
DMA_Handle_dcmi.Init.Direction = DMA_PERIPH_TO_MEMORY;
DMA_Handle_dcmi.Init.PeriphInc = DMA_PINC_DISABLE;
DMA_Handle_dcmi.Init.MemInc = DMA_MINC_ENABLE;
DMA_Handle_dcmi.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
DMA_Handle_dcmi.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
DMA_Handle_dcmi.Init.Mode = DMA_CIRCULAR;
DMA_Handle_dcmi.Init.Priority = DMA_PRIORITY_HIGH;
DMA_Handle_dcmi.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
DMA_Handle_dcmi.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
DMA_Handle_dcmi.Init.MemBurst = DMA_MBURST_INC8;
DMA_Handle_dcmi.Init.PeriphBurst = DMA_PBURST_SINGLE;
HAL_DMA_Init(&DMA_Handle_dcmi);
HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);
HAL_DCMI_Start_DMA(&DCMI_Handle, DCMI_MODE_CONTINUOUS, (uint32_t)DMA_Memory0BaseAddr,DMA_BufferSize);
}
主函数调用
DCMI_Init()
OV2640_DMA_Config(LCD_FB_START_ADDRESS,LCD_GetXSize()*LCD_GetYSize()/2);
LCD_FB_START_ADDRESS为LCD显存首地址,LCD_GetXSize()*LCD_GetYSize()/2为像素个数
屏幕只显示一半是怎么回事啊??代码哪里出了问题??
|
-
|