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.

TMS320F28335: COFF to EABI change: float and int variables not updating (showing NaN)

Part Number: TMS320F28335


Hi, I have recently changed my code from 32 bit to 64 bit for higher resolution. I have changed from COFF to EABI setting as well but I am running into some issues with the file linking. My float and int variables are not updating when I run the code. 

I have also used the https://software-dl.ti.com/ccs/esd/documents/C2000_c28x_migration_from_coff_to_eabi.html page and I have changed the linker command file changes and have replaced some leading underscore issues. I am attaching the compiler setting down below with the .cmd file with the changes I made.

It would be much appreciated if I could get some assistance regarding this matter. 

Regards

Arafat

F28335.cmd code:

/*
//###########################################################################
//
// FILE: F28335.cmd
//
// TITLE: Linker Command File For F28335 Device
//
//###########################################################################
// $TI Release: F2833x/F2823x Header Files and Peripheral Examples V142 $
// $Release Date: November 1, 2016 $
// $Copyright: Copyright (C) 2007-2016 Texas Instruments Incorporated -
// http://www.ti.com/ ALL RIGHTS RESERVED $
//###########################################################################
*/

/* ======================================================
// For Code Composer Studio V2.2 and later
// ---------------------------------------
// In addition to this memory linker command file,
// add the header linker command file directly to the project.
// The header linker command file is required to link the
// peripheral structures to the proper locations within
// the memory map.
//
// The header linker files are found in <base>\DSP2833x_Headers\cmd
//
// For BIOS applications add: DSP2833x_Headers_BIOS.cmd
// For nonBIOS applications add: DSP2833x_Headers_nonBIOS.cmd
========================================================= */

/* ======================================================
// For Code Composer Studio prior to V2.2
// --------------------------------------
// 1) Use one of the following -l statements to include the
// header linker command file in the project. The header linker
// file is required to link the peripheral structures to the proper
// locations within the memory map */

/* Uncomment this line to include file only for non-BIOS applications */
/* -l DSP2833x_Headers_nonBIOS.cmd */

/* Uncomment this line to include file only for BIOS applications */
/* -l DSP2833x_Headers_BIOS.cmd */

/* 2) In your project add the path to <base>\DSP2833x_headers\cmd to the
library search path under project->build options, linker tab,
library search path (-i).
/*========================================================= */

/* Define the memory block start/length for the F28335
PAGE 0 will be used to organize program sections
PAGE 1 will be used to organize data sections

Notes:
Memory blocks on F28335 are uniform (ie same
physical memory) in both PAGE 0 and PAGE 1.
That is the same memory region should not be
defined for both PAGE 0 and PAGE 1.
Doing so will result in corruption of program
and/or data.

L0/L1/L2 and L3 memory blocks are mirrored - that is
they can be accessed in high memory or low memory.
For simplicity only one instance is used in this
linker file.

Contiguous SARAM memory blocks can be combined
if required to create a larger memory block.
*/


