Hi,
I am using ADC interrupt (First Priority interrupt) triggered by EPWM1 period is over.
While setting the Interrupt time which is equal to period of EPWM1 not able to set above 50kHZ. And Below 50kHz is working fine
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.
Hi,
I am using ADC interrupt (First Priority interrupt) triggered by EPWM1 period is over.
While setting the Interrupt time which is equal to period of EPWM1 not able to set above 50kHZ. And Below 50kHz is working fine
Hi,
What do you mean by the interrupt time? Are you trying to configure the ADC SOC using the EPWM?
Can you please elaborate your issue?
Dear Aditya,
I am trying to set ADC interrupt for the control loops, I am triggering the ADC interrupt using EPWM period.
EALLOW;
EPwm1Regs.TBPRD = 0x1000;
// EPwm1Regs.TBPHS.bit.TBPHS = 0x0000;
EPwm1Regs.TBCTR = 0x0000;
// Set Compare values
EPwm1Regs.CMPA.bit.CMPA = 0x0080; // Set compare A value to 150 counts
EPwm1Regs.CMPB.bit.CMPB = 0x0080; //INTERRUPT_PERIOD/2;
// Setup counter mode
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;
EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE;
EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1;
EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1;
// Setup shadowing
EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO;
EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO;
// Set actions
EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR;
EPwm1Regs.AQCTLA.bit.CAD = AQ_SET;
EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE;
EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC;
EPwm1Regs.DBFED.bit.DBFED = BAND;
EPwm1Regs.DBRED.bit.DBRED = BAND;
EPwm1Regs.ETSEL.bit.SOCAEN = 0; // Disable SOC on A group
EPwm1Regs.ETSEL.bit.SOCASEL = 4; // Select SOC on up-count
EPwm1Regs.ETPS.bit.SOCAPRD = 1; // Generate pulse on 1st event
EDIS;
AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 0; // End of SOC0 will set INT1 flag
AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; // Enable INT1 flag
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // Make sure INT1 flag is cleared
Hi,
What issue are you seeing when you try to run beyond 50kHz? The PWM frequency I believe is correctly functioning. Is it not entering the ADC interrupt on every PWM edge that you've configured?
It is entering into Interrupt but when I am reducing the value in TBPRD register, It is not reflecting. But the same is reflecting when I am increasing.
EPwm1Regs.TBPRD = 0x1000;