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.

TMS320F2812: ADC conversion problem

Part Number: TMS320F2812

I have a problem with ADC conversion.

ADC is setup to single sequencer with 5 conversions.

Every 62.5 us ADC starts new conversion.

The internal reference is used and ADCREFP, ADCREFM are connected to ceramic cap 10uF.

The input is now connected to AGND.

The sampled value is around 55.

(It seems that this is offset, but if I decrease AdcRegs.ADCTRL3.bit.ADCCLKPS this value will increase!!!)

 When I check now min a max values I find many sampled values with 0 and many with 110, which seems to be double of offset.

 This log file shows only values sampled as 0 or more than 100.

 Start System log :27.02.2017 16:09:19

Timestamp   sampling value

1,001s : 0x0000 dez:00000
1,001s : 0x0000 dez:00000
1,117s : 0x0000 dez:00000
1,422s : 0x0070 dez:00112
1,422s : 0x0070 dez:00112
1,450s : 0x0000 dez:00000
1,450s : 0x0000 dez:00000
2,144s : 0x006D dez:00109
3,153s : 0x0000 dez:00000
3,153s : 0x0000 dez:00000
3,176s : 0x0000 dez:00000
3,550s : 0x0072 dez:00114
3,550s : 0x0072 dez:00114
3,600s : 0x0000 dez:00000
4,258s : 0x0000 dez:00000
4,258s : 0x0000 dez:00000
4,632s : 0x0000 dez:00000
4,710s : 0x0000 dez:00000
4,783s : 0x0000 dez:00000
4,783s : 0x0000 dez:00000
4,898s : 0x0000 dez:00000
4,898s : 0x0000 dez:00000
4,919s : 0x006B dez:00107
4,919s : 0x006B dez:00107
4,927s : 0x0000 dez:00000
4,927s : 0x0000 dez:00000
5,245s : 0x0000 dez:00000
5,246s : 0x0000 dez:00000
5,697s : 0x0000 dez:00000
5,697s : 0x0000 dez:00000
5,833s : 0x0000 dez:00000
5,850s : 0x0069 dez:00105
5,851s : 0x0069 dez:00105
6,019s : 0x0000 dez:00000
6,189s : 0x0000 dez:00000
6,189s : 0x0000 dez:00000
6,198s : 0x0069 dez:00105
6,198s : 0x0069 dez:00105
6,297s : 0x0000 dez:00000
6,368s : 0x0000 dez:00000
6,369s : 0x0000 dez:00000
6,656s : 0x0000 dez:00000
6,657s : 0x0000 dez:00000
6,838s : 0x0000 dez:00000
6,838s : 0x0000 dez:00000


Code:

void InitAdc(void) 
{

// Init ADC
	AdcRegs.ADCTRL3.bit.ADCBGRFDN = 0x3;	// Power up bandgap/reference circuitry
	DELAY_US(ADC_usDELAY);                  // Delay before powering up rest of ADC
	AdcRegs.ADCTRL3.bit.ADCPWDN = 1;		// Power up rest of ADC
	DELAY_US(ADC_usDELAY2);                 // Delay after powering up ADC
// End Init ADC

// Specific ADC setup :
   AdcRegs.ADCTRL1.bit.ACQ_PS = 0xf;   // S/H width in ADC module periods           = 16 ADC clocks
   AdcRegs.ADCTRL1.bit.CPS=0;
   AdcRegs.ADCTRL3.bit.ADCCLKPS = 15; // ADC module clock = HSPCLK/2*ADC_CKPS   = 60MHz/(2*2) = 15MHz
   AdcRegs.ADCTRL1.bit.SEQ_CASC = 0;        
   AdcRegs.ADCTRL1.bit.CONT_RUN = 0;       // Setup continuous run

   AdcRegs.ADCMAXCONV.bit.MAX_CONV1=4; 

   AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0;   
   AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 1;   
   AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 4;   
   AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 6;   
   AdcRegs.ADCCHSELSEQ2.bit.CONV04 = 7;   

   // Start SEQ1 by EVA
   AdcRegs.ADCTRL2.bit.EVA_SOC_SEQ1 = 1;
}

void GetADC(void)
{

  while (AdcRegs.ADCST.bit.INT_SEQ1== 0)
  {
	DELAY_US(1);
  }  // Wait for interrupt

 I1=AdcRegs.ADCRESULT0>>4;
 I2=AdcRegs.ADCRESULT1>>4;
 U1=AdcRegs.ADCRESULT2>>4;
 U2=AdcRegs.ADCRESULT3>>4;			
 U3=AdcRegs.ADCRESULT4>>4;			

 AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;

}

 

Do I have a software problem or a hardware problem?

  • Steve,

    How are you connecting the ADC input to AGND?  Is it a direct short or is it pulled through a resistor?

    Are all five ADC inputs biased to AGND?

    -Tommy

  • Tommy,
    ADC input is direct connected to AGND without any resistor.
    Only two inputs are based to AGND the other to GND.
    AGND is connected to GND via a ferrite, but at the moment I put out ferrite and make a short cut for it.
    All other ADC sampling inputs are open!

    -Steve
  • Steve,

    I assume that this is on a custom board.

    Can you configure the sequencer to only sample one channel at a time and see if the fluctuations track with a specific channel?

    Also, do you have any concurrent activity running when the ADC is sampling? I wonder if there might be noise coupling somewhere.

    -Tommy
  • Tommy,

    When I change sequencer to sample only one channel the result is better.

    I find my problem, it is a hardware problem of an additional board connected with a flat cable.

    When I disconnect the flat cable everything is fine.

    At the moment I make a 4 times oversampling of the input. This reduce the error more than 50%.

    Now I have time to search for the real problem.

    Steve

  • Steve,

    Thanks for reporting back your finding. I hope you will be able to find the root cause quickly. Let us know if you need any assistance.

    -Tommy