# FIFO using PYNQ DMA

**URL:** <https://discuss.pynq.io/t/fifo-using-pynq-dma/528>\
**Category:** Support\
**Created:** [October 3, 2019, 6:09pm UTC](https://discuss.pynq.io/t/fifo-using-pynq-dma/528 "2019-10-03T18:09:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jia-Ming\_Lin](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/jia-ming_lin/32/338_2.png) [@Jia-Ming\_Lin](https://discuss.pynq.io/u/Jia-Ming_Lin)\
**Post date:** [October 3, 2019, 6:09pm UTC](https://discuss.pynq.io/t/fifo-using-pynq-dma/528/1 "2019-10-03T18:09:13Z")

</div>

I am trying to understand how to use DMA on PYNQ, and I create an FIFO example by following the article, [Using the AXI DMA in Vivado](http://www.fpgadeveloper.com/2014/08/using-the-axi-dma-in-vivado.html).  
I am trying to run this design on PYNQ Python API.

My block design is shown as following picture

 ![Screenshot%20from%202019-10-04%2001-40-17](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/78e132daa6bb92e54b5bd29ad9e8bf6a1237dee7.png)

However, the values of output array buffer is stile all zero, after I call “dma.recvchannel.transfer(output\_buffer)”.  
And if I call sendchannel.wait() and recvchannel.wait(), the system is stuck.  
So, my question is how to using DMA in this FIFO Example?

---

<div class="post-metadata">

**Author:** ![Jia-Ming\_Lin](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/jia-ming_lin/32/338_2.png) [@Jia-Ming\_Lin](https://discuss.pynq.io/u/Jia-Ming_Lin)\
**Post date:** [October 3, 2019, 6:34pm UTC](https://discuss.pynq.io/t/fifo-using-pynq-dma/528/2 "2019-10-03T18:34:06Z")

</div>

Here is my code,

 ![Screenshot%20from%202019-10-04%2001-55-47](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/56a9313c38301dc5c92f5e18bce2ca572fd48eae.png)

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [October 4, 2019, 5:20am UTC](https://discuss.pynq.io/t/fifo-using-pynq-dma/528/3 "2019-10-04T05:20:59Z")

</div>

Can you first try the design without the axi interrupt block? I would say start with the DMA without any interrupt output, then if it is working, connect the interrupt directly to the PS interrupt input.

---

<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:** [October 4, 2019, 6:34am UTC](https://discuss.pynq.io/t/fifo-using-pynq-dma/528/4 "2019-10-04T06:34:59Z")

</div>

In addition to Rock’s suggestion, the PYNQ AXI DMA class doesn’t currently support scatter gather. It looks like you have enabled this on your DMA IP. Can you try disable this?  
If it still isn’t working, can you post your DMA configuration settings?

Cathal

---

<div class="post-metadata">

**Author:** ![Jia-Ming\_Lin](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/jia-ming_lin/32/338_2.png) [@Jia-Ming\_Lin](https://discuss.pynq.io/u/Jia-Ming_Lin)\
**Post date:** [October 4, 2019, 8:09am UTC](https://discuss.pynq.io/t/fifo-using-pynq-dma/528/5 "2019-10-04T08:09:44Z")

</div>

Thank you for answering!!  
I have remove the AXI Interrupt block and disable the Scatter Gather. The DMA configuration is as following

 ![Screenshot%20from%202019-10-04%2015-45-22](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/ab6e1cae78ceea6ba3318fc87fd61a8b6e2f4ce4.png).  
And the Block Design  
 ![Screenshot%20from%202019-10-04%2015-48-04](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/53edbbceb9a9f2ce0c5dbc3166290d34e052137f.png) .

The problem now is, I can successfully download the bitstream file

```auto
ol = Overlay('/home/xilinx/jupyter_notebooks/JiaMing/DMA_lab1/FIFO/dma_fifo.bit')

```

, but the whole system is busy and stuck when I create the DMA object by

```auto
import pynq.lib.dma
dma_fifo = ol.axi_dma_0

```

Is there any suggestion? Thank you.

---

<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:** [October 4, 2019, 8:27am UTC](https://discuss.pynq.io/t/fifo-using-pynq-dma/528/6 "2019-10-04T08:27:55Z")

</div>

Which board and which version of PYNQ are you using?

Can you post all your code?  
Are you sure you updated the Tcl/HWH and copied both to the board/removed the old files?  
Did you power cycle your board (turn off, and on again)

I would also advise you set the “Width of Buffer length register” to the maximum 26.  
2^14 is 16384, the max size number of bytes data you can currently transfer.

Cathal

---

<div class="post-metadata">

**Author:** ![Jia-Ming\_Lin](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/jia-ming_lin/32/338_2.png) [@Jia-Ming\_Lin](https://discuss.pynq.io/u/Jia-Ming_Lin)\
**Post date:** [October 4, 2019, 9:43am UTC](https://discuss.pynq.io/t/fifo-using-pynq-dma/528/7 "2019-10-04T09:43:09Z")

</div>

I abandon the original project since it occasionally happens to “synthesis and implementation out-of-date” error. Then I created a new project from the .tcl file from previous project.  
Now my application works normally!!

To summarize this work with modifications from above suggestions:

1. I mainly follow "[Using the AXI DMA in Vivado](http://www.fpgadeveloper.com/2014/08/using-the-axi-dma-in-vivado.html)" to create the Block Diagram.
2. remove the interrupt module
3. disable DMA scatter-gather
4. set the “Width of Buffer length register” to maximum 26.

Then the Python code

 ![Screenshot%20from%202019-10-04%2017-52-59](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/1X/c53951a2a4ccbd3cd33dd6a9d0a36915ec7af6e1.png)  
Thanks for your helps!

---

<div class="post-metadata">

**Author:** ![FrankB](https://avatars.discourse-cdn.com/v4/letter/f/278dde/32.png) [@FrankB](https://discuss.pynq.io/u/FrankB)\
**Post date:** [July 10, 2020, 12:43pm UTC](https://discuss.pynq.io/t/fifo-using-pynq-dma/528/8 "2020-07-10T12:43:33Z")

</div>

Hi I have tried to remake your design to see if I get dma to work, however for me the axi\_dma block never turns up in the overlay. I get “AttributeError: Could not find IP or hierarchy axi\_dma\_datafifo in overlay” could you explain how you got this working?

my block design: [design.pdf](https://discuss.pynq.io/uploads/short-url/9JrCB42Op55Ufb8Hv0QF55lmywd.pdf) (80.6 KB)
