Example Code of DMA controller for MOD5270

Discussion to talk about software related topics only.
Post Reply
pokejohnson
Posts: 1
Joined: Tue Apr 19, 2011 1:13 am

Example Code of DMA controller for MOD5270

Post 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
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: Example Code of DMA controller for MOD5270

Post 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
Attachments
StopWatchExample.zip
Stopwatch driver modified to do PWM using DMA controller offloading

edit: Small changes to correct compile errors on some platforms, removed eclipse project files
(5.71 KiB) Downloaded 291 times
zippo445
Posts: 3
Joined: Sat Jan 03, 2009 9:55 am

Re: Example Code of DMA controller for MOD5270

Post 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'
Post Reply