cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

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?

0 Likes
Reply
9 Replies
Anonymous
Not applicable

 Upload your project so people here can help

0 Likes
Reply
HeLi_263931
Honored Contributor II

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 .

0 Likes
Reply
Anonymous
Not applicable

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

0 Likes
Reply
Anonymous
Not applicable

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!

0 Likes
Reply
Anonymous
Not applicable

 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()

0 Likes
Reply
HeLi_263931
Honored Contributor II

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.

0 Likes
Reply
Anonymous
Not applicable

 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

   

 

   

   

 

   

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

0 Likes
Reply
JoMe_264151
Expert II

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

0 Likes
Reply
Anonymous
Not applicable

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

   

And hope  you have a happy new year

0 Likes
Reply