Timing Issue while Interfacing Camera (OV7670)

Hello,

I'm working on a mechatronics project for school using the Arduino Uno and OV7670. Before I even attempt to collect data from the camera, I'm looking for consistency in timing events, such as PCLK cycling a consistent number of times before HREF goes low or VSYNC goes high. I'm getting erratic results for this and can't seem to pinpoint why.

I've come up with a guess for why this is occuring:

I've checked PCLK with an oscilloscope, and it does indeed cycle at 10 MHz. Since the Arduino Uno uses a 16 MHz clock, I was thinking perhaps 10 MHz was too fast and therefore I'm not detecting cycles somewhere in between. I'm not sure how to rectify/test for this problem. I'm also wondering if the code I've used to assess the state of PCLK and VSYNC is too lengthy, and there's too many instructions so that the value of PCLK is not checked frequently enough, and thus cycles are missing in between.

If anyone has any experience or advice to contribute to this project, I'd greatly appreciate it. Thanks in advance for the help!

Some resources I've used:
The data sheet for the OV7670
Helpful instructions on getting started with/understanding the OV7670

There is an excruciatingly long thread on this topic, it may or may not help. I would read the first page and then jump to towards the end of the thread, to where some people had some success. Not many people got it to work. There is still some activity there.

http://forum.arduino.cc/index.php?topic=159557.0

The simple examples given do not setup the XCLK signal into the camera, but sounds like you already have it. You have an early version of the data sheet [look for version 1.4], and the link you referenced relates to using the STM32 and not arduino.

10 Mhz is FAR TOO FAST for the rduino to keep up. You have to set the registers to divide down PCLK by 4 times at least. An UNO will be a problem, because it doesn't have enough internal RAM to really buffer much. Take a look at the thread for more details - there are "many" issues.

First post - welcome - but if you're a beginner with Arduino, controlling OV7670 is a tough way to start. Good luck.