This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28335: Error in ADC value

Part Number: TMS320F28335

Tool/software: Code Composer Studio

Hi,

I am trying to read the ADC value of a sine wave using the ADC Pin A2,A3 and A4 on board. I have clamped the sine wave before connecting it to the ADC Pin. The Problem is that even before i connect the ADC pins to the sine wave source i see the  ADC values continuously changing , I dont know the reason , Can anyone please clear the query?

I use the following code for the ADC initialisation

AdcRegs.ADCTRL1.all=0;

AdcRegs.ADCTRL1.bit.ACQ_PS=1;

AdcRegs.ADCTRL1.bit.SEQ_CASC=0x1;

AdcRegs.ADCTRL1.bit.CPS=0;

AdcRegs.ADCTRL1.bit.CONT_RUN=0;

AdcRegs.ADCTRL2.all=0;

AdcRegs.ADCTRL2.bit.SOC_SEQ1=0;

AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1=1;

AdcRegs.ADCTRL2.bit.INT_MOD_SEQ1=0;

AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1=1;

AdcRegs.ADCTRL3.bit.SMODE_SEL=0x1;

AdcRegs.ADCTRL3.bit.ADCCLKPS=3;

AdcRegs.ADCMAXCONV.all=0x00F;

AdcRegs.ADCCHSELSEQ2.bit.CONV05=0x5;

AdcRegs.ADCCHSELSEQ1.bit.CONV03=0x3;

AdcRegs.ADCCHSELSEQ2.bit.CONV04=0x4;

Thanks and Regards,

Prithvi

  • Prithvi,

    The ADC will convert whatever voltage is on its ADCIN pin, even if that pin is not connected/floated.

      In this case it will give a value related to some of the internal node voltages, this is normal.  Once the pin is driven with an external voltage it will charge the sample and hold cap correctly on an ADC sample event.  I would recommend supplying a DC value to the ADC pin while you are debugging the ADC settings and then giving the sinusoid once you are satisfied with the conversions of the DC value.

    Best,
    Matthew

  • Hi ,

    Thanks for the feedback.

    Now another doubt is that when i read the Dc value from the source directly i am some problem but for the same code when i read the Dc value from the voltage divider circuit i am getting the exact Dc value .

    What could be the problem ?

    Thanks and Regards,

    Prithvi

  • Prithvi,

    In order to convert accurately, the voltage on the internal Ch capacitor needs to settle within the ACQ_PS window.  You can find the ADC Input model in the datasheet:

    See if your conversion error improves when slowing down the ADC sampling by increasing the ACQ_PS or the ADC clock divider.  If so, the problem is most likely due to a mismatch in input signal conditioning versus the ADC sampling speed.

    -Tommy