Greetings,
I have an application where I am using the ADC to do conversions which are DMAd into memory. At the end of the conversions, the DMA gives me an interrupt which tells me that the process is complete and all data are in the memory.
But I have found that in order to have the ADC do any conversions, I need to have the ADC interrupt enabled, even though I don’t need it. Should I need to do this? The initialization code is as follows:
#define ADC_MODCLK 0x3
#define ADC_ADCBGRFND 0x00C0
#define ADC_ADCPWDN 0x0020
#define ADCTRL3_INIT ADC_ADCBGRFND + ADC_ADCPWDN
#define ADCMAXCONV_INIT 15 // 16 conversions
#define ADCCHSELSEQ_SETUP 0x0000 // All are channel 0.
void AdcHwInit()
{
InitAdc();
EALLOW;
SysCtrlRegs.HISPCP.all = ADC_MODCLK;
// PieVectTable.ADCINT = &AdcInterrupt;
EDIS;
AdcRegs.ADCTRL1.bit.ACQ_PS = 0;
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1;
AdcRegs.ADCTRL1.bit.CONT_RUN = 1;
AdcRegs.ADCTRL2.bit.EPWM_SOCB_SEQ = 1;
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 0;
AdcRegs.ADCTRL3.all = ADCTRL3_INIT;
AdcRegs.ADCMAXCONV.all = ADCMAXCONV_INIT;
}
When we start the conversions, we execute the following code:
void AdcSetupCapture()
{
AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1;
AdcRegs.ADCCHSELSEQ1.all = ADCCHSELSEQ_SETUP;
AdcRegs.ADCCHSELSEQ2.all = ADCCHSELSEQ_SETUP;
AdcRegs.ADCCHSELSEQ3.all = ADCCHSELSEQ_SETUP;
AdcRegs.ADCCHSELSEQ4.all = ADCCHSELSEQ_SETUP;
}
And the interrupt:
void AdcInterrupt()
{
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
If I enable the interrupt routine in AdcHwInit, and change AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 to be initialized to 1, I will receive the conversions. Alternatively, If I simply enable the interrupt routine, I will end up at ADCINT_ISR with all the conversions too. So the appearance is that the ADC interrupt must be enabled for conversions to occur. I’m obviously missing something. Any help would be appreciated.
Thank you,
Ed