ov7670图像问题

2019-07-21 02:36发布

我用ov7670  不带fifo  用dcmi接口    QVGA RGB565 测试SCCB完全没问题,但是图像一直是下图,到底哪出现问题了?麻烦各位大神们帮忙看一下
[mw_shl_code=c,true]void DCMI_DMA_Init(u32 DMA_Memory0BaseAddr,u16 DMA_BufferSize,u32 DMA_MemoryDataSize,u32 DMA_MemoryInc) { DMA_InitTypeDef DMA_InitStructure; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2,ENABLE);//DMA2?±?????? DMA_DeInit(DMA2_Stream1); while (DMA_GetCmdStatus(DMA2_Stream1) != DISABLE){}//????DMA2_Stream1?????? /* ???? DMA Stream */ DMA_InitStructure.DMA_Channel = DMA_Channel_1; //?¨??1 DCMI?¨?? DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)&DCMI->DR;//???è???·??CMI->DR DMA_InitStructure.DMA_Memory0BaseAddr = DMA_Memory0BaseAddr;//DMA ?????÷0???· 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;//???è?????¤??:32?? 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; //FIFO???? DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;//??????FIFO DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;//???è??·????????? DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;//?????÷??·????????? DMA_Init(DMA2_Stream1, &DMA_InitStructure);//??????DMA Stream } //DCMI?????? void My_DCMI_Init(void) { DCMI_InitTypeDef DCMI_InitStructure; RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_DCMI,ENABLE);//????DCMI?±?? GPIO_PinAFConfig(DCMI_HSYNC_PORT,DCMI_HSYNC_PinSource,GPIO_AF_DCMI); GPIO_PinAFConfig(DCMI_PCLK_PORT,DCMI_PCLK_PinSource,GPIO_AF_DCMI); GPIO_PinAFConfig(DCMI_VSYNC_PORT,DCMI_VSYNC_PinSource,GPIO_AF_DCMI); GPIO_PinAFConfig(DCMI_D0_PORT,DCMI_D0_PinSource,GPIO_AF_DCMI); GPIO_PinAFConfig(DCMI_D1_PORT,DCMI_D1_PinSource,GPIO_AF_DCMI); GPIO_PinAFConfig(DCMI_D2_PORT,DCMI_D2_PinSource,GPIO_AF_DCMI); GPIO_PinAFConfig(DCMI_D3_PORT,DCMI_D3_PinSource,GPIO_AF_DCMI); GPIO_PinAFConfig(DCMI_D4_PORT,DCMI_D4_PinSource,GPIO_AF_DCMI); GPIO_PinAFConfig(DCMI_D5_PORT,DCMI_D5_PinSource,GPIO_AF_DCMI); GPIO_PinAFConfig(DCMI_D6_PORT,DCMI_D6_PinSource,GPIO_AF_DCMI); GPIO_PinAFConfig(DCMI_D7_PORT,DCMI_D7_PinSource,GPIO_AF_DCMI); gpio_init(DCMI_HSYNC_PORT,DCMI_HSYNC_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(DCMI_PCLK_PORT,DCMI_PCLK_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(DCMI_VSYNC_PORT,DCMI_VSYNC_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(DCMI_D0_PORT,DCMI_D0_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(DCMI_D1_PORT,DCMI_D1_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(DCMI_D2_PORT,DCMI_D2_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(DCMI_D3_PORT,DCMI_D3_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(DCMI_D4_PORT,DCMI_D4_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(DCMI_D5_PORT,DCMI_D5_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(DCMI_D6_PORT,DCMI_D6_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(DCMI_D7_PORT,DCMI_D7_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); DCMI_DeInit();//???????????è?? DCMI_InitStructure.DCMI_CaptureMode=DCMI_CaptureMode_Continuous;//???????? DCMI_InitStructure.DCMI_CaptureRate=DCMI_CaptureRate_All_Frame;//???????? DCMI_InitStructure.DCMI_ExtendedDataMode= DCMI_ExtendedDataMode_8b;//8?????????? DCMI_InitStructure.DCMI_HSPolarity=DCMI_HSPolarity_High;//DCMI_HSPolarity_Low;//HSYNC ?????????§ DCMI_InitStructure.DCMI_PCKPolarity=DCMI_PCKPolarity_Falling;//DCMI_PCKPolarity_Rising;//PCLK ?????????§ DCMI_InitStructure.DCMI_SynchroMode= DCMI_SynchroMode_Hardware;//????????HSYNC,VSYNC DCMI_InitStructure.DCMI_VSPolarity=DCMI_VSPolarity_High;//DCMI_VSPolarity_Low;//VSYNC ?????????§ DCMI_Init(&DCMI_InitStructure); DCMI_ITConfig(DCMI_IT_FRAME,ENABLE);//?????????? DCMI_Cmd(ENABLE); //DCMI???? DCMI_DMA_Init((u32)&LCD->LCD_RAM,1,DMA_MemoryDataSize_HalfWord,DMA_MemoryInc_Disable); } //DCMI,???????? void DCMI_Start(void) { DMA_Cmd(DMA2_Stream1, ENABLE);//????DMA2,Stream1 DCMI_CaptureCmd(ENABLE);//DCMI???????? }[/mw_shl_code] [mw_shl_code=c,true]u8 OV7670_Init() { u8 temp; u16 i=0; GPIO_PinAFConfig(OV7670_XCLK_PORT, OV7670_XCLK_PinSource, GPIO_AF_MCO); gpio_init(OV7670_XCLK_PORT,OV7670_XCLK_Pin,GPIO_Mode_AF,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(OV7670_RESET_PORT,OV7670_RESET_Pin,GPIO_Mode_OUT,GPIO_Speed_100MHz,GPIO_OType_PP,GPIO_PuPd_UP); gpio_init(OV7670_PWON_PORT,OV7670_PWON_Pin,GPIO_Mode_OUT,GPIO_Speed_50MHz,GPIO_OType_PP,GPIO_PuPd_UP); // RCC_MCO1Config(RCC_MCO1Source_HSE, RCC_MCO1Div_1);//?????????è????8MHz RCC_MCO1Config(RCC_MCO1Source_PLLCLK, RCC_MCO1Div_4);//?????????è????8MHz My_DCMI_Init(); GPIO_ResetBits(OV7670_PWON_PORT, OV7670_PWON_Pin);//power on delay_ms(10); GPIO_ResetBits(OV7670_RESET_PORT, OV7670_RESET_Pin);//???? delay_ms(10); GPIO_SetBits(OV7670_RESET_PORT, OV7670_RESET_Pin);//?????á?? delay_ms(10);//?????á???ó??????>=2ms SCCB?????????????ú?? SCCB_Init(); //??????SCCB ??IO?? if(SCCB_WR_Reg(0x12,0x80))return 1; //?í????SCCB delay_ms(50); //?????ú?·???? temp=SCCB_RD_Reg(0x0b); //?ú?·??????±??? 73 if(temp!=0x73)return 2; temp=SCCB_RD_Reg(0x0a); //?ú?·??????±??? 76 if(temp!=0x76)return 2; //???????ò?? for(i=0;i<sizeof(ov7670_init_reg_tbl)/2;i++) { SCCB_WR_Reg(ov7670_init_reg_tbl[0],ov7670_init_reg_tbl[1]); delay_ms(2); } return 0; //ok }[/mw_shl_code]


友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。