摄像头OV2460,输出800*600像素。
我现在用的是320*240像素,输出RGB565格式,配置DMA,DCMI_DMA_Init((u32)Bank1_SRAM3_ADDR,0,38400,DMA_MemoryDataSize_Word,DMA_MemoryInc_Enable );数据能够一次传输到SRAM,且数据正常,再传到LCD正常显示。
现在我要摄像头输出800*600像素,DMA一次可操作的数据长度最大65536也不够我的一帧图像数据。
求问怎么把一帧数据保存在SRAM。
我试过在DMA传输中断中改变缓存地址,但是数据错乱,(貌似是影响DMA速度,把DCMI的数据漏了)
有人说可以用双缓冲,但是不明白具体怎么做,在双缓冲里,把数据COPY出来,但是速度能跟的上么
有没有更好的方法,求告知
void DCMI_DMA_Init(u32 DMA_Memory0BaseAddr,u32 DMA_Memory1BaseAddr,u16 DMA_BufferSize,u32 DMA_MemoryDataSize,u32 DMA_MemoryInc)
{
DMA_InitTypeDef DMA_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2,ENABLE);//
DMA_DeInit(DMA2_Stream1);//μè′yDMA2_Stream1
while (DMA_GetCmdStatus(DMA2_Stream1) != DISABLE){}
DMA_InitStructure.DMA_Channel = DMA_Channel_1;
DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)&DCMI->DR;
DMA_InitStructure.DMA_Memory0BaseAddr = DMA_Memory0BaseAddr;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
DMA_InitStructure.DMA_BufferSize = DMA_BufferSize;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize;
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
DMA_Init(DMA2_Stream1, &DMA_InitStructure);//3õê¼»ˉDMA Stream
if(DMA_Memory1BaseAddr)
{
DMA_DoubleBufferModeCmd(DMA2_Stream1,ENABLE);
DMA_MemoryTargetConfig(DMA2_Stream1,DMA_Memory1BaseAddr,DMA_Memory_1);
DMA_ITConfig(DMA2_Stream1,DMA_IT_TC,ENABLE);
NVIC_InitStructure.NVIC_IRQChannel = DMA2_Stream1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority =0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
这样貌似不行
一周热门 更多>