This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
How would I program the Piccolo TMS320F28069 to modulate the 3 Space Vector Components?
Specifically, how can I program the ePWM module to: (one sector, for example, between V001 and V011)
1. turn on V001 (= EPWM1B, EPWM2B, EPWM3A is on) for ta,
2. turn on V011 (=EPWM1B, EPWM2A, EPWM3A is on) for tb,
3. turn on V000 (=EPWM1B, EPWM2B, EPWM3B is on) for to
every PWM period, To, such that
To = ta + tb + to ?
(ST Micro details this in Figs. 6 and 7 of their application note AN2154.)
Thanks.
78sys,
We offer a space vector software module as part of both controlSUITE Digital Motor Control Library (register based macro approach) and MotorWare (Object Oriented API for our InstaSPIN solutions)
install controlSUITE and look here for the files and library docs
C:\ti\controlSUITE\libs\app_libs\motor_control\math_blocks\v4.2
and there are multiple examples (anything that is doing FOC) in any of the DRV83 or HVMotor kits
C:\ti\controlSUITE\development_kits
Install MotorWare and look at
C:\ti\motorware\motorware_1_01_00_11\sw\modules\svgen
The documenation for all MotorWare components are done in Doxygen, accessed through HTML once you run MotorWare.exe
Every project in MotorWare uses the svgen (or svgen_current reconstruction) implementation.
While Control Suite had some Space Vector code, trying to extract it for just open-loop sine wave was more difficult than going back to first principles and deriving open-loop sinusoidal space vector from scratch, so that's what I did. Using ePWM1, 2, and 3 for the 3-phase, and executing the Space Vector pwm in &epwm2_isr interrupt routine, which is ok since epwm2 syncs with ePWM1 and ePWM3. Outputs full-amplitude sine wave, as expected with Space Vector, and alot simpler code than all the Control Suite code.
Only problem is that I'm using 6 if/else's to identify the sector, and then using trig (sin()) to compute the pwm. This uses about 3200 instruction cycles in the isr, which is alot when running at 12kHz.
Any suggestions for structure to use fewer instruction cycles than the if/else progression?
svgen in MotorWare.
SVGEN_run()
static inline void SVGEN_run(SVGEN_Handle handle,const MATH_vec2 *pVab,MATH_vec3 *pT)
{
_iq Vmax,Vmin,Vcom;
_iq Va,Vb,Vc;
_iq Va_tmp = -(pVab->value[0]>>1);
_iq Vb_tmp = _IQmpy(SVGEN_SQRT3_OVER_2,pVab->value[1]);
Va = pVab->value[0]; //alpha
Vb = Va_tmp + Vb_tmp; //_IQmpy(SVGEN_SQRT3_OVER_2, Vb_tmp); //-0.5*alpha + sqrt(3)/2 * beta;
Vc = Va_tmp - Vb_tmp; //_IQmpy(SVGEN_SQRT3_OVER_2, Vb_tmp); //-0.5*alpha - sqrt(3)/2 * beta;
Vmax=0;
Vmin=0;
// find order Vmin,Vmid,Vmax
if (Va > Vb)
{
Vmax = Va;
Vmin = Vb;
}
else
{
Vmax = Vb;
Vmin = Va;
}
if (Vc > Vmax)
{
Vmax = Vc;
}
else if (Vc < Vmin)
{
Vmin = Vc;
}
Vcom = (Vmax+Vmin)>>1; //0.5*(Vmax+Vmin)
// Subtract common-mode term to achieve SV modulation
pT->value[0] = (Vcom - Va);
pT->value[1] = (Vcom - Vb);
pT->value[2] = (Vcom - Vc);
return;
} // end of SVGEN_run() function
The MotorWare modules and drivers can be used with non-InstaSPIN solutions (though I doubt many are).
What I posted is just general SV transform code, has no knowledge of FAST or FOC.
According to the web site, Motor Ware is (1) for Insta-Spin and (2) integrated for feedback (current = torque and speed/position):
http://www.ti.com/tool/motorware
It would be a big help if TI had generic, user-friendly SV code with easy, step-by-step instrucitions on how to integrate and use the code in a generic application, with or without feedback.
One more question -- what's the fastest way to come up to speed on the CLA in the F28069?
I think the CLA could help out with removing control burden from the main processor.
Thanks.
Hi 78Sys,
Yes, MotorWare was created during the development of InstaSPIN-FOC and InstaSPIN-MOTION. We also use the same object oriented style for Piccolo LaunchPads and we actually released MotorWare variants for some Hercules, Stellaris, and MSP430 motor kits in 2012 as wel.
"It would be a big help if TI had generic, user-friendly SV code with easy, step-by-step instrucitions on how to integrate and use the code in a generic application, with or without feedback."
To be honest, we aren't interested in providing or supporting single motor control functions in that way. We find it more beneficial to create full system examples that use the modules. The modules are there for re-use and the example project shows how to do so.
For CLA, here is the Wiki FAQ
http://processors.wiki.ti.com/index.php/Control_Law_Accelerator_(C2000_CLA)_FAQ
I would also look at some of the kits/projects that use the CLA, especially for your intended purpose.
Motor Control on CLA:
C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v2.1
PFC on CLA:
C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v1.7
There are also several digital power kits that take advantage of the CLA.
Yes, the CLA can be extremely powerful. We actually have customers who want us to stop marketing it because they feel like their use of it is a huge technical advantage in their products! :)
Hi Chris,
Thanks for the info. The Piccolo with the CLA provides enough parallel processing power to eliminate need for FPGAs in many high-performance (high control bandwidth) embedded control applications because of the combination of its low-cost parallel processing and high-speed 12-bit ADCs (which would need interfacing to FPGAs externally, in most cases).
Went to a CLA workshop in Tampa area a couple years ago, built a simple CLA app, but need a refresher.
Thank you.