cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
wespiard
Visitor
Visitor
559 Views
Registered: ‎09-17-2019

Reading Image Frame Stored using VDMA (Digilient Zybo Z7-10, PCAM 5C)

Jump to solution

I have a Digilent Zybo Z7-10 board, and I am trying to read a single frame from the Digilent Pcam 5C camera to process. I would like to simply use the SDK, without Petalinux if possible.  I don't necessarily NEED to use OpenCV, but I will if I end up needing to use Petalinux.

Here is a link to Digilent's example using v2019.1 of Vivado/SDK: https://github.com/Digilent/Zybo-Z7-20-pcam-5c

I have gotten this demo on the Z7-10 working, even though it was made for the Z7-20. I will eventually strip out the HDMI output portion, but just initially kept it to make sure the design works, which it does (outputs camera video to HDMI monitor). 

I'm not really asking for a full tutorial on how to get it working, but a point in the right direction would be nice. 

So far, I have determined there are three frame buffers for my setup, and they are roughly at address 0x0A000000, plus whatever the offset is for each frame depending on my chosen resolution. I have tried reading one of these frames in a loop and outputting the hex values with xil_printf(), just to get an idea and I'm getting 0xAEAEAEAE for the first ~0x1000 addresses, and then some random data that may be valid pixel data but I'm not sure how to save it to actually verify that it is image data. 

I am also assuming this is a bad way of doing it since the frames are probably constantly being overwritten. It would be nice if there was an easy way to store one frame at a time and read it after an interrupt occurs or something like that. 

I can try to answer any questions, as I'm sure I left a lot out. 

Thank you!

0 Kudos
1 Solution

Accepted Solutions
florentw
Moderator
Moderator
503 Views
Registered: ‎11-09-2015

HI @wespiard 

The following article might help with what you are trying to achieve:
https://forums.xilinx.com/t5/Xcell-Daily-Blog-Archived/Adam-Taylor-s-MicroZed-Chronicles-Part-228-Verifying-Video/ba-p/814813 


Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**

View solution in original post

7 Replies
florentw
Moderator
Moderator
504 Views
Registered: ‎11-09-2015

HI @wespiard 

The following article might help with what you are trying to achieve:
https://forums.xilinx.com/t5/Xcell-Daily-Blog-Archived/Adam-Taylor-s-MicroZed-Chronicles-Part-228-Verifying-Video/ba-p/814813 


Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**

View solution in original post

wespiard
Visitor
Visitor
472 Views
Registered: ‎09-17-2019

Thanks! This looks like what I have been trying to do, but more organized. I've even been using PuTTY, but didn't know it had that logging feature.

I'll give it a shot.

0 Kudos
wespiard
Visitor
Visitor
427 Views
Registered: ‎09-17-2019

This ended up working for a very basic test to verify the image. 

I couldn't find the code in the repository linked at the bottom of the article, but I was able to recreate some of it based on the screenshots of code provided. 

Also, the widget provided that converts from an ASCII file to a BMP file didn't work for me but I was able to make a simple Python script that runs pretty quickly to generate a BMP. 

I still have a lot of uncertainty as to whether or not the image I'm reading is actually a single frame, or if the frame buffer is being overwritten as I'm reading the pixels. 

If there is an interrupt signal for each frame being finished, and I could disable VDMA temporarily, read pixel data, re-enable it, or something like that I would be happy. 

0 Kudos
reaiken
Explorer
Explorer
417 Views
Registered: ‎07-18-2011

@wespiard 

The Video Frame Buffer Write and Video Frame Buffer Read IP will do what you want.

https://www.xilinx.com/support/documentation/ip_documentation/v_frmbuf/v2_2/pg278-v-frmbuf.pdf

These IP blocks write/read one frame and generate an interrupt when finished.   You can change the address for the next frame and restart the IP in the interrupt service routine, or in your case, you could set a flag indicating the frame write is finished so you can read it out in your main program. 

wespiard
Visitor
Visitor
384 Views
Registered: ‎09-17-2019

@reaiken Thank you! I will look into this next. 

Does this replace the VDMA I'm currently using? I've attached my block design based on the Digilent example I linked in the original post. I attached two images (one zoomed in more in case the other isn't legible). 

If so, would this prevent me from retaining the HDMI output? It is not required for my purposes but is nice for debugging. 

pcam_edmo.pngpcam_demo_2.png

0 Kudos
reaiken
Explorer
Explorer
349 Views
Registered: ‎07-18-2011

@wespiard 

Since you are using both the write and read sides of your VDMA, you would replace it with borh a Video Frame Buffer Read and a Video Frame Buffer Write IP block.   Everything else in your block would remain the same.

The VDMA automatically controls the frame synchronization to avoid reading the buffer you are currently writing.   

The Frame Buffer IPs require manually controlling the read and write buffer address selection in the interrupt service routines to accomplish frame synchronization by repeating or dropping a read frame if it would result in reading from the frame you are currently writing.

florentw
Moderator
Moderator
297 Views
Registered: ‎11-09-2015

Hi @wespiard and @reaiken 

Just a quick note that you can also reproduce a similar behaviour for the AXI VDMA. You can read / write only a single frame then stop.

I believe this is what the following example is doing:

https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/axivdma/examples/xaxivdma_example_intr.c

With that said, I would still recommend to go with the Video Frame buffer as this is the main behaviour for this IP


Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**