Dear TI,
I am using the CLA to execute this static inline function:
static inline void RST_Regulor(float R_Input, float S_Input, float T_Input,
uint16_t RST_Enable, float oldActu, float *Output)
{
uint16_t i;
/*******************************************
* Compute T polynome *
*******************************************/
/* Shift the delay line to the right by 1 */
for(i = SIZE_OF_T-1; i > 0; i--)
{
/* Shift */
Poly_T[i] = Poly_T[i-1];
/* Multiplication and Addition*/
T += coef_t[i] * Poly_T[i];
}
/* Get adc physical input into start of the delay line */
/* note the adc input is simulated in software */
if (RST_Enable == 1u)
{
Poly_T[0] = T_Input; //reference
}
else
{
Poly_T[0] = R_Input; //measured
}
/*Add the first param */
T += coef_t[0] * Poly_T[0];
/*******************************************
* Compute R polynome *
*******************************************/
/* Shift the delay line to the right by 1 */
#pragma UNROLL(SIZE_OF_R-1)
for(i = SIZE_OF_R-1; i > 0; i--)
{
/* Shift */
Poly_R[i] = Poly_R[i-1];
/*Multiplication and Addition*/
R += coef_r[i] * Poly_R[i];
}
/* Get adc physical input into start of the delay line */
/* note the adc input is simulated in software */
Poly_R[0] = R_Input;
R += coef_r[0] * Poly_R[0];
/*******************************************
* Compute S polynome *
*******************************************/
//Shift the delay line to the right by 1
#pragma UNROLL(SIZE_OF_S-1)
for(i = SIZE_OF_S-1; i > 0; i--)
{
/* Shift */
Poly_S[i] = Poly_S[i-1];
/* Multiplication and Addition*/
S += coef_s[i] * Poly_S[i];
}
/* Get adc physical input into start of the delay line */
/* note the adc input is simulated in software */
Poly_S[0] = oldActu;
S += coef_s[0] * Poly_S[0];
/**** Result*****/
if(RST_Enable == 1u)
{
/* Regulation output if enable*/
*Output = (T - R - S) * INVERS_S0;
}
else
{
/* Old value if RST regulation is not enabled */
*Output = oldActu;
}
}
The Call function in the CLA task is the following:
/* RST regulation */
RST_Regulor(IDC_CLA, //R
CLA_StaActu, //S
Ref_CLA, //T
Enable_CLA, //Enable
CLA_StaActu, //Old actuation
&DutyCycleMan); //RST output regulation
The watch expression is the following:

The problem is, some vectors are not shifted even if the same code is used to shift the Poly_S?
The Poly_R buffer should not be null because the R_Input is the IDC_CLA 10.11 and we see this in the watch expression, Enable_CLA is 1?
#pragma UNROLL(SIZE_OF_R-1)
for(i = SIZE_OF_R-1; i > 0; i--)
{
/* Shift */
Poly_R[i] = Poly_R[i-1];
/*Multiplication and Addition*/
R += coef_r[i] * Poly_R[i];
}
/* Get adc physical input into start of the delay line */
/* note the adc input is simulated in software */
Poly_R[0] = R_Input;
R += coef_r[0] * Poly_R[0];
Does it seem that the function is not complied with or executed correctly?
Do you have any idea how this could happen, please?
Thank you in advance,
S.Tarik