ComputerNerd / ov7670-no-ram-arduino-uno

Allows you to use a non fifo ov7670 on the arudino uno without external spi ram like other examples. Sends the data to UART.
235 stars 111 forks source link

Datarate #10

Open abbanerjeersm opened 9 years ago

abbanerjeersm commented 9 years ago

Hi,

In your main.c, you poll PORT D2 for rising edge to collect the 8 bits of pixel data. This is your PCLK. This clock is running at 8 Mhz - so essentially you are producing 64 Mbits per second or 8 mega bytes per second. Your UART is 2 Mbps or 250 Kilo Bytes per second.

Everytime you push the data into UDR0 - it gets transmitted at a much slower pace. This should lead to some sort of missing bytes or data buffer overrun but I guess it dosent.

So in summary, given your PCLK produces roughly 1 byte at 8 Mhz rate, and your serial connection is 250 KB/s , why dosent this mismatch lead to failure of transmission ?

As your code works, obviously I am missing something. Can you please enlighten me ?

seewseew commented 9 years ago

I've try with your code already. VGA (640 X 480) and bayer RGB. USART speed is 9600 Bps. I've set Arduino to capture only 1 snapshot. OV7670 can transfer data to Arduino properly BUT many data lost. Every time that I reset It show "RDY" in the serial monitor and followed by 1,920 bytes of data.

seewseew commented 9 years ago

I forgot to comment some details. I use 2 of 10K resisters for I2C on both SIOC and SIOD as you mentioned in "Fritzing.org" project and 74LS shift level at XCLK to reduce from 5V to 3V.

dmmedia commented 9 years ago

@abbanerjeersm actually datarate is even less. 2Mbaud uses 10 bits per byte (1 start bit, 8 data bits and 1 stop bit), so actual rate is 2M / 10 = 200 KBps. But I suspect, that PCLK is not working at full 8 MHz. I think, but I haven't checked yet, that there is a divisor used and the PCLK is actually running at much lower speed.

badarineo commented 8 years ago

Hi, I've arduino nano connected to ov7670. I've similar problem while reading frames using simpleFrameGrabber application.

./grab 160 120 rgb565 2000000 /dev/ttyUSB0 0

.... I read "Frames per second = 0.007594" After some time I get a noisy image.Can anybody help me in this regard. Thanks,