MEMORY
{
PAGE 0: /* Program Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */

ZONE0 : origin = 0x004000, length = 0x001000 /* XINTF zone 0 */
RAML0 : origin = 0x008000, length = 0x001000 /* on-chip RAM block L0 */
RAML1 : origin = 0x009000, length = 0x001000 /* on-chip RAM block L1 */
RAML2 : origin = 0x00A000, length = 0x001000 /* on-chip RAM block L2 */
RAML3 : origin = 0x00B000, length = 0x001000 /* on-chip RAM block L3 */
ZONE6 : origin = 0x0100000, length = 0x100000 /* XINTF zone 6 */
ZONE7A : origin = 0x0200000, length = 0x00FC00 /* XINTF zone 7 - program space */
FLASHH : origin = 0x300000, length = 0x008000 /* on-chip FLASH */
FLASHG : origin = 0x308000, length = 0x008000 /* on-chip FLASH */
FLASHF : origin = 0x310000, length = 0x008000 /* on-chip FLASH */
FLASHE : origin = 0x318000, length = 0x008000 /* on-chip FLASH */
FLASHD : origin = 0x320000, length = 0x008000 /* on-chip FLASH */
FLASHC : origin = 0x328000, length = 0x008000 /* on-chip FLASH */
FLASHA : origin = 0x338000, length = 0x007F80 /* on-chip FLASH */
CSM_RSVD : origin = 0x33FF80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
BEGIN : origin = 0x33FFF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */
CSM_PWL : origin = 0x33FFF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */
OTP : origin = 0x380400, length = 0x000400 /* on-chip OTP */
ADC_CAL : origin = 0x380080, length = 0x000009 /* ADC_cal function in Reserved memory */

IQTABLES : origin = 0x3FE000, length = 0x000b50 /* IQ Math Tables in Boot ROM */
IQTABLES2 : origin = 0x3FEB50, length = 0x00008c /* IQ Math Tables in Boot ROM */
FPUTABLES : origin = 0x3FEBDC, length = 0x0006A0 /* FPU Tables in Boot ROM */
ROM : origin = 0x3FF27C, length = 0x000D44 /* Boot ROM */
RESET : origin = 0x3FFFC0, length = 0x000002 /* part of boot ROM */
VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */

PAGE 1 : /* Data Memory */
/* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */
/* Registers remain on PAGE1 */

BOOT_RSVD : origin = 0x000000, length = 0x000050 /* Part of M0, BOOT rom will use this for stack */
RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
RAML4 : origin = 0x00C000, length = 0x001000 /* on-chip RAM block L1 */
RAML5 : origin = 0x00D000, length = 0x001000 /* on-chip RAM block L1 */
RAML6 : origin = 0x00E000, length = 0x001000 /* on-chip RAM block L1 */
RAML7 : origin = 0x00F000, length = 0x001000 /* on-chip RAM block L1 */
ZONE7B : origin = 0x20FC00, length = 0x000400 /* XINTF zone 7 - data space */
FLASHB : origin = 0x330000, length = 0x008000 /* on-chip FLASH */
}

/* Allocate sections to memory blocks.
Note:
codestart user defined section in DSP28_CodeStartBranch.asm used to redirect code
execution when booting to flash
ramfuncs user defined section to store functions that will be copied from Flash into RAM
*/

SECTIONS
{

/* Allocate program areas: */
.cinit : > FLASHA PAGE = 0
.init_array : > FLASHA, PAGE = 0
.text : > FLASHA PAGE = 0
codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHD,
RUN = RAML0,
LOAD_START(RamfuncsLoadStart),
LOAD_END(RamfuncsLoadEnd),
RUN_START(RamfuncsRunStart),
LOAD_SIZE(RamfuncsLoadSize),
PAGE = 0

csmpasswds : > CSM_PWL PAGE = 0
csm_rsvd : > CSM_RSVD PAGE = 0

/* Allocate uninitalized data sections: */
.stack : > RAMM1 PAGE = 1
.bss : > RAML4 PAGE = 1
.sysmem : > RAMM1 PAGE = 1

/* Initalized sections go in Flash */
/* For SDFlash to program these, they must be allocated to page 0 */
.const : > FLASHA PAGE = 0
.switch : > FLASHA PAGE = 0

/* Allocate IQ math areas: */
IQmath : > FLASHC PAGE = 0 /* Math Code */
IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD

/* Uncomment the section below if calling the IQNexp() or IQexp()
functions from the IQMath.lib library in order to utilize the
relevant IQ Math table in Boot ROM (This saves space and Boot ROM
is 1 wait-state). If this section is not uncommented, IQmathTables2
will be loaded into other memory (SARAM, Flash, etc.) and will take
up space, but 0 wait-state is possible.
*/
/*
IQmathTables2 : > IQTABLES2, PAGE = 0, TYPE = NOLOAD
{

IQmath.lib<IQNexpTable.obj> (IQmathTablesRam)

}
*/

FPUmathTables : > FPUTABLES, PAGE = 0, TYPE = NOLOAD

/* Allocate DMA-accessible RAM sections: */
DMARAML4 : > RAML4, PAGE = 1
DMARAML5 : > RAML5, PAGE = 1
DMARAML6 : > RAML6, PAGE = 1
DMARAML7 : > RAML7, PAGE = 1

/* Allocate 0x400 of XINTF Zone 7 to storing data */
ZONE7DATA : > ZONE7B, PAGE = 1

/* .reset is a standard section used by the compiler. It contains the */
/* the address of the start of _c_int00 for C Code. /*
/* When using the boot ROM this section and the CPU vector */
/* table is not needed. Thus the default type is set here to */
/* DSECT */
.reset : > RESET, PAGE = 0, TYPE = DSECT
vectors : > VECTORS PAGE = 0, TYPE = DSECT

/* Allocate ADC_cal function (pre-programmed by factory into TI reserved memory) */
.adc_cal : load = ADC_CAL, PAGE = 0, TYPE = NOLOAD

}

