DSPRelated.com
Forums

Using C to program DSP TMS320LF2407A

Started by knheman206 February 25, 2005
help!i need to program a DSPTMS320LFA) using C for a  bRUSHLESS DC motor. I
know basic C commands, but i dont know anything about DSP PRORAMMING!!any 1
know a site that has helpful tuts in C language to write code for PWM and
using capture of dsp???? I AM USING CODE COMPOSER STUDIO FOR DSP
PROGRAMMING.

i need to see some kind of code for the functioning of a PWM and an
CAPTURE, ADC. Plzzzzzzzz if anyone has done this kind of thing b4, i would
reallly appreciate yr help! 
thanks 
REGARDS.
(knheman206@yahoo.com)

(urgent)(urgent)


		
This message was sent using the Comp.DSP web interface on
www.DSPRelated.com
In comp.dsp,
knheman206 <knheman206@yahoo.com> wrote:
>help!i need to program a DSPTMS320LFA) using C for a bRUSHLESS DC motor. I >know basic C commands, but i dont know anything about DSP PRORAMMING!!any 1 >know a site that has helpful tuts in C language to write code for PWM and >using capture of dsp???? I AM USING CODE COMPOSER STUDIO FOR DSP >PROGRAMMING. >
Try to get some simple examples working first, like flashing an LED (the embedded version of "hello world"). Your environment probably comes with lots of examples to get you started.
>i need to see some kind of code for the functioning of a PWM and an >CAPTURE, ADC. Plzzzzzzzz if anyone has done this kind of thing b4, i would >reallly appreciate yr help! >thanks >REGARDS. >(knheman206@yahoo.com) >
Did you check out your examples en TI's application notes? Probably not, as I found this one in seconds. http://focus.ti.com/docs/toolsw/folders/print/sprc108.html And they have more app. notes that could help you, please search. And please stop shouting and use proper spelling, thanks.
>(urgent)(urgent) >
Was this fast enough for you?
> >This message was sent using the Comp.DSP web interface on >www.DSPRelated.com
Try a newsreader, you might like it. -- Stef (remove caps, dashes and .invalid from e-mail address to reply by mail) Mustgo, n.: Any item of food that has been sitting in the refrigerator so long it has become a science project. -- Sniglets, "Rich Hall & Friends"
knheman206 wrote:
> help!i need to program a DSPTMS320LFA) using C for a bRUSHLESS DC motor. I > know basic C commands, but i dont know anything about DSP PRORAMMING!!any 1 > know a site that has helpful tuts in C language to write code for PWM and > using capture of dsp???? I AM USING CODE COMPOSER STUDIO FOR DSP > PROGRAMMING. > > i need to see some kind of code for the functioning of a PWM and an > CAPTURE, ADC. Plzzzzzzzz if anyone has done this kind of thing b4, i would > reallly appreciate yr help! > thanks > REGARDS. > (knheman206@yahoo.com) > > (urgent)(urgent)
Read http://users.erols.com/jyavins/procfaq.htm, especially question #4. Look for examples on the TI site. (Do you need me to look for you?) DSP or not DSP, do you know enough about brushless motors to write a description of how to drive one? You'll more likely succeed if you do. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
>help!i need to program a DSPTMS320LFA) using C for a bRUSHLESS DC motor. I >know basic C commands, but i dont know anything about DSP PRORAMMING!!any 1 >know a site that has helpful tuts in C language to write code for PWM and >using capture of dsp???? I AM USING CODE COMPOSER STUDIO FOR DSP >PROGRAMMING.
Is there not some KIND OF aPPLICATION NOTE on the TI WEBPAGE! Please do not shout at us. This is one of those problems that has been solved thousands of times before, and I am _sure_ that there would be an app note somewhere. Let me help you out some: http://www.google.com.au/search?q=brushless+DC+motor+PWM+DSP&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official But the link above leads to the following link: http://focus.ti.com/docs/apps/catalog/resources/applicationnotes.jhtml?appId=255 I'm not going to provide the third link I found, which does answer your question - do some of your homework yourself.
>i need to see some kind of code for the functioning of a PWM and an >CAPTURE, ADC. Plzzzzzzzz if anyone has done this kind of thing b4, i would >reallly appreciate yr help! >thanks >REGARDS.
Why the great need to see some kind of code? I would have thought the principles were pretty simple. The speed of the motor is a function of the duty cycle, and the back EMF can be measured to determine the actual speed, can it not? What is so hard? There is a linear (i think?) mapping between duty cycle, back EMF and speed... * Disclaimer, I have unlearned much since finishing uni, so my recollection is a tad hazy... I can't remember the actual mappings... * DSP programming in C need be no different to coding normally in C. The only difference is in tight loops and optimisation that you should be thinking of. Interfacing to the peripherals is device and application specific. You should be reading datasheets and the documentation that you can get from TI about the device you're using.
>(urgent)(urgent)
Nothing is ever so urgent that you have to look for a reply in a newsgroup... If it were that urgent you'd have googled, found half of what you need and then gone off read the device documentation to learn how to program the on-chip peripherals you need. A
Jerry Avins wrote:
> knheman206 wrote: > >> help!i need to program a DSPTMS320LFA) using C for a bRUSHLESS DC >> motor. [snip] > > DSP or not DSP, do you know enough about brushless motors to write a > description of how to drive one? You'll more likely succeed if you do. >
Never having heard of a "brushless _DC_ motor", I went to Google. The descriptions reminded me of stepper motors. Is there an intrinsic difference? How did "DC" end up in the name?
go to compumotor
"Richard Owlett" <rowlett@atlascomm.net> wrote in message 
news:1120s0cda1j1n10@corp.supernews.com...
> Jerry Avins wrote: >> knheman206 wrote: >> >>> help!i need to program a DSPTMS320LFA) using C for a bRUSHLESS DC >>> motor. [snip] >> >> DSP or not DSP, do you know enough about brushless motors to write a >> description of how to drive one? You'll more likely succeed if you do. >> > > Never having heard of a "brushless _DC_ motor", I went to Google. > The descriptions reminded me of stepper motors. > > Is there an intrinsic difference? > How did "DC" end up in the name?
[reformatted to follow bottom posting preference of this newsgroup ]

