# Transfer image through DMA

**URL:** <https://discuss.pynq.io/t/transfer-image-through-dma/6499>\
**Category:** Support\
**Created:** [December 30, 2023, 3:06pm UTC](https://discuss.pynq.io/t/transfer-image-through-dma/6499 "2023-12-30T15:06:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![srijith.krishnan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/srijith.krishnan/32/5515_2.png) [@srijith.krishnan](https://discuss.pynq.io/u/srijith.krishnan)\
**Post date:** [December 30, 2023, 3:06pm UTC](https://discuss.pynq.io/t/transfer-image-through-dma/6499/1 "2023-12-30T15:06:49Z")

</div>

Hi All,

I am using PYNQ Z2 v2.6 for accelerating some image processing algorithm.

I have created the IP using Vitis HLS and I also simulated the C++ code and it was working as expected. Now after I moved the complete design into PYNQ, I am trying to pass the image input from the PL to PS.

I am passing the input through a DMA ip from the PS to my custom IP but I am not understanding how to pass the whole image. The width of buffer length register is set to 24 bits. I was initially passing the whole image using a buffer then I realized that the buffer width is just 24 bits… So I am thinking to pass pixel by pixel… The input image will be RGB and the output will be single channel from the IP…

Can someone help me in passing an image from the PL to PS?

Thanks in Advance  
Srijith Krishnan

---

<div class="post-metadata">

**Author:** ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)\
**Post date:** [January 1, 2024, 10:38am UTC](https://discuss.pynq.io/t/transfer-image-through-dma/6499/2 "2024-01-01T10:38:19Z")

</div>

There are some tutorials on using DMA starting here:

> [@Tutorial: PYNQ DMA (Part 1: Hardware design)](https://discuss.pynq.io/t/tutorial-pynq-dma-part-1-hardware-design/3133):
>
> PYNQ DMA tutorial (Part 1: Hardware design) This tutorial will show you how to use the Xilinx AXI DMA with PYNQ. It will cover adding the AXI DMA to a new Vivado hardware design and show how the DMA can be controlled from PYNQ. This tutorial is based on the v2.6 PYNQ image and will use Vivado 2020.1. If you are using a different PYNQ version you should be able to follow the same steps in this tutorial, but you should make sure you are using the supported version of Vivado for that PYNQ release. …

The width register determines the maximum number of bytes you can transfer. The max size is 2^(REGISTER WIDTH) or 67,108,863 bytes. If your image is bigger than this, you need to split it into sections to send it.

Cathal

---

<div class="post-metadata">

**Author:** ![srijith.krishnan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/srijith.krishnan/32/5515_2.png) [@srijith.krishnan](https://discuss.pynq.io/u/srijith.krishnan)\
**Post date:** [January 2, 2024, 4:57pm UTC](https://discuss.pynq.io/t/transfer-image-through-dma/6499/3 "2024-01-02T16:57:33Z")

</div>

Thank you @cathalmccabe for your response !

I wanted to know how will the data be received by my custom ip if I sending the image by sections? I am using the AXI streams for both input and output. The custom ip is designed by the understanding that the input AXI stream will be passing the complete image pixels and this AXI is then converted into a MAT and that MAT is used for processing. After processing the MAT is converted back into the AXI and send back.

Therefore if the image is to sent by sections then will I have to make changes in my custom IP?
