Hi,
I'm working on power control application using F28335. I need to sample voltage on the B0 input pin. I put 0.3V which should give approx. 4096/10 =0x19A. But when I run my code in the debug mode it shows for the first a few debug stops between 0x7F1 and 0x7F5 and then these values interleaved with some divergent ones like 0x0500, 0x600, etc. I look up the values both in the ADCRESULTx and the buffer registers at 0x0B0x. Can the 50ms the ADC documentation's talking about needed after ADC power-up be a problem in the debug mode ? Even is the B) pin was by mistake not connected can the ADC result registers show value that suggests ADC sees 1.5V on the input ? (0x7FF -> 1.5/3V)
Here is the code that I'm using for 16 cascaded conversions in the continuous mode:
void
ADC_CascSeqCNF(int ChSel[], int ACQPS, int NumConvSEQ1, int mode)
{
// ADC power-up sequence
AdcRegs.ADCTRL3.bit.ADCBGRFDN = 0x3;
// Power up bandgap/reference circuitry
AdcRegs.ADCTRL3.bit.ADCPWDN = 0x1;
// Power up rest of ADC
// ADC Acquisition window select and Channel allocation
AdcRegs.ADCTRL3.bit.ADCCLKPS=0;
// ADCCLK=12.5 MHz @ HSCLK=25MHz
AdcRegs.ADCTRL1.bit.ACQ_PS= ACQPS;
// Window aperture
// ADC Sequencer and Interrupt Init
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1;
// Single 16 state sequencer
AdcRegs.ADCTRL1.bit.SEQ_OVRD = 0; // Wrap at MaxConv// # of Conversions & Input channel Allocation
AdcRegs.ADCMAXCONV.all = (NumConvSEQ1-1);
// Number of conversions
AdcRegs.ADCCHSELSEQ1.bit.CONV00=ChSel[0];
// 1st conv - Sequencer 1
AdcRegs.ADCCHSELSEQ1.bit.CONV01=ChSel[1]; // 2nd conv - Sequencer 1
AdcRegs.ADCCHSELSEQ1.bit.CONV02=ChSel[2];
// 3rd conv - Sequencer 1
AdcRegs.ADCCHSELSEQ1.bit.CONV03=ChSel[3];
// 4th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ2.bit.CONV04=ChSel[4];
// 5th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ2.bit.CONV05=ChSel[5];
// 6th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ2.bit.CONV06=ChSel[6];
// 7th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ2.bit.CONV07=ChSel[7];
// 8th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ3.bit.CONV08=ChSel[8];
// 9th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ3.bit.CONV09=ChSel[9];
// 10th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ3.bit.CONV10=ChSel[10];
// 11th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ3.bit.CONV11=ChSel[11];
// 12th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ4.bit.CONV12=ChSel[12];
// 13th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ4.bit.CONV13=ChSel[13];
// 14th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ4.bit.CONV14=ChSel[14];
// 15th conv - Sequencer 1
AdcRegs.ADCCHSELSEQ4.bit.CONV15=ChSel[15];
// 16th conv - Sequencer 1
if (mode==0)
{AdcRegs.ADCTRL1.bit.CONT_RUN = 0; // Start-Stop Conv mode
AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 = 1; // Start Conv via ePWM SOCA trigger event}
if (mode==1)
{AdcRegs.ADCTRL1.bit.CONT_RUN = 1;
// Continuous Conv mode
AdcRegs.ADCTRL2.bit.SOC_SEQ1 = 1;
// Kick-start the ADC now}}
It is called from the main() with the following code
for(i=0;i<16; i++) ChSel[i] = 8; //void ADC_CascSeqCNF(int ChSel[], int ACQPS, int NumConvSEQ1, int mode) ADC_CascSeqCNF(ChSel, 2, 16, 1);
// ACQPS=2, #Conv=2, Mode=Continuous
}
