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.

CCS/TMS320F28069M: AdcOffsetSelfCal() function is getting stuck while waiting for ADCINTFLG.bit.ADCINT2

Part Number: TMS320F28069M
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE

Tool/software: Code Composer Studio

I am trying to run an ac induction motor in V/F mode. I wanted to use the trip zone functionality along with current sensing. For that I am using Hall effect sensors to measure the current. Important thing to mention is that I am running the code in Flash mode and the code is C++. Here is the code:

#include "DSP28X_Project.h"
#include "math.h"
#include "inits.h"
#include "vhz_profile.h"
#include "svgen.h"
#include "vf_pid.h"
#include "stdlib.h"
/////////////////////////////////////////////////
#include "ResponsiveFilter.h"

#define new_vhz_params {0,0.1,1,0.05,0.2,0,0}
ResponsiveFilter speed(false,700000000,25,0.01);
/////////////////////////////////////////////////



////////////////////////////////variable initialisations//////////////////////
#define base_freq 100
#define ISR_FREQ 10


VHZPROF vhz = VHZ_PARAMS;
//VHZPROF vhz=new_vhz_params;
SVPWM spwm = SVPWM_DEFAULTS;
VF_PID pid = PID_INIT;

float T=0.001/ISR_FREQ;
float a=0;
float f=0;
////////////////////speed calc///////
#define filt_alpha 0.3f
#define filt_beta 0.7f
int32 time_val=0;
int32 time_prd_delta=0;

float Time_val=0.0;
float Freq_val=0.0;
float Freq_hz=0.0;
float rpm;
long filt_count=0;
long count_exp=0;
float freq_ref=0;
long filtval=0;//tp
long delT1=0;
//////////////////////////////////////////////////////////////////////////



__interrupt void main_isr(void);
__interrupt void ecap_isr(void);

void main(void){

#ifdef _FLASH
    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
#endif

    InitSysCtrl();      //system initializations
    InitEPwm1Gpio();    //EPWM1 Gpio Inits
    InitEPwm2Gpio();    //EPWM2 Gpio Inits
    InitEPwm3Gpio();    //EPWM3 Gpio Inits
    InitECap1Gpio();    //ECAP1 Gpio Inits

    EALLOW;
        GpioCtrlRegs.GPACTRL.bit.QUALPRD2=0xFF;  //qualification period settings for GPIO16-23, 510 cpu clock cycles
        GpioCtrlRegs.GPAQSEL2.bit.GPIO19=2;      //qual window set to 6 samples of qualprd2
    EDIS;

    ////////////////////interrupt inits///////////////////
    InitPieCtrl();
    IER=0x0000;
    IFR=0x0000;
    InitPieVectTable();
    EALLOW;
       PieVectTable.EPWM1_INT = &main_isr;
       PieVectTable.ECAP1_INT = &ecap_isr;
    EDIS;
    //////////////////////////////////////////////////////
    EALLOW;
       SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC=0;  //disable pwm clock
    EDIS;
    ////////////////peripheral initializations////////////
    initepwm1();
    initepwm2();
    initepwm3();
    InitAdc();          //ADC INIT
    AdcOffsetSelfCal(); //ADC Callibration   THIS IS WHERE THE PROBLEM IS ARISING. THE CODE DOESN'T MOVE FORWARD FROM THIS POINT
    init_adc();
    InitECapture();
    //////////////////////////////////////////////////////
    EALLOW;
       SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC=1; //enable pwm clock
    EDIS;

    /////////////////enabling interrupts//////////////////
    IER |= M_INT3;
    IER |= M_INT4;
    PieCtrlRegs.PIEIER3.bit.INTx1 = 1;
    PieCtrlRegs.PIEIER4.bit.INTx1 = 1;

    EINT;
    ERTM;
    //////////////////////////////////////////////////////
    spwm.freq_max=6*base_freq*T;
    calc_slope_macro(vhz);
for(;;)
{}

}

epwminterrupt(){

}

ecapinterrupt(){
}

and during the debugging I found where exactly the code was getting stuck. It was in this line of code in AdcConversion() function: