2020-05-04 12:08 AM
I have an OV7670 interfaced to a nucleo board.
Frame rate=10fps
Image format= qcif(174X144) ; YUV422(monochrome only)
Pixel clock =8Mhz
Successive bytes of a row(Line) ,arrive at the rate of 8M bytes/sec, which is too high to directly transfer the incoming bytes to UART.
So, i first store the frame in a buffer(174x144=26kB) in SRAM. Since each frame will remain in the buffer for 0.1seconds (10fps) before another frame starts to occupy the buffer, the UART baud must be such that the entire frame can be transmitted in less than 0.1seconds.
For a 3Mbps baud, it will approx take 0.083 seconds for frame transmission. so there wont be any data losses, but is there is a chance that a stale data is sent over UART any time during the frame transmission?
2020-05-04 04:03 AM
You must implement synchronization to camera frames and probably introduce some protocol to somehow signal start of a frame to a listening device.
By the way, because of start and stop bits in USART protocol, from 10 bits on a line only 8 are data bits. Therefore one frame will take 83,52 ms.
2020-05-04 06:57 AM
In addition to what Piranha said:
> is there is a chance that a stale data is sent over UART any time during the frame transmission?
The UART stream is continuous (start bit immediately after stop bit) as long as you feed bytes to the UART in time (such that TXE is never asserted).
2020-05-04 07:23 AM
"By the way, because of start and stop bits in USART protocol, from 10 bits on a line only 8 are data bits. Therefore one frame will take 83,52 ms."
@Piranha Yes, I did not include time taken to transmit control bits in each USART frame, thank you for the correction.
2020-05-04 07:25 AM
"The UART stream is continuous (start bit immediately after stop bit) as long as you feed bytes to the UART in time"
@TDK ,yes, the uart stream is continuous as long as you are able to feed bytes to the uart in time.
2020-05-04 07:27 AM
@Piranha ,@TDK
please consider the below scenario(which is the reason i ask this question)
From the timing diagrams,the camera doesn't spit out rows of an image in quick succession ie, there is time gap b/w the arrival of different rows(bytes of a single row arrive in quick succession though!). So just in case all bytes of a row were done transmitting by uart from buffer and the 2nd row hasn't arrived into the buffer yet(maybe because of a large time gap between row0 and row1), then the uart will surely begin transmitting some garbage values or values of a previous frame that are already in the buffer .
now, this might be possible if
the time in between the arrival of consecutive rows is too large(i'm not sure
this will certainly happen, but if it does, then i have a jumbled up image).
2020-05-04 07:30 AM
> then the uart will surely begin transmitting some garbage values or values of a previous frame that are already in the buffer .
Why would it do so? The UART will only transmit what you tell it to, otherwise it will be idle.
Sure, if you tell it to transmit the entire frame, and the frame is filled with garbage values, then it may transmit garbage. So don't do that. Transmit only after you receive the data.
2020-05-04 07:47 AM
"Why would it do so? The UART will only transmit what you tell it to, otherwise it will be idle".
Apologies for not mentioning earlier, I have the following plan in mind
step 1.ARM samples the arriving bytes from camera and places them into the buffer(not using DCMI)
step 2.ARM will trigger DMA transfer ,soon after it places the first byte in buffer(with the dma transfer length set to one frame length)
Note- ARM will perform step 2(ie trigger dma transfer soon after placing first byte in buffer), for every frame .
I think my concern about garbage values being sent is valid then?
Could you suggest a better approach ?