求DCMI的正确配置;我以下的配置问什么不对啊!数据时TVP5150传送输入的!!求高手!!
//DMA配置
DMA_InitTypeDef DMA_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2 , ENABLE);
DMA_DeInit(DMA2_Stream1);
while (DMA_GetCmdStatus(DMA2_Stream1) != DISABLE)
{
}
DMA_InitStructure.DMA_Channel = DMA_Channel_1; //选择DMA通道
DMA_InitStructure.DMA_PeripheralBaseAddr = DCMI_BASE; //DMA选择外设基址
DMA_InitStructure.DMA_Memory0BaseAddr = (u32)&video_dma_buf[0]; //DMA数据传入内存的基址
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory; //外设到存储器
DMA_InitStructure.DMA_BufferSize =38400; //空间大小 传送最大数据空间
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable; //外设递增不使能
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable; //内存递增使能
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; //数据位 8位
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; //内存数据
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
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);
DMA_ITConfig(DMA2_Stream1,DMA_IT_TC,ENABLE); //开中断
DMA_Cmd(DMA2_Stream1, ENABLE);
//DCMI配置
DCMI_InitTypeDef DCMI_InitStructure;
RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_DCMI , ENABLE);
DCMI_InitStructure.DCMI_CaptureMode = DCMI_CaptureMode_Continuous; //利用DMA传输数据
DCMI_InitStructure.DCMI_SynchroMode = DCMI_SynchroMode_Embedded; //嵌入式同步数据采集同步数据流中嵌入同步码
DCMI_InitStructure.DCMI_PCKPolarity = DCMI_PCKPolarity_Rising; //像素时钟上升沿触发
DCMI_InitStructure.DCMI_VSPolarity = DCMI_VSPolarity_High;
DCMI_InitStructure.DCMI_HSPolarity = DCMI_HSPolarity_High; //行活跃高
DCMI_InitStructure.DCMI_CaptureRate = DCMI_CaptureRate_1of4_Frame; //捕获所有1/4数据
DCMI_InitStructure.DCMI_ExtendedDataMode = DCMI_ExtendedDataMode_8b; //8位数据
DCMI_Init(&DCMI_InitStructure);
//TVP5150寄存器配置值
{ /* 0x00 1*/
0x00,0x00 //视频输入源选择寄存器
},
{ /* 0x01 2*/
0x01,0x15 //模拟通道控制寄存器
},
{ /* 0x02 3*/
0x02,0x00 //操作模式控制寄存器
},
{ /* 0x03 4*/
0x03,0x7f //杂项控制寄存器 //0d
},
{ /* 0x04 5*/
0x04,0xc0
},
{ /* 0x06 6*/
0x06,0x10
},
{ /* 0x07 7*/
0x07,0x40
},
{ /* 0x08 8*/
0x08,0x00
},
{ /* 0x09 9*/
0x09,0x80
},
{ /* 0x0a 10*/
0x0a,0x80
},
{ /* 0x0b 11*/
0x0b,0x00
},
{ /* 0x0c 12*/
0x0c,0x80
},
{ /* 0x0d 13*/
0x0d,0x47
},
{ /* 0x0e 14*/
0x0e,0x00
},
{ /* 0x0f 15*/
0x0f,0x08 //0x08
},
{ /* 0x11 16*/
0x11,0x00
},
{ /* 0x12 17*/
0x12,0x00
},
{ /* 0x13 18*/
0x13,0x00
},
{ /* 0x14 19*/
0x14,0x00
},
{ /* 0x15 20*/
0x15,0x01
},
{ /* 0x16 21*/
0x16,0x80
},
{ /* 0x18 22*/
0x18,0x00
},
{ /* 0x19 23*/
0x19,0x00
},
{ /* 0x1a 24*/
0x1a,0x0c
},
{ /* 0x1b 25*/
0x1b,0x14
},
{ /* 0x1c 26*/
0x1c,0x00
},
{ /* 0x1d 27*/
0x1d,0x00
},
{ /* 0x1e 28*/
0x1e,0x00
},
{ /* 0x28 29*/
0x28,0x00
},
{ /* 0x2e 30*/
0x2e,0x0f
},
{ /* 0x2f 31*/
0x2f,0x01
},
{ /* 0xbb 32*/
0xbb,0x00
},
{ /* 0xc0 33*/
0xc0,0x00
},
{ /* 0xc1 34*/
0xc1,0x00
},
{ /* 0xc2 35*/
0xc2,0x04
},
{ /* 0xc8 36*/
0xc8,0x80
},
{ /* 0xc9 37*/
0xc9,0x00
},
{ /* 0xca 38*/
0xca,0x00
},
{ /* 0xcb 39*/
0xcb,0x4e
},
{ /* 0xcc 40*/
0xcc,0x00
},
{ /* 0xcd 41*/
0xcd,0x01
},
{ /* 0xcf 42*/
0xcf,0x00
},
{ /* 0xd0 43*/
0xd0,0x00
},
{ /* 0xfc 44*/
0xfc,0x7f
}
|