Question
Problem with DCMI FRAME interrupt ?
Posted on July 22, 2014 at 19:02
Hullo guys , I 'm trying to get my OV7670 cam working with STM32F207zg , and I have set up all required configurations , I want to get snapshot , transfer the frame to external SRAM , but the FRAME interrupt is never generated , while LINE interrupt is working fine , also the DMA flags r not set , HC/TC/ or even FIFO error , here is my code ,
// Enable the Clck of the DCMI module RCC_AHB2PeriphClockCmd (RCC_AHB2Periph_DCMI , ENABLE); // Reset the DCMI Registers RCC_AHB2PeriphResetCmd(RCC_AHB2Periph_DCMI, ENABLE); RCC_AHB2PeriphResetCmd(RCC_AHB2Periph_DCMI, DISABLE); // // Configure the DCMI DCMI_Struct.DCMI_CaptureMode=DCMI_CaptureMode_SnapShot; DCMI_Struct.DCMI_CaptureRate=DCMI_CaptureRate_All_Frame; DCMI_Struct.DCMI_ExtendedDataMode=DCMI_ExtendedDataMode_8b; DCMI_Struct.DCMI_HSPolarity=DCMI_HSPolarity_Low; DCMI_Struct.DCMI_PCKPolarity=DCMI_PCKPolarity_Rising; DCMI_Struct.DCMI_VSPolarity=DCMI_VSPolarity_High ; DCMI_Struct.DCMI_SynchroMode=DCMI_SynchroMode_Hardware; DCMI_Init(&DCMI_Struct); // Enable the DCMI Interrupts DCMI_ITConfig(DCMI_IT_VSYNC, ENABLE); DCMI_ITConfig(DCMI_IT_LINE, ENABLE); DCMI_ITConfig(DCMI_IT_FRAME, ENABLE); DCMI_ITConfig(DCMI_IT_ERR, ENABLE); // // // Enable the NVIC for the DCMI NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); NVIC_DCMI.NVIC_IRQChannel=DCMI_IRQn; NVIC_DCMI.NVIC_IRQChannelCmd=ENABLE; NVIC_DCMI.NVIC_IRQChannelPreemptionPriority=1; NVIC_DCMI.NVIC_IRQChannelSubPriority=1; NVIC_Init(&NVIC_DCMI); // // Enable NVIC for DMA2 , Stream 1 NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); NVIC_DCMI.NVIC_IRQChannel=DMA2_Stream1_IRQn; NVIC_DCMI.NVIC_IRQChannelCmd=ENABLE; NVIC_DCMI.NVIC_IRQChannelPreemptionPriority=0; NVIC_DCMI.NVIC_IRQChannelSubPriority=1; NVIC_Init(&NVIC_DCMI); // // // Enable DMA2 Clock RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE); // Configure the DMA DMA_DCMI.DMA_Channel = DMA_Channel_1; DMA_DCMI.DMA_PeripheralBaseAddr = DCMI_DR_ADDRESS; // (0x50050028) DMA_DCMI.DMA_Memory0BaseAddr = 0x64000000; // Address of external SRAM DMA_DCMI.DMA_DIR = DMA_DIR_PeripheralToMemory; DMA_DCMI.DMA_BufferSize = 640*480*2/4; DMA_DCMI.DMA_PeripheralInc = DMA_PeripheralInc_Disable; DMA_DCMI.DMA_MemoryInc = DMA_MemoryInc_Enable; DMA_DCMI.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word; DMA_DCMI.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord; DMA_DCMI.DMA_Mode = DMA_Mode_Normal; DMA_DCMI.DMA_Priority = DMA_Priority_High; DMA_DCMI.DMA_FIFOMode = DMA_FIFOMode_Enable; DMA_DCMI.DMA_FIFOThreshold = DMA_FIFOThreshold_Full; DMA_DCMI.DMA_MemoryBurst = DMA_MemoryBurst_Single; DMA_DCMI.DMA_PeripheralBurst = DMA_PeripheralBurst_Single; DMA_Init(DMA2_Stream1, &DMA_DCMI); DMA_ITConfig(DMA2_Stream1 , DMA_IT_TC , ENABLE); DMA_ITConfig(DMA2_Stream1 , DMA_IT_FE , ENABLE); // Enable the Capture mode DCMI_Cmd(ENABLE); DCMI_CaptureCmd(ENABLE); DMA_Cmd(DMA2_Stream1, ENABLE); // // Any ideas ?