AnsweredAssumed Answered

PGA of ADC0 is generating periodic spikes when no input is applied

Question asked by renganathan bs on Dec 18, 2014
Latest reply on Jan 6, 2015 by xiangjun.rong

I am trying to amplify an input signal of 500 uV Vp-p and when i saw the output it was generating a spike going from 65000 and 0. The output looks how an unstable amplifier behaves. This happens even if I don't apply the signals. This is the code I have used to make the PGA work. Also I don't have good idea on how to select the Vref for the PGA. As of now my ADC0 is connected to external Vref.

 

Code :

This is done to enable the PGA

void adc_pga_config()

{

  ADC0_PGA = 0x960000;

  //vref_init();

}

// intialise the adc0

void ADC0_Init16b(void)

{

        SIM_SCGC6 |= SIM_SCGC6_ADC0_MASK; //Gives clock to ADC0

 

        ADC0_CFG1 = (ADC_CFG1_MODE(3) | ADC_CFG1_ADIV(2)); //16bit mode

  ADC0_SC1A = ADC_SC1_ADCH(31); //disable module

 

 

        /* Configure ADC pins as ADC Inputs manually */

       

        /*In Kinetis the ADC pins are ADC inputs by default */

       

}

// Function used to get the adc value

unsigned short ADC0_Read16b(unsigned char channelNumber)

{

    ADC0_SC1A = 0x22;                /* Write to ADCSC1 to start conversion */

    while (!(ADC0_SC1A & 0xA2)); /* Wait until the conversion is complete */

    return ADC0_RA;

}

 

Connection :

Input is connected to PGA0_DP0 and PGA0_DM0 is connected to ground. ADC0 channel 2 is used to capture the signal .

 

Help me out with this one. Thanks in advance.

Outcomes