Dear all
CPU: TM4C1294 with 120MHz
Comiler: TI v5.2.4 (CCS6.1)
CMSIS: CMSIS-SP-00300-r4p3-00rel0
I plan to implement a 2 Phase Stepper Motor Vector regulator. That mean every 50us I need 2 PI regualtors for vector and Park and I-Park conversation Also a position PID regulator is used every 50us.
If I implement the vector regulator only with CMSIS DSP libray I need 7.8us. (Much too long)
If I implement the vector regulator only with my self optimized code, I need 2.8us. Also this 2.8us are a high load for the final application.
Question:
Is it possible to shorten this 2.8us when I use RAMCODE similar to the TMS320F280x DSP processors? (Can TM4C do the same and also it works faster if code is in RAM? Where I can find some application notes for beginners?)
Can the DSP core of TM4C work parallel to the normal CPU code? If parallel processing is possible: Where I can find examples of implentation?
Are other opportunities to speed up the TM4C core?
This is my 2.8us vector regulator made myself. This code use generally 16 Bit range of all variables and the result of multiplication are 32 Bit.
sin_ang = sinus(uiAngle);
cos_ang = cosinus(uiAngle);
//Park transformation
park_Ds = (si32CurrPhD * cos_ang + si32CurrPhQ * sin_ang) >> 15;
park_Qs = (si32CurrPhQ * cos_ang - si32CurrPhD * sin_ang) >> 15;
//D-Q Field PI-regulator
si32Error = park_Ds - MotPar.si32PowerOut;
CommutPar.Curr_D_Ui = Sint32sat(CommutPar.Curr_D_Ui + si32Error, CommutPar.Curr_DQ_UiMax, - CommutPar.Curr_DQ_UiMax); //PI
si32CurrPhD = (si32Error * CommutPar.Curr_D_Kp + CommutPar.Curr_D_Ui * CommutPar.Curr_D_Ki) >> 8;
si32Error = park_Qs - CommutPar.Curr_Q_Set_Val;
CommutPar.Curr_Q_Ui = Sint32sat(CommutPar.Curr_Q_Ui + si32Error, CommutPar.Curr_DQ_UiMax, - CommutPar.Curr_DQ_UiMax); //PI
si32CurrPhQ = (si32Error * CommutPar.Curr_Q_Kp + CommutPar.Curr_Q_Ui * CommutPar.Curr_Q_Ki) >> 8;
si32CurrPhD = Sint32sat(si32CurrPhD, CURR_AMPL_OUT_OF_RANGE, -CURR_AMPL_OUT_OF_RANGE);
si32CurrPhQ = Sint32sat(si32CurrPhQ, CURR_AMPL_OUT_OF_RANGE, -CURR_AMPL_OUT_OF_RANGE);
//I-Park transformation
si32AmplPhD = (si32CurrPhD * cos_ang - si32CurrPhQ * sin_ang) >> 15; //Alpha
si32AmplPhQ = (si32CurrPhQ * cos_ang + si32CurrPhD * sin_ang) >> 15; //Beta
This is the 7.8us vector regulator based on CMSIS DSP:
q31theta = ((Uint32)uiAngle<<16);
arm_sin_cos_q31(q31theta,&q31sinVal,&q31cosVal);
q31Ialpha = ((Uint32)si32CurrPhD<<16);
q31Ibeta = ((Uint32)si32CurrPhQ<<16);
arm_park_q31(q31Ialpha,q31Ibeta,&q31pId,&q31pIq,q31sinVal,q31cosVal);
arm_pid_init_q31(&PID_park_D,0);
arm_pid_init_q31(&PID_park_Q,0);
arm_inv_park_q31(q31pId,q31pIq,&q31Ialpha,&q31Ibeta,q31sinVal,q31cosVal);
Hope somebody have some input how to speed up the slow TM4C duck.
Franz

