AnsweredAssumed Answered

Can STM32f4 read data from Ov7670 camera (no FIFO) without using DCMI module

Question asked by moodaeng on Jul 18, 2012
Latest reply on Jul 18, 2012 by Clive One
Hi there,
       I tried to use my STM32f4 Discovery (164MHz) to read data from OV7676 camera (No FIFO) without using DCMI module. I just used normal gpio pins to read 8-bit data from the camera along with VSYNC, HREF and PCLK lines. 
      I just started to see how the output signals look like.  When VSYNC line went low, I set one pin as 100MHZ input to count the number of HREF pulses and print it out via virtual com port to my pc. The number of HREF supposes to be 480 in every VSYNC line goes low. However sometime I get 479 or 478, which mean that 1 or 2 rows of Horizonal lines are missing.  I am not sure the problem is from my code or the limitation or the chip.

Here is the code that I wrote to count the number of row that transmitting from OV7670

int row_count;
 
void camera_capture()
{
 
        while( 1 )
        {
                row_count = 0;
 
                //vsync line is PB.11
                while (GPIO_ReadInputDataBit(GPIOB,  GPIO_Pin_11) == Bit_RESET);
                //vsync inactive
                while (GPIO_ReadInputDataBit(GPIOB,  GPIO_Pin_11) == Bit_SET );
 
 
                // //wait util VSYNC is low(active)
                while (GPIO_ReadInputDataBit(GPIOB,  GPIO_Pin_11) == Bit_RESET )
                {
                
                        //wait util HREF is high (active)   HREF = PB.10
                        while (GPIO_ReadInputDataBit(GPIOB,  GPIO_Pin_10) == Bit_SET )
                        {
                                row_count++;
                                while(GPIO_ReadInputDataBit(GPIOB,  GPIO_Pin_10) == Bit_SET ); //wait here until href is low
                        }
                
                }
 
                printf("#row: %d ", row_count); //give result 478, 479, 480   //note: I set output from camera 640x480
        }
 
}

Outcomes