Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > How to set DMA function in my project ?

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



How to set DMA function in my project ?
Moderator:
ANCY

Post Reply
Follow this topic



How to set DMA function in my project ?

jacktan posted on 21 Dec 2011 8:03 PM PST
Top Contributor
26 Forum Posts

hello:

        How to configurate the DMA in my project? because i want to disable the

DMA transmission once it finishes transferring the desired data,and i set a

DMADone_flag in my main.c process,but when i build the process,i can't see

the  DMADone_flag in project name.map document which disable my debug

processing?

 




Re: How to set DMA function in my project ?

H L posted on 22 Dec 2011 02:03 AM PST
Top Contributor
679 Forum Posts

 Upload your project so people here can help



Re: How to set DMA function in my project ?

hli posted on 22 Dec 2011 07:21 AM PST
Top Contributor
675 Forum Posts

Also, there is a great app note explaining DMA: http://www.cypress.com/?rID=37793 , and a video about it: https://www.youtube.com/watch?v=D1Gz17bPYm0 .



Re: How to set DMA function in my project ?

U2 posted on 22 Dec 2011 09:35 AM PST
Cypress Employee
589 Forum Posts

 The app note that is pointed out in the previous post should help.



Re: How to set DMA function in my project ?

jacktan posted on 22 Dec 2011 07:05 PM PST
Top Contributor
26 Forum Posts

Dear:

I konw the app notes in cypress website, and i also  studied the notes to guide my design ! But my problem is the

DMADone_flag,  i followed the Tools-DMA Wizard to set my DMA component and also configured it in the .cysch

document, and unfortunately,  i could not get proper result! Expecting seniors engineer to help me,

Best regards!



Re: How to set DMA function in my project ?

H L posted on 23 Dec 2011 12:04 AM PST
Top Contributor
679 Forum Posts

 The problem is the vaiables are out of scope. 

Your flags are only having local scope to main, and you re-declar those vaiable with the same name in ISR_1,c and ISR_DMA_done.c, those have the same name as that in main.c but they are not the SAME vaiable.

 

I think you want to use the DMA flags as global

So yuou have to move the declaration of the two flags before  main.c

EX

*******

uint8  DMADone_flag1,DMADone_flag2;

void main()

{

....

}

******

also

declare

extern uint8  DMADone_flag,

and

extern uint8 DMADone_flag2;

AND

remove those declaring inside the isr routines

r

at the begining of the software routines. 

****

Hope this help

 

void main()



Re: How to set DMA function in my project ?

hli posted on 23 Dec 2011 12:06 AM PST
Top Contributor
675 Forum Posts

Looking at the code - you don't set the DMADone_flag (neither 1 nor 2) in your code. I cannot look at your hardware sketch right now - did you connect an ISR to the DMA 'nrq' signal? Then just set the flags in your ISR. In your main function, you need to wait within a loop for the flags to be set again, after you have started the DMA transfer.



Re: How to set DMA function in my project ?

H L posted on 23 Dec 2011 12:07 AM PST
Top Contributor
679 Forum Posts

 Sorry for the typos

 

*****

also

declare

extern uint8  DMADone_flag,

and

extern uint8 DMADone_flag2;

 

outside the software routines.at the top of the module

 

AND

 

remove those declaring inside the isr routines

 

 

****************

 



Re: How to set DMA function in my project ?

Bob Marlowe posted on 23 Dec 2011 02:27 AM PST
Top Contributor
1768 Forum Posts

The basic handling of variables in C are easy to understand: variables are allocated when they are needed and destroyed, when they are not used any more:

A variable declared outside of any function is a so-called global variable and is visiblke (skope) from the point of declaration on throughout the program.

A variable declared inside a function (main() is a function as well!) is a so-called local variable and not only is visible from the point of declaration within the function only, the variable does exist only within this function and is destroyed when the function ends. (This may differ in 8051-implementations of C, but only has to do with code-efficienty and should have minimal effects on programming-style)

When a global variable is re-declared in a function, only the local variabe can be accessed so "hiding" the global var.

There is a good (and critical) handbook for C-language here http://publications.gbdirect.co.uk/c_book/  which rather often helps me out.

Hope this clarifys something.

Have a merry x-mas and may your code never fail

Bob



Re: How to set DMA function in my project ?

jacktan posted on 26 Dec 2011 10:30 PM PST
Top Contributor
26 Forum Posts

Thanks for you kindly reply,and i can solve the problem by you suggestion!

And hope  you have a happy new year






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20