Tool/software:
Hi,
I'm using the built-in ADC of the TMS320F2812PGFA CG (Revision G). In my application, I am sampling a very slow sensor signal that decreases as temperature increases (temperature range: 22 to 300 °C). When sampling the signal at room temperature, it produces a very noisy output with approximately 250 counts of noise.
I am not sure whether there is something wrong with my ADC configuration at the register level. I have also double-checked the hardware PCB design and couldn't find any issues.
Thank you in advance for your assistance.
The following figure illustrates the noise band:
ADC counts ranging from Min: 2450 to Max: 2600
y-axis: ADC counts
x-axis: t in s (100 ms in total, as 1000 samples are shown)

void InitAdc(void)
{
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
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1;
AdcRegs.ADCTRL1.bit.CONT_RUN = 0;
AdcRegs.ADCTRL1.bit.CPS = 0;
AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 0;
//ADCINA1
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x1;
AdcRegs.ADCTRL2.bit.EVB_SOC_SEQ = 1;
// AdcRegs.ADCTRL2.bit.EVA_SOC_SEQ1 = 1;
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1;
// ADC clock prescaler ADCCLKPS = 0010 -> FCLK = 18.75
AdcRegs.ADCTRL3.bit.ADCCLKPS = 2;
EvbRegs.GPTCONB.bit.T4STAT = 1; //Counting upward
EvbRegs.GPTCONB.bit.TCMPOE = 0; //high-impedance state
EvbRegs.GPTCONB.bit.T4PIN = 0; //Forced low
EvbRegs.GPTCONB.bit.T4TOADC = 2; //Setting of period interrupt flag starts ADC
//T4CON Timer 4 Control Register
EvbRegs.T4CON.bit.FREE = 0; //Stop on emulation suspend
EvbRegs.T4CON.bit.SOFT = 0; //Stop on emulation suspend
EvbRegs.T4CON.bit.TMODE = 2; //Continous-Up Count Mode
EvbRegs.T4CON.bit.TPS = 7; //Input clock prescaler
EvbRegs.T4CON.bit.T4SWT3 = 0; //0: use own tenable bit; 1: use tenable to T4CON
EvbRegs.T4CON.bit.TENABLE = 1; //0: disable timer op; 1: enable timer op
EvbRegs.T4CON.bit.TCLKS10 = 0; //clock source: internal
EvbRegs.T4CON.bit.TCLD10 = 3; //reserved
EvbRegs.T4CON.bit.TECMPR = 0; //0: disable timer compare; 1: enable timer compare
EvbRegs.T4CON.bit.SET3PR = 0; //0: use own period; 1: use T4PR
EvbRegs.T4PR = 58594; // Sampling rate = 10 Hz
}
//Interrupt Routine
interrupt void ADCINT_ISR(void)
{
EALLOW;
SysCtrlRegs.WDKEY = 0x55;
EDIS;
rawValue = (AdcRegs.ADCRESULT0) >> 4;
AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1;
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
...
}