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.

LAUNCHXL-F28377S: CLA Parallel calculation error

Part Number: LAUNCHXL-F28377S

I want to use the CLA, but there some trouble happened.  There is a loop that needs to be calculated eight times.I want CPU and CLA to calculate four times.But the results will be wrong.If let one of the nuclear calculation of eight times there is no error.

The CPU program is as follows:

         tem1 = 0;
         flag_testing2=0.2;
         GpioDataRegs.GPBCLEAR.bit.GPIO42=1;
         fVal3=cosvalue;
         fVal=sinvalue;
         fVal1=e_d;
         fVal2=e_q;
         ftem2=tem2;
         ftem3=tem3;
         fa0=a0;
         Cla1ForceTask1();//CLA 

         for (k=0; k<=3; k++)
         {
             //-------------------Park transform for basic voltage vector-------------------
             u_base_d[k] = u_base_alfa[k]*cosvalue + u_base_beta[k]*sinvalue;
             u_base_q[k] = -u_base_alfa[k]*sinvalue + u_base_beta[k]*cosvalue;
             //-------------------calculate for e_dash----------------------
             e_dash_d[k] = tem2 - u_base_d[k]/tem_r_tao_sigma;
             e_dash_q[k] = tem3 - u_base_q[k]/tem_r_tao_sigma;
             //-------------------calculate for a1,a2----------------------
             a2[k] = (e_dash_d[k])*(e_dash_d[k]) +(e_dash_q[k])*(e_dash_q[k]);
             a1[k] = 2*( e_d*e_dash_d[k] + e_q*e_dash_q[k]);
             //-------------------calculate for symmetry---------------------
             symmetry[k] = -a1[k]/(a2[k]);
             diart = a1[k] * a1[k] - 4 * a2[k] * a0;

             if (diart > 0)
             {
                 t[k] = (sqrt(diart) - a1[k]) / (2 * a2[k]);
                 if (t[k] > tem1)
                 {
                     tem1 = t[k];
                     K_new = k;
                     Delay_Isr_count = t[k] / Ts;
                 }
             }

The CLA program is as follows:

__interrupt void Cla1Task1 ( void )
{

    int32 m;
    float tem11=0,diart1=0;
    float Ts1 = 0.00005;
    float tem_r_tao_sigma1=0.01954896;


     float t_cla[4];            //Result vector
     float u_base_alfa_cla[4]={-179,179,358,0};           //Holds the input argument to the task
     float u_base_beta_cla[4]={-310.03709455,-310.03709455,0,0};        //The arsine of the input argument
     float u_base_d_cla[4];
     float u_base_q_cla[4];
     float e_dash_d_cla[4];
     float e_dash_q_cla[4];
     float a1_cla[4];
     float a2_cla[4];


     fResult=-1;
    for (m=0; m<=3; m++)
    {

        //-------------------Park transform for basic voltage vector-------------------
        u_base_d_cla[m] = u_base_alfa_cla[m]*fVal3 + u_base_beta_cla[m]*fVal;
        u_base_q_cla[m] = -u_base_alfa_cla[m]*fVal + u_base_beta_cla[m]*fVal3;
        //-------------------calculate for e_dash----------------------
        e_dash_d_cla[m] = ftem2 - u_base_d_cla[m]/tem_r_tao_sigma1;
        e_dash_q_cla[m] = ftem3 - u_base_q_cla[m]/tem_r_tao_sigma1;
        //-------------------calculate for a1,a2----------------------
        a2_cla[m] = (e_dash_d_cla[m])*(e_dash_d_cla[m]) +(e_dash_q_cla[m])*(e_dash_q_cla[m]);
        a1_cla[m] = 2*( fVal1*e_dash_d_cla[m] + fVal2*e_dash_q_cla[m]);
        //-------------------calculate for symmetry---------------------
        //symmetry_cla[m] = -a1_cla[m]/(a2_cla[m]);
        diart1 = a1_cla[m] * a1_cla[m] - 4 * a2_cla[m] * fa0;

        if (diart1 > 0)
        {
            t_cla[m] = (__sqrt(diart1) - a1_cla[m]) / (2 * a2_cla[m]);
            if (t_cla[m] > tem11)
            {
                tem11 = t_cla[m];
                fResult = diart1;
                kn=m+4;
                Delay_Isr_count1 = t_cla[m] / Ts1;
            }
        }
    }
}