Other Parts Discussed in Thread: TMS320F28027
Hi verybody,
I am trying to use the ADCINT on my TMS320F28027. It just wont work. This is the code I use to setup the interrupt:
ADCInit():
EALLOW;
AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; // use internal band gap reference
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // power up band gap
AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; // power up reference
AdcRegs.ADCCTL1.bit.ADCPWDN = 1; // power up rest of ADC
AdcRegs.ADCCTL1.bit.ADCENABLE = 1; // enable ADC output
asm(" RPT#100 || NOP"); // wait 100 cycles
AdcRegs.ADCSOC2CTL.bit.ACQPS = 9; // set S/H window to 10 clk cycles
AdcRegs.ADCSOC2CTL.bit.CHSEL = 0x02; // Select channel ADCINA2
AdcRegs.ADCSOC2CTL.bit.TRIGSEL = 0x0B; // Select EPWM4 ADCSOCA as triggersource
AdcRegs.INTSEL1N2.bit.INT2E = 1; // Enable ADCINT2
AdcRegs.INTSEL1N2.bit.INT2SEL = 2; // EOC2 is trigger for ADCINT2 EDIS;
Main(): (After ADCInit())
EALLOW;
PieVectTable.ADCINT2 = &ISR_Run; // Map Interrupt
EDIS;
PieCtrlRegs.PIEIER10.bit.INTx2 = 1; // PIE level enable, Grp10 / Int2
// Enable Peripheral, global Ints and higher priority real-time debug events:
IER |= M_INT10; // Enable CPU INT10 connected to ADC1-8 INTs
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
The ADC is triggered by a PWM CMPA match. When the TBCTR reaches CMPA value the CPU is halted somewhere in code and the ISR is not entered.
Any idea what is wrong with my code? Where is the error? I just cant find it....
Thank you very much for your help!
Cheers,
Mario