2020-04-28 06:52 PM
Hi, any reply is greatly appreciated.
I intend to interface ov7670 with my nucleo board for a qvga with yuv422. To get 30 frames per second ,the pclk must be set to 24Mhz(according to the data sheet). What this means is that each byte is received from the parallel interface of the camera module at the rate of 24Mhz.( This is true irrespective of the resolution format i.e vga,qvga etc). If I need to transmit bytes over uart as and when they're received from ov7670, to prevent any overrun errors,the uart baud rate must be greater than 24M frames (frame as in 8data bits and 1 start and stop bits)per second ( this is not possible!!!). Am I right in my thinking?
2020-04-28 07:08 PM
Your math is correct. UART is not meant for high-speed communications. You'll need something different.
Photo/video is very bandwidth intensive and typically uses a parallel interface. Think 8 data lines running at 24MHz. That transfers 24MB per second.
SPI or QUADSPI are high-speed interfaces you could use instead.
2020-04-28 07:18 PM
Thank you for the confirmation, but I see numerous examples where people have used a Uart for the same(I wonder how they're ably to achieve this!!!).
One such example I saw is on the following link.( Where the author has used a 3Mbps baud using pclk of 24Mhz to transmit a qcif image with yuv)
http://embeddedprogrammer.blogspot.com/2012/07/hacking-ov7670-camera-module-sccb-cheat.html?m=1
2020-04-28 07:23 PM
> but I see numerous examples where people have used a Uart for the same
Your OP suggested running UART at 24M frames/sec, so 240 Mbaud. This is not tenable. The link you show runs at 3Mbaud, which is doable. But they're not transferring a 640x480 image at 30 frames per second.
> however I was receiving 174 x 144 pixels instead of 176 x 144. Color format was the default YCbCr422. One of every six frames was sent to a PC using a UART communication at 3 Mbps.
So they're transferring 174x144 pixels at 6fps. Quite a bit different from your original post. If 174x144 at 6fps fits your requirements, UART can work.
2020-04-28 07:35 PM
> So they're transferring 174x144 pixels at 6fps.
I'm sorry, I don't understand the above statement because if pclk is 24Mhz ,consecutive bytes belonging to a line will arrive on the parallel interface of ov7670 at 24Mhz( when href is high). Hence they'll have to be again transmitted over uart at 24Mbaud.
2020-04-28 07:39 PM
> I'm sorry, I don't understand the above statement
That's what it says in the link you provided. I quoted it.
> Hence they'll have to be again transmitted over uart at 24Mbaud.
They don't have to do anything. They're free to downsample or discard frames however they see fit prior to sending over UART. Sounds like they are downsampling in both resolution and frame rate. There is no reason your incoming data clock needs to match the outgoing data clock.
2020-04-28 08:15 PM
> There is no reason your incoming data clock needs to match the outgoing data clock
But if the rate at which bytes of a line arrive on the parallel interface is higher that the Uart transmission rate, this will again cause overruns(which should not be allowed).
I also wanted to conform about the QCIF timing diagram from datasheet(shown below). The ON time of the HREF for both vga and QCIF is shown as 640tp (tp=2tpclk). So does that mean each line of QCIF (174x2 bytes) take 640tp seconds? So in that case, bytes of a QCIF line arrive at the rate of 6.66Mhz (when HREF is high) and not at 24Mhz?