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.

TMS320F28379D: Debugger jumps to Illegar_ISR loop of defultSR.C while debugging ADC code.

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software:

I am trying to convert single channel of ADC (ADCA2). I have generated unipolar sine wave using using EPWM3 ISR. and Bring it out using DAC and use the same as the input to ADC. EPWM3 is also used as a SOC0 for ADC channel 2. Now when i try to debug to verify whether AdcResult0 reads correct value or not, the debugger jumps to Illegal ISR.

I have used below mentioned code. 

#include "F28x_Project.h"
#define PI 3.1459265358979323846
void Gpio_select(void);
void Setup_epwm(void);
void ConfigureAdc(void);
void SetupADCSoftware(void);
void Initdaca(void);
void Initdaca(void);
extern interrupt void epwm3_isr(void);
float Ma1;
float theta;
Uint16 ADCaResult0;
int i;

void main(void)
{
InitSysCtrl();
DINT;
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
Gpio_select();
Setup_epwm();
ConfigureAdc();
SetupADCSoftware();

EALLOW;
PieVectTable.EPWM3_INT = &epwm3_isr;
EDIS;

IER |= M_INT3;
PieCtrlRegs.PIEIER3.bit.INTx3 = 1;

EINT;
ERTM;
while(1)
{

}
}

void Gpio_select(void)
{
EALLOW;
GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 1;
GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 1;
EDIS;
}

void Setup_epwm(void)
{
EPwm3Regs.TBCTL.bit.CLKDIV = 0;
EPwm3Regs.TBCTL.bit.HSPCLKDIV = 0;
EPwm3Regs.TBCTL.bit.CTRMODE = 2;
EPwm3Regs.TBPRD = 5000;
EPwm3Regs.AQCTLA.all = 0x0090;
EPwm3Regs.CMPA.bit.CMPA = 2500;

EPwm3Regs.ETSEL.bit.SOCAEN = 1;
EPwm3Regs.ETSEL.bit.SOCASEL = 3;
EPwm3Regs.ETPS.bit.SOCAPRD = 1;
EPwm3Regs.ETCLR.bit.SOCA = 1;

EPwm3Regs.ETSEL.bit.INTEN = 1;
EPwm3Regs.ETSEL.bit.INTSEL = 3;
EPwm3Regs.ETPS.bit.INTPRD = 1;
EPwm3Regs.ETCLR.bit.INT = 1;
}

void Initdaca(void)
{
EALLOW;
DacaRegs.DACCTL.bit.DACREFSEL = 1;
DacaRegs.DACCTL.bit.LOADMODE = 0;
DacaRegs.DACOUTEN.bit.DACOUTEN = 1;
DELAY_US(10);
EDIS;
}

void InitdacB(void)
{
EALLOW;
DacbRegs.DACCTL.bit.DACREFSEL = 1;
DacbRegs.DACCTL.bit.LOADMODE = 0;
DacbRegs.DACOUTEN.bit.DACOUTEN = 1;
DELAY_US(10);
EDIS;
}

void ConfigureAdc(void)
{
EALLOW;
AdcaRegs.ADCCTL2.bit.PRESCALE = 6;
AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);
AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
EDIS;
DELAY_US(1000);
}

void SetupADCSoftware(void)
{
Uint16 acqps;
if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
{
acqps = 14;
}
else
{
acqps = 63;
}
EALLOW;
AdcaRegs.ADCSOC0CTL.bit.CHSEL = 2;
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps;
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 9;

EDIS;
}

extern interrupt void epwm3_isr(void)
{
i++;
theta = theta + (2.0*PI*1*50*5e-5);
Ma1 = 0.5 + (0.5*1*__sin(theta));
DacaRegs.DACVALS.bit.DACVALS = Ma1*4096;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;
EPwm3Regs.ETCLR.bit.INT = 1;
}

  • Hi Krunal,

    If you set a break point at the ISR, does it reach the ISR at all? If not, I would double verify that your interrupt settings are configured properly.

    Are you starting the ePWMs? I do not see the TBCLKSYNC being set to 1, can you verify the ePWM is running?

    Best,

    Ryan Ma

  • Hi Ryan,

    I have checked by putting break point at EPWM3 ISR but it does not reach to ISR at all. and in order to check whether the interrupt setting is ok or not i have created another file in which i have not included ADC and it only contains EPWM3 ISR to generate unipolar sine wave with same settings of ISR as mentioned above and find that it is working fine. but as soos as ADC comes in picture the debugger jumps to ILLEGAL_ISR of defaultSR.c.

  • Hi Krunal,

    Are you generating any interrupts from the ADC? If your ePWM is generating the correct ISR, please verify your ADC settings are correct via our ADC examples from our C2000ware.

    Best,

    Ryan Ma

  • Hi Ryan

    No, I am not generating any interrupt from ADC. Can please suggest the correction that i need to made to make this code run in debug?

  • Hi Krunal,

    Where does it break before jumping into the illegal ISR?

    Can you step through the program before it jumps to the illegal ISR?

    BEst,

    ryan Ma

  • Hi Ryan,

    Actually I have tried with the example code for ADC provided by the C2000 ware but the issue still persist. As soon as i click to run button in debug mode the debugger switched to illegal ISR. Please guide to solve the issue.

  • Hi Ryan,

    Actually I have tried with the example code for ADC provided by the C2000 ware but the issue still persist. As soon as i click to run button in debug mode the debugger switched to illegal ISR. Please guide to solve the issue.

  • Hi Krunal,

    What example code of ADC are you referring to? The examples should be configured properly with appropriate ISR settings.

    If this is replicable from our example, I can see if I am able to replicate it and file a ticket if this needs fixing.

    Best,

    Ryan Ma