nap wrote:
 >
> "Richard Owlett" <rowlett@atlascomm.net> wrote in message > news:1120s0cda1j1n10@corp.supernews.com... > >>Jerry Avins wrote: >> >>>knheman206 wrote: >>> >>> >>>>help!i need to program a DSPTMS320LFA) using C for a bRUSHLESS DC >>>>motor. [snip] >>> >>>DSP or not DSP, do you know enough about brushless motors to write a >>>description of how to drive one? You'll more likely succeed if you do. >>> >> >>Never having heard of a "brushless _DC_ motor", I went to Google. >>The descriptions reminded me of stepper motors. >> >>Is there an intrinsic difference? >>How did "DC" end up in the name? >
> go to compumotor > Found no answers to questions I asked at http://www.compumotor.com/ .
Richard Owlett wrote:
> Jerry Avins wrote: > >> knheman206 wrote: >> >>> help!i need to program a DSPTMS320LFA) using C for a bRUSHLESS DC >>> motor. [snip] >> >> >> DSP or not DSP, do you know enough about brushless motors to write a >> description of how to drive one? You'll more likely succeed if you do. >> > > Never having heard of a "brushless _DC_ motor", I went to Google. > The descriptions reminded me of stepper motors. > > Is there an intrinsic difference? > How did "DC" end up in the name?
It's exactly like a stepper except for causes the steps. In a stepper, steps are commanded by a controller that sets the rate. In a brushless DC motor, the steps are determined by the rotor position, usually sensed by Hall-effect devices. Another way to look at that structure is as a permanent-magnet motor with an electronic, not a brush, commutator. It's a motor. It runs off DC*. What would you call it? Jerry ___________________________ * The commutating electronics are often internal. The fans in your computer are examples. -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On Fri, 25 Feb 2005 06:58:03 -0600, "knheman206"
<knheman206@yahoo.com> wrote in comp.dsp:

> help!i need to program a DSPTMS320LFA) using C for a bRUSHLESS DC motor. I > know basic C commands, but i dont know anything about DSP PRORAMMING!!any 1 > know a site that has helpful tuts in C language to write code for PWM and > using capture of dsp???? I AM USING CODE COMPOSER STUDIO FOR DSP > PROGRAMMING. > > i need to see some kind of code for the functioning of a PWM and an > CAPTURE, ADC. Plzzzzzzzz if anyone has done this kind of thing b4, i would > reallly appreciate yr help! > thanks > REGARDS. > (knheman206@yahoo.com) > > (urgent)(urgent)
As others have already said, TI has a large number of application notes available for their DSPs. For the 2407, start at: http://focus.ti.com/docs/prod/folders/print/tms320lf2407a.html On the other hand, I have serious doubts whether you can do 3-phase motor control on these parts in C. Running the space vector modulation algorithm in C on a 2812 at 140MHz, with the interrupt service routines running from zero wait state internal RAM takes more than 20 microseconds worse case, when the profile generator, velocity and position control loops have to run as well as the transformations and the current control loop. That's fine for running a 20KHz loop with 50 microseconds in between interrupts. But with a 40 MHz 2407, with its less "C friendly" instruction set, it is quite possible that the generated code would not be fast enough unless you reduced the control loop rate or had very simple requirements. I am especially concerned that the use of a phrase like "I know basic C commands" might mean that you really don't know enough about writing highly efficient C, tailored to the compiler and the underlying instruction set of the processor/DSP, to manage it. In any case, on the TI page above and other places on their web sites, you will be able to find complete source code for this in assembly language. To write efficient enough C to do the job in that language, if it is possible as all, means you will need a very thorough understanding of the assembly language anyway. But in the end, if it is necessary to do this in C, you might need to change to the more powerful 28xx family. -- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.learn.c-c++ http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
Jerry Avins wrote:

> Richard Owlett wrote: > >> Jerry Avins wrote: >> >>> knheman206 wrote: >>> >>>> help!i need to program a DSPTMS320LFA) using C for a bRUSHLESS DC >>>> motor. [snip] >>> >>> >>> >>> DSP or not DSP, do you know enough about brushless motors to write a >>> description of how to drive one? You'll more likely succeed if you do. >>> >> >> Never having heard of a "brushless _DC_ motor", I went to Google. >> The descriptions reminded me of stepper motors. >> >> Is there an intrinsic difference? >> How did "DC" end up in the name? > > > It's exactly like a stepper except for causes the steps. In a stepper, > steps are commanded by a controller that sets the rate. In a brushless > DC motor, the steps are determined by the rotor position, usually sensed > by Hall-effect devices. Another way to look at that structure is as a > permanent-magnet motor with an electronic, not a brush, commutator. It's > a motor. It runs off DC*. What would you call it? >
I would call it a permanent-magnet synchronous motor -- but the world calls them "brushless DC" so that's what I call them. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com