You are here

cannot run DMA2 after 52 times | Cypress Semiconductor

cannot run DMA2 after 52 times

Summary: 2 Replies, Latest post by dzonesasaki on 24 Mar 2016 06:01 PM PDT
Verified Answers: 1
Last post
Log in to post new comments.
dzonesasaki's picture
2 posts

I have a problem of DMA function on PSoC 5LP(CY8CKIT-050).
I'm trying to sample 2ch many a time using 2 SAR-ADCs and 2 DMAs.
But, 2nd DMA does not run after 52 times.

The solution seems to be the configuration of DMAs moved to out of loop and using only "CyDmaChEnable" in loop.
But I could not find this reason. 

The Attach is showing values of 52nd and 53rd. They will be same.


user_1377889's picture
9274 posts

Welcome in the forum, dzone!

Two things I can see.

1st: You call frequently DMA_Config() which allocates resources (DMA channels, TDs) but you never free those. When you declare the Channel and the TD as global, you might re-use them instead of freeing and re-allocate.

2nd: You did not get the error yet, but when you increase the optimization level your program will stall. Declare all global vars changed in an interrupt handler as "volatile" or they might get optimized-out of your while(!flag)Wait();



dzonesasaki's picture
2 posts

Many thanks Bob!

I can find the solution is using CyDmaTdFree everytime as you say.
And I had forgotten using volatile. You are great teacher!



Log in to post new comments.