Part Number: TMS320F28379D
Dear TI Hello,
I am using the CLA to compute the regulation loop using a function with many arguments.
My function takes a structure input. I am trying to initialize (reference and enable) a part of the structure in the main.c interrupt service routine.
My function is an inline function:
static inline void RST_Regulor(float R_Input, float S_Input, float T_Input,
uint16_t 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 (Enable == 1)
{
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 */
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
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(Enable == 1)
{
/* Regulation output if enable*/
*Output = (T - R - S) * INVERS_S0;
}
else
{
/* Old value if RST regulation is not enabled */
*Output = oldActu;
}
}
and I am using the following mapping:
#pragma DATA_SECTION(coef_r,"RAMLS4")
const float coef_r[SIZE_OF_R] = {0.2483687f, 0.03341229f, -0.2149564f};
#pragma DATA_SECTION(Poly_R,"RAMLS4")
float Poly_R[SIZE_OF_R];
#pragma DATA_SECTION(coef_s,"RAMLS4")
const float coef_s[SIZE_OF_S] = {0.1058185f, -0.06386142f, -0.01921073f, -0.02274637f};
#pragma DATA_SECTION(Poly_S,"RAMLS4")
float Poly_S[SIZE_OF_S];
#pragma DATA_SECTION(coef_t,"RAMLS4")
const float coef_t[SIZE_OF_T] = {0.06682458f};
#pragma DATA_SECTION(Poly_T,"RAMLS4")
float Poly_T[SIZE_OF_T];
#pragma DATA_SECTION(R,"RAMLS4")
float R;
#pragma DATA_SECTION(S,"RAMLS4")
float S;
#pragma DATA_SECTION(T,"RAMLS4")
float T;
The problem is that when I debug the CLA using ____mdebugstop()my polynoms Poly_R, Poly_S and Poly_T are empty.
By the way, this code is already executed in the C28 CPU and it works. my polynoms are note null.
2. Another thing that I couldn't understand that the structure is partially initialed.
for example, the reference variable is affected but not the enable variable.
sDCDCConfig.CurrentRef = Ref;
sDCDCConfig.EnableControl = Enable;

I am using the 21.6 C2000 compiler.
The CLA code is the following:
#pragma DATA_SECTION(sDCDCConfig,"CpuToCla1MsgRAM");
#pragma DATA_SECTION(DutyCycleMan,"Cla1ToCpuMsgRAM");
ST_DcDcConfiguration sDCDCConfig;
float DutyCycleMan;
//__mdebugstop();
/* RST regulation */
RST_Regulor(IDC_CLA, //R
CLA_StaActu, //S
sDCDCConfig.CurrentRef, //T
sDCDCConfig.EnableControl, //enable
CLA_StaActu, //old actuation
&DutyCycleMan); //RST output regulation
Thank you in advance,
S.Tarik
//Edited by tarik le 21/01/2022