Page 1 of 1

Example Code of DMA controller for MOD5270

Posted: Tue Apr 19, 2011 1:45 am
by pokejohnson
Excuse me,

I am trying to use the DMA controllers of MOD5270 to move data from Edge Port to inner memory. Is there any example code for Using DMA instead of DMA timers?

Thanks a lot!!

Johnson

Re: Example Code of DMA controller for MOD5270

Posted: Wed Apr 20, 2011 1:54 pm
by lgitlitz
I recently just made an application that uses DMA to perform PWM on a MOD5270/34. This is not exactly what you are looking for but it should be helpful. This code needs to be refined a bit but I put in enough comments that you should be able to get the basic ideas behind the DMA configurations. This is also built off the StopWatch driver that I have posted in the past, I may update that driver to include this functionality.
Originally I performed PWM by having a DMA timer trigger an interrupt and then modify the overflow value. The problem with that method is that there is a lot of CPU overhead... a 1 KHz PWM signal generated 2 thousand interrupts a second. I then modified the PWM driver to have the DMA timer trigger the DMA controller to load the new overflow value. An interrupt is now only used when the DMA count is depleted which happens about every million PWM cycles. It seem pretty stable as long as you keep your smallest high/low pulse greater than 3 or 4 uS, otherwise it gets broken when the interrupt fires. This can easily run 10KHz PWM which is not really feasible using the original interrupt method.

-Larry

Re: Example Code of DMA controller for MOD5270

Posted: Tue Sep 27, 2011 12:57 pm
by zippo445
hello larry,

I've used StopWatch in the past on the PK70 (nice piece of code, was really helpful!)

I m now trying to use it in a MOD5270 project....
I have a hard time trying to compile it. (I have the latest NNDK, Rel_2_5_2 ) and use the files you posted above....

these are the errors I get...

any ideas?

thanks,

phil

compile results:
..\StopWatch.cpp: In function 'void real_DMA0_Interrupt()':
..\StopWatch.cpp:372: error: 'volatile struct dmastruct' has no member
named 'bcr'
..\StopWatch.cpp:373: error: 'volatile struct dmastruct' has no member
named 'bcr'
..\StopWatch.cpp: In function 'void real_DMA1_Interrupt()':
..\StopWatch.cpp:377: error: 'volatile struct dmastruct' has no member
named 'bcr'
..\StopWatch.cpp:378: error: 'volatile struct dmastruct' has no member
named 'bcr'
..\StopWatch.cpp: In function 'void real_DMA2_Interrupt()':
..\StopWatch.cpp:382: error: 'volatile struct dmastruct' has no member
named 'bcr'
..\StopWatch.cpp:383: error: 'volatile struct dmastruct' has no member
named 'bcr'
..\StopWatch.cpp: In function 'void real_DMA3_Interrupt()':
..\StopWatch.cpp:387: error: 'volatile struct dmastruct' has no member
named 'bcr'
..\StopWatch.cpp:388: error: 'volatile struct dmastruct' has no member
named 'bcr'
..\StopWatch.cpp: In function 'int StopWatchPWMGenerator(double, double,
int)':
..\StopWatch.cpp:421: error: 'volatile struct scmstruct' has no member
named 'gpacr'
..\StopWatch.cpp:34: error: too many arguments to function 'void
SetIntc(long int, int, int, int)'
..\StopWatch.cpp:436: error: at this point in file
..\StopWatch.cpp:34: error: too many arguments to function 'void
SetIntc(long int, int, int, int)'
..\StopWatch.cpp:437: error: at this point in file
..\StopWatch.cpp:34: error: too many arguments to function 'void
SetIntc(long int, int, int, int)'
..\StopWatch.cpp:438: error: at this point in file
..\StopWatch.cpp:34: error: too many arguments to function 'void
SetIntc(long int, int, int, int)'
..\StopWatch.cpp:439: error: at this point in file
..\StopWatch.cpp:443: error: 'volatile struct dmastruct' has no member
named 'bcr'
..\StopWatch.cpp:447: error: 'volatile struct dmastruct' has no member
named 'bcr'