/*
//===========================================================================
// End of file.
//===========================================================================
*/

  • I am also including below the initial part of my .c file:

    // Header files
    #include "DSP28x_Project.h" // Device Headerfile and Examples Include File
    #include "DSP2833x_Device.h"
    #include "DSP2833x_Examples.h"
    #include "math.h"
    #include "string.h"

    //Declare all subroutines
    void Initsystem(void); //Main.1
    void Initvariable(void); //Main.2
    void InitGPIO(void); //Main.3
    void ClearIF(void); //Main.4
    void Inithardware(void); //Main.5
    void EnableIF(void); //Main.6
    void EnableIDLE(void); //Main.6

    void InitEPwm1Example(void); //Main.5.2
    void InitEPwm2Example(void); //Main.5.3
    void InitEPwm3Example(void); //Main.5.4
    void InitEPwm4Example(void); //Main.5.5
    void InitEPwm5Example(void); //Main.5.4
    void InitEPwm6Example(void); //Main.5.5

    void Initadc_value(void); //Main.5.1
    //void ADC(void);
    void reset_isr(void);

    // ISR declaration
    interrupt void adc_isr(void);

    // Global variables
    Uint32 EPwm1TimerIntCount = 0;
    Uint32 EPwm2TimerIntCount = 0;
    Uint32 EPwm3TimerIntCount = 0;
    Uint16 EPwm1_DB_Direction = 0;
    Uint16 EPwm2_DB_Direction = 0;
    Uint16 EPwm3_DB_Direction = 0;
    Uint16 i = 0;

    extern unsigned int RamfuncsLoadStart;
    extern unsigned int RamfuncsLoadSize;
    extern unsigned int RamfuncsRunStart;
    extern unsigned int RamfuncsLoadEnd;


    /********************************************** start of APD initialization******************************/
    // PWM PARAMETERS AND INTERRUPT FREQUENCY

    int PRD_a = 751;
    int DeB_a = 1;
    float PRD_Interr = 375;

    int PRD_ISR = 3750; // 25us
    // int PRD_ISR = 3148; // 21us

    float SPT = 0;
    float APD = 0;

    /********************************************** end of APD initialization ************************************************/

    /********************************************** start of MC initialization ************************************************/

    // PWM initializations
    float PRD = 669; // considering up-counter (750 for 200 kHz)
    float PRDu = 3000; // 0.1 MHz for unfolder GD
    float DeB_pt = 3;//10
    float DeB_pb = 3;//10 (was 4?)
    float DeBs = 56; //secondary leading case test
    float DeBu = 1;

    // unfolder initialization
    float unfFlag = 1;
    float cycle = 1;

    // PLL initialization
    float V_alpha[3] = {0.0, 0.0, 0.0};
    float V_beta[4] = {0.0, 0.0, 0.0, 0.0};
    float V_d[2] = {0.0,0.0};
    float V_q[2] = {0.0,0.0};
    float V_q_err[2] = {0.0,0.0};

    float a_1 = 1.999816938472530;
    float a_2 = -0.999905758754186;
    float a_3 = 0.471206229075142e-4;


    // bilinear form
    float bn_1 = 0.000154539844293318;
    float bn_2 = -0.000158972013768773;
    float bn_3 = -0.000154539844293318;
    float bn_4 = 0.000158972013768773;
    float bd_2 = -2.995832538814968;
    float bd_3 = 2.991757093521227;
    float bd_4 = -0.995924276224838;


    /*
    // zoh form
    float bn_1 = 0;
    float bn_2 = -0.309078565741323e-3;
    float bn_3 = 0.627021600926429e-3;
    float bn_4 = -0.317943035185106e-3;
    float bd_2 = -2.995832519244495;
    float bd_3 = 2.991757055753957;
    float bd_4 = -0.995924258024169;
    */

    /*
    // no dc rejection
    float bn_1 = -0.222050704138232e-6;
    float bn_2 = -0.444101408276465e-6;
    float bn_3 = -0.222050704138232e-6;
    float bn_4 = 0;
    float bd_2 = -1.999816938472530;
    float bd_3 = 0.999905758754186;
    float bd_4 = 0;
    */

    float c_1 = 0.9999;

    float costh = 1.0;
    float sinth = 0.0;

    float theta_grid[2] = {0.0,0.0};

    float delta_f[2] = {0.0,0.0}; //output frequency of PLL
    float fn = 60; //nominal frequency
    float fo = 0;
    float wn = 377;
    float wo[2] = {0.0,0.0};
    float wo_lpf[2] = {0.0,0.0};
    float Ts = 25e-6;

    // interpolation parameters
    float offset = 0;
    float active_sign = 0;
    float alpha_PLL = 63.66;
    float idx_float = 0;
    int idx_L = 0;
    int idx_H = 0;

    // lpf parameters (10 kHz cutoff)
    float lpf_a = 0.2391; // mult. by input
    float lpf_c = 0.5219; // mult. by output

    // lpf parameters (1 kHz cutoff)
    float lpf_a1 = 0.072820507087338; // mult. by input
    float lpf_c1 = 0.854358985825323; // mult. by output

    // lpf parameters (1.2 Hz cutoff)
    float lpf2_a = 0.942388978008234e-04; // 1.2 Hz cutoff
    float lpf2_b = 0.942388978008234e-04;
    float lpf2_c = 0.999811522204398;

    float lpf2_xprev1 = 0;
    float lpf2_yprev1 = 0;

    // lpf parameters (12 Hz cutoff)
    float lpf_a6 = 0.000376849049686055; // mult. by input
    float lpf_c6 = 0.999246301900628; // mult. by output

    // output voltage sensor initialization
    float Vo_p_sample = 0.0;
    float Vo_n_sample = 0.0;
    float Vo_val = 0.0;
    float Vo_scale = 0.1341; // assumes 33k x3 and 65
    //float Vo_scale = 0.093144;


    // input current sensor initialization
    float Iin_sample = 0.0;
    float Iin_val = 0.0;

    // output current sensor initializations
    float Io_sample = 0.0;
    float Io_val[2] = {0.0,0.0};
    float Io_s[2] = {0.0,0.0};

    float Io_scale = 0.002775;
    float Io_sense_offset = 2252.25;

    // grid voltage sensor initializations
    float Vg_sense[2] = {0.0,0.0};
    float u[4] = {0.0, 0.0, 0.0, 0.0};

    // input voltage sensor initializations
    float Vin_sense = 0;
    float Vin_val[2] = {0.0,0.0};
    float Vin[2] = {0.0,0.0};

    float Vin_scale = 0.02515262515;
    float Vin_use = 0;

    // CL and PWM update parameters
    float theta = 0;
    float theta_prd_val = 0;
    float DebS_val = 0;
    float phase1_val = 0;
    float phase2_val = 0;

    float delta_CL = 0;
    float delta_CL1 = 0;
    float delta_CL_val = 0;

    float iav_err = 0;
    float iav_err1 = 0;
    float iav_err_mc = 0;
    float iav_err1_mc = 0;

    float LB = 0;
    float UB = 0.2;

    float C1 = 0;
    float C2 = 0;
    float kp_mc = 0.0002;
    float ki_mc = 2;
    float Ts_mc = 25e-6;
    float wCdmV = 0.07677; //2*pi*60*0.6e-6*240*sqrt(2)

    // ac current reference
    float Ipk_ref = 0.7071; // 120 W
    // float Ipk_ref = 1.1785; // 200 W

    // Theta LUT - value dervied as PRD/2 - 2*THETA
    int EPWM1_phase_lut[200] = {345,345,345,344,343,342,341,339,337,335,333,330,327,324,320,317,313,309,305,301,297,293,287,283,279,274,270,265,261,255,251,245,241,236,231,226,221,216,211,206,201,196,191,186,181,176,171,166,161,156,151,149,146,143,139,136,133,130,126,123,120,117,114,110,107,104,101,98,95,92,90,87,84,81,79,76,74,71,69,66,64,62,60,58,56,55,53,51,50,49,47,46,45,45,44,43,43,43,43,43,43,43,43,44,44,45,46,47,48,49,50,51,52,54,55,57,58,60,62,64,65,67,69,71,73,75,77,79,82,86,90,93,96,99,102,106,109,113,116,120,123,127,130,134,138,142,146,150,154,158,162,167,171,175,179,184,188,192,197,202,206,211,216,221,225,230,235,240,245,250,255,260,265,269,274,280,285,290,295,300,305,310,315,320,325,330,336,341,346,351,356,361,366,371,375,375,375,374,370,370};

    // Delta LUT - value derived as DELTA - THETA
    int EPWM2_phase_lut[200] = {365,364,362,360,357,354,349,344,337,329,319,307,294,280,266,250,241,233,227,221,216,211,206,202,198,194,190,186,183,179,176,172,168,165,162,159,155,152,149,146,143,139,136,133,130,127,124,121,118,115,112,110,109,107,104,102,100,98,96,94,92,90,88,86,84,82,80,79,77,75,73,72,70,68,67,65,63,62,60,59,57,56,55,54,52,51,50,49,48,47,46,45,45,44,44,44,43,43,43,42,42,42,42,42,42,42,42,42,43,43,43,43,44,44,45,45,46,46,47,48,48,49,49,50,51,51,52,53,54,55,57,58,59,61,62,63,64,66,67,68,70,71,73,74,75,77,79,80,82,83,85,87,88,90,91,93,95,97,99,100,102,104,106,108,110,112,114,115,116,118,119,120,120,121,121,121,120,119,118,116,113,110,106,100,94,86,78,69,59,48,36,25,15,11,9,6,5,3,0,1};
    int fs_lut[200] = {751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751,751};

    int DebP1_lut[200] = {10,10,9,8,7,6,6,5,5,4,4,4,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
    int DebP3_lut[200] = {11,11,11,11,11,11,11,10,10,10,10,10,10,9,9,9,9,9,9,9,9,9,9,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,8,8,7,7,6,6,5,5,5,4,4,4,4,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
    int DebS_lut[200] = {75,75,75,75,74,74,74,74,74,73,73,73,73,73,72,72,72,72,71,71,71,71,70,70,70,69,69,69,68,68,68,67,67,67,66,66,65,65,64,64,63,63,62,62,61,61,60,59,59,58,57,57,56,55,54,54,53,52,51,50,50,49,48,47,46,45,45,44,43,42,41,40,40,39,38,38,37,37,37,36,36,35,35,35,34,34,34,34,33,33,33,33,33,33,33,33,34,34,34,34,35,35,36,36,36,37,37,38,38,39,40,40,41,41,42,43,43,44,44,45,46,46,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,47,47,47,47,46,46,45,45,45,44,44,43,43,42,42,42,41,41,40,40,40,40,40,40,40,40,41,42,43,44,45,47,49,51,52,54,56,58,60,62,64,66,68,69,71,72,73,73,74,75,75,75,75,76,76,76,76};

    float iav_ref_vec_mc[200] = {0,1.12082318296822E-02,2.24136703330155E-02,3.36135228798062E-02,4.48049982319983E-02,5.59853072393083E-02,6.71516635343399E-02,7.83012842270053E-02,8.94313905980795E-02,0.100539208791716,0.111621970506748,0.122676913686611,0.1337012832077,0.144692331566008,0.155647319561861,0.166563516982582,0.177438203282919,0.188268668263062,0.19905221274408,0.209786149240616,0.22046780263066,0.23109451082225,0.24166362541692,0.252172512369734,0.262618552645748,0.272999142872728,0.283311695989962,0.293553641893015,0.303722428074249,0.313815520258961,0.323830403036982,0.333764580489562,0.343615576811416,0.353380936927735,0.363058227106052,0.372645035562773,0.382138973064245,0.391537673522206,0.400838794583462,0.410040018213648,0.419139051274935,0.428133626097526,0.437021501044807,0.445800461072009,0.454468318278246,0.463022912451782,0.471462111608406,0.479783812522762,0.487985941252521,0.496066453655247,0.504023335897846,0.511854604958448,0.519558309120624,0.527132528459791,0.534575375321697,0.541884994792869,0.54905956516289,0.556097298378412,0.562996440488772,0.56975527208312,0.576372108718924,0.582845301341776,0.589173236696365,0.595354337728538,0.601387063978332,0.607269911963892,0.613001415556168,0.618580146344306,0.624004713991636,0.629273766582178,0.63438599095756,0.639340113044293,0.644134898171291,0.64876915137758,0.653241717710104,0.657551482511567,0.661697371698228,0.665678352027585,0.66949343135588,0.673141658885361,0.676622125401245,0.67993396349831,0.683076347797068,0.686048495149475,0.6888496648341,0.691479158740732,0.693936321544362,0.696220540868507,0.698331247437822,0.700267915219982,0.702030061556772,0.703617247284382,0.705029076842855,0.706265198374666,0.707325303812415,0.7082091289556,0.708916453536469,0.709447101274906,0.709800939922369,0.709977881294851,0.709977881294851,0.709800939922369,0.709447101274906,0.708916453536469,0.708209128955601,0.707325303812415,0.706265198374667,0.705029076842856,0.703617247284383,0.702030061556772,0.700267915219982,0.698331247437823,0.696220540868507,0.693936321544363,0.691479158740732,0.688849664834101,0.686048495149476,0.683076347797069,0.679933963498311,0.676622125401247,0.673141658885362,0.669493431355881,0.665678352027587,0.66169737169823,0.657551482511568,0.653241717710105,0.648769151377581,0.644134898171293,0.639340113044295,0.634385990957562,0.629273766582179,0.624004713991638,0.618580146344307,0.613001415556169,0.607269911963893,0.601387063978333,0.595354337728539,0.589173236696366,0.582845301341777,0.576372108718925,0.569755272083121,0.562996440488773,0.556097298378412,0.549059565162891,0.54188499479287,0.534575375321698,0.527132528459791,0.519558309120624,0.511854604958448,0.504023335897846,0.496066453655247,0.48798594125252,0.479783812522762,0.471462111608405,0.463022912451782,0.454468318278245,0.445800461072008,0.437021501044806,0.428133626097525,0.419139051274934,0.410040018213646,0.40083879458346,0.391537673522205,0.382138973064243,0.37264503556277,0.36305822710605,0.353380936927733,0.343615576811413,0.33376458048956,0.323830403036979,0.313815520258958,0.303722428074246,0.293553641893012,0.283311695989959,0.272999142872724,0.262618552645745,0.25217251236973,0.241663625416916,0.231094510822246,0.220467802630656,0.209786149240612,0.199052212744076,0.188268668263057,0.177438203282914,0.166563516982577,0.155647319561856,0.144692331566003,0.133701283207694,0.122676913686605,0.111621970506743,0.10053920879171,8.94313905980737E-02,7.83012842269993E-02,6.71516635343339E-02,5.59853072393021E-02,0.044804998231992,3.36135228797997E-02,2.24136703330089E-02,1.12082318296755E-02,0};

    float imc_ref_val = 0;

    int update_idx_mc = 0;
    float phase_lut_idx = 199;
    int lut_count_dir = 1;


    ////////////////////////////////////////////////////////////////////////// APD DEFNS /////////////////////////////////////////////////////////////////////////////////////
    // 200 W, 0.1 A, L = 8.1uH, C = 164uF
    int PRD_vec[200] = {326,324,322,320,318,315,312,309,306,303,299,295,291,287,283,278,273,269,264,258,253,248,242,236,230,224,218,212,205,199,192,186,179,172,165,158,151,143,136,129,121,117,115,113,112,111,110,109,108,108,107,105,105,105,106,106,107,111,118,126,133,141,148,155,162,170,177,184,190,197,204,210,217,223,230,236,242,247,253,259,264,269,274,279,284,289,293,297,301,305,309,312,316,319,322,324,327,329,331,333,334,336,337,337,338,338,338,338,337,336,334,331,330,329,327,325,323,321,318,315,312,309,305,301,296,291,286,280,274,268,261,254,247,239,230,222,213,204,194,184,174,163,152,141,131,128,126,125,124,123,123,120,120,121,122,134,145,157,168,178,189,199,209,218,227,236,244,252,260,267,274,280,286,292,297,302,307,311,315,318,321,324,326,328,330,331,332,333,333,332,331,332,332,332,332,332,331,330,329,328};
    int duty_vec[200] = {180,180,180,180,179,179,178,177,176,175,174,172,171,169,167,165,163,161,158,156,153,150,147,144,141,138,135,131,128,124,120,116,112,108,104,100,96,92,87,83,78,75,73,72,70,69,69,68,67,67,66,65,64,64,64,64,64,66,71,75,80,84,88,93,97,101,105,109,113,117,121,124,128,131,135,138,141,144,147,150,153,155,158,160,162,164,166,168,169,171,172,173,174,175,176,177,177,177,177,177,177,176,176,175,174,173,172,170,169,167,164,161,160,158,156,154,152,149,147,144,141,138,136,132,129,126,123,119,115,112,108,104,100,96,92,88,83,79,75,70,66,61,57,52,48,48,48,48,48,48,48,47,48,48,49,54,59,64,68,73,77,82,86,91,95,99,104,108,112,116,120,123,127,130,134,137,141,144,147,150,152,155,157,160,162,164,166,168,169,170,171,173,174,175,176,177,178,179,179,180};
    int DeBF_vec[200] = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,6,6,6,7,8,8,9,10,11,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,16,16,16,17,17,18,18,18,18,18,18,18,18,18,17,17,17,17,17,17,17,17,17,17,17,17,17,16,16,16,16,16,16,16,16,16,16,16,16,13,11,10,9,8,7,7,6,6,5,5,4,4,4,4,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2};
    int DeBR_vec[200] = {18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,16,14,13,11,10,9,9,8,7,7,7,6,6,6,5,5,5,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,6,6,7,7,8,9,10,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,15,15,15,15,16,16,17,17,18,18,18,18,18,18,18,18,18,18};

    float Vc_sample = 0.0;
    float Vc_sensed = 0.0;
    float VDC_scale = 0.03485187961165;

    float iL_a_sample = 0.0;
    float iL_a = 0.0;
    float iLa_scale = 0.0007326; // real measured iL in ampere (plus and minus)

    // Intermediate variables
    float Vin1 = 0;
    float Vin2 = 0;
    float Vc_rec_a = 0;
    float Vc_a = 0;
    float VC_avg2 = 0;
    float VC_err = 0;
    float VC_err1 = 0;
    float C1_v = 0.0185006875/5; // kp = 0.0185 ki = 0.055;
    float C2_v = 0.0184993125/5;

    float I0 = 0;
    float Ion = 0;
    float Ivalley = 0;
    float Ipeak = 0;
    float k1;
    float k2;

    float THon = 0;
    float TLon = 0;
    float Tsw = 0;
    float duty_ff = 0;
    float THdead = 0;
    float TLdead = 0;
    float DeBR = 0;
    float DeBF = 0;
    float duty_cl = 0;
    float duty_cl1 = 0;
    float duty_a = 0;

    float LB_a = 0.1;
    float UB_a = 0.9;

    int voltage_controller = 1;

    float VC_ref = 85;

    // PI CURRENT CONTROLLER PARAMETERS
    float iav_err;
    float iav_err1;
    float I_DC_VOLTAGE_LOOP = 0.07;

    float C1_a;
    float C2_a;
    float G_i_a;
    float wL_i_a;

    // LUT parameters
    int update_idx_a = 0;
    int lut_idx = 0;
    float lut_idx_float = 0;
    int lut_idx_L = 0;
    int lut_idx_H = 0;
    float Enable = 0;
    float flagZC = 0;
    float tripFlag = 0;

    float Von_val = 5;
    float Voff_val = 4;

    // PR controller
    // 100 Hz PR
    /*
    float PR_A_a = 0.001248362541545*100; // unity gain pr, where gain scales by multiple provided - w_c = 50, w_0 = 2*pi*100
    float PR_B_a = 1.997256858028226;
    float PR_C_a = 0.997503274916909;
    */

    // PR controller
    // 120 Hz PR
    //float PR_A_a = 0.002493549645693*17; // unity gain pr, where gain scales by multiple provided - w_c = 100, w_0 = 2*pi*120
    //float PR_B_a = 1.994658522399998;
    //float PR_C_a = 0.995012910708614;

    // PR controller
    // 120 Hz PR
    float PR_A_a = 0.001248328704525*50; // unity gain pr, where gain scales by multiple provided - w_c = 50, w_0 = 2*pi*120
    float PR_B_a = 1.997148511889236;
    float PR_C_a = 0.997503342590950;

    // lpf parameters (2k Hz cutoff)
    float lpf2k_a = 0.135755248163633; // 2k Hz cutoff
    float lpf2k_b = 0.135755248163633;
    float lpf2k_c = 0.728489503672734;

    float lpf2k_xprev1 = 0;
    float lpf2k_yprev1 = 0;

    float Iin_val_p = 0;
    float Io_val_p = 0;

    float PR_xprev1 = 0;
    float PR_xprev2 = 0;
    float PR_yprev1 = 0;
    float PR_yprev2 = 0;

    int main(void) {

    /* Copy the secureRamFuncs section */
    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, &RamfuncsLoadEnd-&RamfuncsLoadStart); //(Uint32)&RamFuncs_loadsize &RamFuncs_loadend-&RamFuncs_loadstart

    /* Initialize the on-chip flash registers */
    InitFlash();

    // Step 1. Initialize System Control:
    Initsystem();

    // Step 2. Initialize variable
    Initvariable();

    // Sync ALL ePWM
    EALLOW;
    SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
    EDIS;

    // Step 3. Initialize GPIO:
    InitGPIO();

    //Step 4. Clear all interrupts and initialize PIE vector table
    ClearIF();

    // Step 5. Initialize all the Device Peripherals
    Inithardware();

    // Step 6. User specific code, enable interrupts
    EnableIF();

    // Sync ALL ePWM
    EALLOW;
    SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
    EDIS;

    // Step 7. IDLE loop. Just sit and loop forever (optional):
    EnableIDLE();

    return 0;
    }

  • One suggestion from the page I have linked is to include the .retain line, but I am not sure where that line should go.

  • Hi Arafat,

    In EABI, unreferenced variables will be removed in the linking stage. To retain such variables you can add #pragma RETAIN(symbol). This would make sure the variable is present i the .out file even though it is not explicitly used in the application code.

    Can you give some details on the issue you are facing. Are you able see the variables in the expressions window? Are you not able to modify these variables from the code?

    Regards,

    Veena

  • Hi Arafat,

    Since we haven't heard from you since last 2 weeks, we assume the issue has been resolved. I am marking this thread as resolved. If you are still facing issues, please reject the resolution and reply to the thread with more details.

    Regards,

    Veena