Part Number: TMS320F28069
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE
I am working on my rectifier project . And I am using all ADC channels. And I want to use my TMS320F28069 high performance.
So when I try sample all ADC channels at 100 khz it doesn't stable in 100 Khz. Its frequency changes. In TMS320F2806X technical reference book one sampling time is 444.44ns.
So in Simultaneous Sampling Mode 8*444.44ns = ~ 3.555 uS . So the maximum sampling frequency is 281 kHz. But I am not sampling in this rate. I am adding my adc setup code. What is the problem ??
Please help me.
EALLOW;
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;
(*Device_cal)();
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Power ADC BG
AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; // Power reference
AdcRegs.ADCCTL1.bit.ADCPWDN = 1; // Power ADC
AdcRegs.ADCCTL1.bit.ADCENABLE = 1; // Enable ADC
AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; // Select interal BG
AdcRegs.ADCCTL2.bit.CLKDIV2EN = 0;
//ADC Selection
GpioDataRegs.GPACLEAR.bit.GPIO29 = 1;
AdcRegs.ADCSAMPLEMODE.all=0x00FF;
AdcRegs.ADCCTL2.bit.ADCNONOVERLAP = 1; // Enable non-overlap mode
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1; // ADCINT1 trips after AdcResults latch
AdcRegs.INTSEL1N2.bit.INT1E = 1; // Enabled ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 0; // Disable ADCINT1 Continuous mode
AdcRegs.INTSEL1N2.bit.INT1SEL = 0x0F; // setup EOC1 to trigger ADCINT1 to fire
AdcRegs.ADCSOC0CTL.bit.CHSEL = 0x0; // set SOC0 channel select to ADCINA0
// AdcRegs.ADCSOC1CTL.bit.CHSEL = 0x0;
AdcRegs.ADCSOC2CTL.bit.CHSEL = 0x1;
// AdcRegs.ADCSOC3CTL.bit.CHSEL = 0x1;
AdcRegs.ADCSOC4CTL.bit.CHSEL = 0x2;
// AdcRegs.ADCSOC5CTL.bit.CHSEL = 0x2;
AdcRegs.ADCSOC6CTL.bit.CHSEL = 0x3;
// AdcRegs.ADCSOC7CTL.bit.CHSEL = 0x3;
AdcRegs.ADCSOC8CTL.bit.CHSEL = 0x4;
// AdcRegs.ADCSOC9CTL.bit.CHSEL = 0x4;
AdcRegs.ADCSOC10CTL.bit.CHSEL = 0x5;
// AdcRegs.ADCSOC11CTL.bit.CHSEL = 0x5;
AdcRegs.ADCSOC12CTL.bit.CHSEL = 0x6;
// AdcRegs.ADCSOC13CTL.bit.CHSEL = 0x6;
AdcRegs.ADCSOC14CTL.bit.CHSEL = 0x7;
// AdcRegs.ADCSOC15CTL.bit.CHSEL = 0x7;
AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 0; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC
AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 0; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC2CTL.bit.TRIGSEL = 0; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC
AdcRegs.ADCSOC3CTL.bit.TRIGSEL = 0; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC4CTL.bit.TRIGSEL = 0; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC
AdcRegs.ADCSOC5CTL.bit.TRIGSEL = 0; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC6CTL.bit.TRIGSEL = 0; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC
AdcRegs.ADCSOC7CTL.bit.TRIGSEL = 0; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC8CTL.bit.TRIGSEL = 0; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC
AdcRegs.ADCSOC9CTL.bit.TRIGSEL = 0; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC10CTL.bit.TRIGSEL = 0; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC
AdcRegs.ADCSOC11CTL.bit.TRIGSEL = 0; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC12CTL.bit.TRIGSEL = 0; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC
AdcRegs.ADCSOC13CTL.bit.TRIGSEL = 0; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC14CTL.bit.TRIGSEL = 0; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC
AdcRegs.ADCSOC15CTL.bit.TRIGSEL = 0; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC2CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC3CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC4CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC5CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC6CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC7CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC8CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC9CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC10CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC11CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC12CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC13CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC14CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC15CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
// PieVectTable.ADCINT1 = &adcHwiISR;
//PieCtrlRegs.PIEIER1.bit.INTx1 = 1;
IER |= M_INT1; // Enable CPU Interrupt 1
EDIS;