Other Parts Discussed in Thread: TMS320F28069, CONTROLSUITE
I am using the TMS320f28069 for my application. I am trying the use ePWM5 only to trig the ADC converter and the converter trig the CLA1 task5.
the ePWM is configured as IO line , is it possible to use this module internally even if the output is configured as IO line?
if that is possible do you have any idea where is the problem (see the following code : simplified for clarity )
Thank you in advance.
// GPIO-08 - PIN FUNCTION // GPIO GpioCtrlRegs.GPAMUX1.bit.GPIO8 = 0; // 0=GPIO, 1=EPWM5A, 2=Resv, 3=ADCSOC-A
GpioCtrlRegs.GPADIR.bit.GPIO8 = 0; // 1=OUTput, 0=Input
SysCtrlRegs.PCLKCR1.bit.EPWM5ENCLK = 1; // enable the clock for ePWM5
// Configure ADC to be triggered from EPWM5 Period event
//Map channel to ADC Pin
ChSel[0]=0; //Map channel 0 to pin ADC-A0
TrigSel[0]= ADCTRIG_EPWM5_SOCA;
// Configure the ADC with auto interrupt clear mode
// ADC interrupt after EOC of channel 0
ADC_SOC_CNF(ChSel,TrigSel,ACQPS,0,2);
// Configure the EPWM5 to issue the SOC
EPwm5Regs.ETSEL.bit.SOCAEN = 1; // enable SOCA
EPwm5Regs.ETSEL.bit.SOCASEL = ET_CTRU_CMPB; // Use CMPB event as trigger for ADC SOC
// trigger in the middle of the ON duty cycle
EPwm5Regs.ETPS.bit.SOCAPRD = ET_1ST; // Generate pulse on every event
//Configure hardware peripherals used by the CLA task5.
// Configure PWM5 for 100Khz switching Frequency
PWM_HSFB_Cnf(5,900);
CLA_Init();
// ADCINT5 will start CLA Task 5
EALLOW;
Cla1Regs.MPISRCSEL1.bit.PERINT5SEL = CLA_INT5_ADCINT5 ;
// 0=ADCINT5 1=none 2=EPWM5INT
// Configure the interrupt that would occur each control cycles
Cla1Regs.MIER.all = M_INT5; // task 5
EDIS;
interrupt void Cla1Task5(void) {
// read the analog input
/*
TO be done
*/
EPwm5Regs.ETCLR.all = 1;
}