# DMA goes wrong when I send the data above some specific range

**URL:** <https://discuss.pynq.io/t/dma-goes-wrong-when-i-send-the-data-above-some-specific-range/2305>\
**Category:** Support\
**Created:** [February 8, 2021, 7:05am UTC](https://discuss.pynq.io/t/dma-goes-wrong-when-i-send-the-data-above-some-specific-range/2305 "2021-02-08T07:05:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![leonard](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/leonard/32/1765_2.png) [@leonard](https://discuss.pynq.io/u/leonard)\
**Post date:** [February 8, 2021, 7:05am UTC](https://discuss.pynq.io/t/dma-goes-wrong-when-i-send-the-data-above-some-specific-range/2305/1 "2021-02-08T07:05:41Z")

</div>

Hello!

information  
board : pynq-z2  
version : v2.5

I try to modify the DMA tutorial from the website below:

> **[GitHub - Xilinx/PYNQ\_Workshop](https://github.com/Xilinx/PYNQ_Workshop)**
>
> Contribute to Xilinx/PYNQ\_Workshop development by creating an account on GitHub.

What I want to do is make a 3\*3 convolution in PL and use DMA to send data between PS and PL.  
My design is setup as below:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/1/1d969d5b54eedd2e99726e692c67877edcce1859.png)

When I send the data below some specific range, the design works correct. When i send above the specific range, the input data is fine at the first time but missing some value when I run again. The DMA stuck at sendchannel when i re-run many time.

Do I setup wrong or i should re-design my convolution? It seems to work well if the input data is within the range.

---

<div class="post-metadata">

**Author:** ![marioruiz](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/marioruiz/32/2177_2.png) [@marioruiz](https://discuss.pynq.io/u/marioruiz)\
**Post date:** [February 8, 2021, 6:21pm UTC](https://discuss.pynq.io/t/dma-goes-wrong-when-i-send-the-data-above-some-specific-range/2305/2 "2021-02-08T18:21:01Z")

</div>

Hi,

What do you mean by range?

I see that your kernel is an RTL kernel, most of the times the DMA related issues are because tlast is not handled properly.  
If this is the case, you need to post your question in the Xilinx forums, as this is not really related to pynq.

Mario

---

<div class="post-metadata">

**Author:** ![leonard](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/leonard/32/1765_2.png) [@leonard](https://discuss.pynq.io/u/leonard)\
**Post date:** [February 9, 2021, 4:19am UTC](https://discuss.pynq.io/t/dma-goes-wrong-when-i-send-the-data-above-some-specific-range/2305/3 "2021-02-09T04:19:02Z")

</div>

Hi, thanks to your reply!  
I’m not sure the problem is the tlast or not. I put my design in the middle of the FIFO and the FIFO depth is 1024. When I try to get the 1031 results from output buffer, the DMA failed. I have tried to increase the output FIFO depth to 2048, it can work but I don’t understand why.

---

<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:** [February 9, 2021, 7:43am UTC](https://discuss.pynq.io/t/dma-goes-wrong-when-i-send-the-data-above-some-specific-range/2305/4 "2021-02-09T07:43:56Z")

</div>

It would help if you could post your code.  
You may have a race condition. Are you using a dma.recvchannel.`wait`() ?  
[https://pynq.readthedocs.io/en/v2.6.1/pynq\_libraries/dma.html](https://pynq.readthedocs.io/en/v2.6.1/pynq_libraries/dma.html)

Cathal

---

<div class="post-metadata">

**Author:** ![leonard](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/leonard/32/1765_2.png) [@leonard](https://discuss.pynq.io/u/leonard)\
**Post date:** [February 9, 2021, 8:10am UTC](https://discuss.pynq.io/t/dma-goes-wrong-when-i-send-the-data-above-some-specific-range/2305/5 "2021-02-09T08:10:52Z")

</div>

Hi, thanks to your reply!  
yes, I am using a dma.recvchannel.wait().  
below is my code:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/5/553bd57d7a3447c209d6cf8d3685cbcc5ac4d1f1.png)

If I tried to get 1031 output from buffer, the DMA failed when I transfer data few times.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/pynq1/original/2X/c/c3329f5621dcd96dc289e873d7deac291bb0fab4.png)

Are there something I need to understand or something I should be careful?

---

<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:** [February 9, 2021, 5:16pm UTC](https://discuss.pynq.io/t/dma-goes-wrong-when-i-send-the-data-above-some-specific-range/2305/6 "2021-02-09T17:16:20Z")

</div>

Are you sure you are sending/receiving the right amounts of data?  
It looks like you are sending more data than you receive. If the IP produces the same amount of data as it consumes, then this is your issue. You will eventually reach deadlock.

You could check this quickly by trying to increase the size, or do some extra transfers on the recv DMA.

I looks like you are executing the same cells multiple times and out-of-order so it is difficult to track how exactly you are executing your code. It may help if you can show more clearly how your code executes.

Cathal

---

<div class="post-metadata">

**Author:** ![leonard](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/leonard/32/1765_2.png) [@leonard](https://discuss.pynq.io/u/leonard)\
**Post date:** [February 10, 2021, 3:07am UTC](https://discuss.pynq.io/t/dma-goes-wrong-when-i-send-the-data-above-some-specific-range/2305/7 "2021-02-10T03:07:38Z")

</div>

Hi! Thanks for your reply!  
I try to design a 3\*3 convolution IP, so I will send more data than I receive.

I execute the first four cells once and then run the last cell multiple times.

---

<div class="post-metadata">

**Author:** ![haipnh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/haipnh/32/4439_2.png) [@haipnh](https://discuss.pynq.io/u/haipnh)\
**Post date:** [April 27, 2022, 4:22am UTC](https://discuss.pynq.io/t/dma-goes-wrong-when-i-send-the-data-above-some-specific-range/2305/8 "2022-04-27T04:22:03Z")

</div>

Hi @leonard ,

I have the same problem with dma.sendchannel.wait(). Was your problem solved?
