8 years, 10 months ago.

Grab 8 bit Image data

Hi,

I currently working on a project which require KL25Z to grab 8 bit image out of OV6620. The method i used was using digital read and interupt which caused pixel skipping due to slow digital read speed.

DMA seems to be potential solution for me, could you guide me on how do i grab a 8 bit data from 8 digital port by parallel?

Thanks in advance.

Question relating to:

DMA library for the KL25Z DMA, KL25z

1 Answer

8 years, 10 months ago.

This is probably more for the forum, since this won't be a single answer most likely. What does your system need to do exactly? Grab 8-bit data apparantly, but where to? RAM memory? How much data needs to be obtained, and at which rate? Is there a clock signal coming from the OV6620 or is one going to it?

Hi,

My application would be using KL25Z inferfacing with OV6620 with 8 digital pins and image process every frame to drive a autonomous car. I wish to get at least 1 FPS including the image process time with resolution at least 128 x 100 BW image. and yes there is pixel clock at 8.8Mhz coming out from OV6620. Grab data to RAM would be more efficient right?

posted by CHIAM DAR HUNG 14 Jan 2016

And every cycle of the pixel clock has another byte you can read? Then you can read the whole thing in <1ms, another option would be simply using a blocking piece of code (so not using interrupts) to read it. The required time for that is so much shorter than your 1 fps requirement that it is not really a problem.

posted by Erik - 14 Jan 2016

Yes each pixel clock will have a byte to read. The issue now is if I use PortIn method, my data is loss (suspect low digital grab speed), not so badly as the image is still usable, but the edges is ladder-ish.

By the way, what do you mean by blocking piece of code? Do you mind tell me more?

Thanks a lot for help

posted by CHIAM DAR HUNG 14 Jan 2016

By blocking I mean that the MCU is only working on that piece of code. So if you use interrupts the MCU can be doing other stuff at the same time, with blocking code you purely let it read the Port when an edge of the pixel clock is detected. Using FastIO to read the clock signal can speed up your code.

posted by Erik - 15 Jan 2016

Hi, do you mind telling me how is your blocking code? Not so sure i have come across with that term. Will definately try your method and see the result!

Thanks

posted by CHIAM DAR HUNG 16 Jan 2016

Pseudo code (also you can google the term):

while(clk_pin.read() == 0);
memoryarray[i] = datapins.read();
while(clk_pin.read() == 1);

Something like that will read the datapins everytime your clk_pin is not low anymore.

posted by Erik - 16 Jan 2016

oh, but unfortuntely this method is what i am using now to grab the data and it cause data loss, hence i got like 50% pixel loss

posted by CHIAM DAR HUNG 16 Jan 2016