2012-07-17 07:37 PM
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 OV7670int 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
}
}
#stm32f4-ov7670-gpio-input-camera
2012-07-18 05:50 AM
The speed for a GPIO pin relates to it's output function and slew rate control.
What is the frequency and pulse width of the signals you are following, can you review the GPIO pin states by looking at the registers directly. That would be more efficient if the timing is tight.