Hello,
I've set up a custom PCB with the F28069 on it. I am using 5 ADC channels, which are biased at 1.65 V. VREF-HI is set at 3.3V and VREF-LO is set at GND.
I'm using some test software to see the device running and all other functions on the board are working except the ADC. To test the ADC, I initialize the ADC with the code at the bottom of the page. Then, I individually force each SOC with software and look at the ADCRESULT .
ADCRESULT0 is close to 4095 (which corresponds to 3.3V on the 12-bit ADC). This value should be incorrect.
All the other ADCRESULTS are close to 2000 (which corresponds to ~1.65V on the 12-bit ADC). These values seem to be correct.
When I check the inputs to all of the pins, they are all at just about 1.65V, even the pin that feeds to ADCRESULT0. What is the issue here? Why is one of the ADC channels incorrect, but all of the other ones correct?
Thanks,
Matthew
ADC Initialization Code:
EALLOW;
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Power up band gap
AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; // Power up reference
AdcRegs.ADCCTL1.bit.ADCPWDN = 1; // Power up rest of ADC
AdcRegs.ADCCTL1.bit.ADCENABLE = 1;// set timing to 13cycles as required by ADC module
for (i = 0; i < 10000; i++) {
} // wait 60000 cycles = 1ms (each iteration is 12 cycles)
AdcRegs.ADCCTL2.bit.CLKDIV2EN = 1;
AdcRegs.ADCCTL2.bit.CLKDIV4EN = 0;
AdcRegs.ADCCTL2.bit.ADCNONOVERLAP = 1; // Overlap is not allowed
AdcRegs.ADCSAMPLEMODE.bit.SIMULEN0 = 0;
AdcRegs.ADCINTSOCSEL1.bit.SOC0 = 0; // No ADCINT triggers SOC0. TRIGSEL field determines trigger.
AdcRegs.ADCINTSOCSEL1.bit.SOC1 = 0;
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdcRegs.SOCPRICTL.bit.RRPOINTER = 0xF;
AdcRegs.SOCPRICTL.bit.SOCPRIORITY = 0;// All SOCs handled in round-robin mode
// Configure ADC
AdcRegs.ADCSOC0CTL.bit.CHSEL = 0;
AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 0;
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6;//set SOC0 S/H Window to 8 ADC Clock Cycles, (8 ACQPS plus 1)
AdcRegs.ADCSOC1CTL.bit.CHSEL = 1;
AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 0;
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6;//set SOC0 S/H Window to 8 ADC Clock Cycles, (8 ACQPS plus 1)
AdcRegs.ADCSOC2CTL.bit.CHSEL = 2;
AdcRegs.ADCSOC2CTL.bit.TRIGSEL = 0;
AdcRegs.ADCSOC2CTL.bit.ACQPS = 6;//set SOC0 S/H Window to 8 ADC Clock Cycles, (8 ACQPS plus 1)
AdcRegs.ADCSOC3CTL.bit.CHSEL = 3;
AdcRegs.ADCSOC3CTL.bit.TRIGSEL = 0;
AdcRegs.ADCSOC3CTL.bit.ACQPS = 6;//set SOC0 S/H Window to 8 ADC Clock Cycles, (8 ACQPS plus 1)
AdcRegs.ADCSOC4CTL.bit.CHSEL = 4;
AdcRegs.ADCSOC4CTL.bit.TRIGSEL = 0;
AdcRegs.ADCSOC4CTL.bit.ACQPS = 6;//set SOC0 S/H Window to 8 ADC Clock Cycles, (8 ACQPS plus 1)