Part Number: TMS320F28335
Tool/software: Code Composer Studio
Greetings,
My project uses TMS320F28335 for reading ADC from ADCAIN0 to ADCBIN7 and from the control suit project named Example_2833xAdcSoc I managed get all these ADC's working with following modification
//AdcRegs.ADCTRL1.bit.CONT_RUN = 1;
AdcRegs.ADCMAXCONV.all = 0x0ff; // Setup 2 conv's on SEQ1
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0; // Setup ADCINA3 as 1st SEQ1 conv.
AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x1; // Setup ADCINA2 as 2nd SEQ1 conv.
AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x2; // Setup ADCINA1 as 3rd SEQ1 conv.
AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 0x3; // Setup ADCINA4 as 4th SEQ1 conv.
AdcRegs.ADCCHSELSEQ2.bit.CONV04 = 0x4; // Setup ADCINA0 as 5th SEQ2 conv.
AdcRegs.ADCCHSELSEQ2.bit.CONV05 = 0x5; // Setup ADCINA5 as 6th SEQ2 conv.
AdcRegs.ADCCHSELSEQ2.bit.CONV06 = 0x6; // Setup ADCINA6 as 6th SEQ2 conv.
AdcRegs.ADCCHSELSEQ2.bit.CONV07 = 0x7; // Setup ADCINA7 as 7th SEQ2 conv.
AdcRegs.ADCCHSELSEQ3.bit.CONV08 = 0x8; // Setup ADCINB0 as 8th SEQ2 conv.
AdcRegs.ADCCHSELSEQ3.bit.CONV09 = 0x9;
AdcRegs.ADCCHSELSEQ3.bit.CONV10 = 0xA;
AdcRegs.ADCCHSELSEQ3.bit.CONV11 = 0xB;
AdcRegs.ADCCHSELSEQ4.bit.CONV12 = 0xC;
AdcRegs.ADCCHSELSEQ4.bit.CONV13 = 0xD;
AdcRegs.ADCCHSELSEQ4.bit.CONV14 = 0xE;
AdcRegs.ADCCHSELSEQ4.bit.CONV15 = 0xF;
AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 = 1;// Enable SOCA from ePWM to start SEQ1
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1; // Enable SEQ1 interrupt (every EOS)
AdcRegs.ADCTRL2.bit.EPWM_SOCB_SEQ2 = 1;// Enable SOCB from ePWM to start SEQ2
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ2 = 1; // Enable SEQ2 interrupt (every EOS)
// Assumes ePWM1 clock is already enabled in InitSysCtrl();
EPwm2Regs.ETSEL.bit.SOCAEN = 1; // Enable SOC on A group
EPwm2Regs.ETSEL.bit.SOCASEL = 1;//4; // Select SOC from from CPMA on upcount
EPwm2Regs.ETPS.bit.SOCAPRD = 1; // Generate pulse on 1st event
//SOCB
EPwm2Regs.ETSEL.bit.SOCBEN = 1; // Enable SOC on B group
EPwm2Regs.ETSEL.bit.SOCBSEL = 1;//4; // Select SOC from from CPMB on upcount
EPwm2Regs.ETPS.bit.SOCBPRD = 1; // Generate pulse on 1st event
EPwm2Regs.CMPA.half.CMPA = 0x0080; // Set compare A value
EPwm2Regs.TBPRD = 0xFFFF; // Set period for ePWM1
EPwm2Regs.TBCTL.bit.CTRMODE = 0; // count up and start
interrupt void adc_isr(void)
{
Voltage1[ConversionCount] = AdcRegs.ADCRESULT0 >>4;
Voltage2[ConversionCount] = AdcRegs.ADCRESULT1 >>4;
Voltage3[ConversionCount] = AdcRegs.ADCRESULT2 >>4;
Voltage4[ConversionCount] = AdcRegs.ADCRESULT3 >>4;
Voltage5[ConversionCount] = AdcRegs.ADCRESULT4 >>4;
Voltage6[ConversionCount] = AdcRegs.ADCRESULT5 >>4;
Voltage7[ConversionCount] = AdcRegs.ADCRESULT6 >>4;
Voltage8[ConversionCount] = AdcRegs.ADCRESULT7 >>4;
Voltage9[ConversionCount] = AdcRegs.ADCRESULT8 >>4;
Voltage10[ConversionCount] = AdcRegs.ADCRESULT9 >>4;
Voltage11[ConversionCount] = AdcRegs.ADCRESULT10 >>4;
Voltage12[ConversionCount] = AdcRegs.ADCRESULT11 >>4;
Voltage13[ConversionCount] = AdcRegs.ADCRESULT12 >>4;
Voltage14[ConversionCount] = AdcRegs.ADCRESULT13 >>4;
Voltage15[ConversionCount] = AdcRegs.ADCRESULT14 >>4;
Voltage16[ConversionCount] = AdcRegs.ADCRESULT15 >>4;
// If 40 conversions have been logged, start over
if(ConversionCount == 16)
{
ConversionCount = 0;
}
else ConversionCount++;
Although this resulted in reading data from every ADC channels a particular ADC with ADCRESULT5 seems to be reading completely random data and varying range of 0 to 1V without any fluctuation in its input. Input provided is constant 2V although ADCRESULT5 gives the similar range sometimes but still the variation exists. Along with this when provided consistent voltage across every terminal of ADC there seems to be a sudden drop in voltage reading say 2.5V is provided as a n input the readout gives you around 2.4V on a normal basis and then all of sudden it reads out 0.368V and then comes back to reading 2.4V is there any explanation for this. The board used in custom and voltage source provided across the terminal are from precision voltage source and I have cross verified for any noise present in the signal it appears to be normal.
1.Is this configuration issue ?
2.What are my options to fine tune the ADC readout without spikes or drops which Im witnessing?
3.How to make the ADC readout precise for nearly 0.01 V?
I have been stuck with this bug for pretty long time now can anyone help me?

