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.

ADC random startup offset on TMS320F28377S

Other Parts Discussed in Thread: TMS320F28377S

Hello,

I have a custom board with the TMS320F28377S processor. The ADC values are not consistent when I start up the processor. According to the watch window, they will start up with an offset of +/- 50 units from previous runs. 

My ADCs are initialized as follows:

void ConfigureADC(void)
{
	//Write ADC configurations and power up the ADC for both ADC A
	Uint16 i;

	EALLOW;

	//write configurations for ADC-A
	// External REFERENCE must be provided

	AdcaRegs.ADCCTL2.bit.PRESCALE   = 6; //set ADCCLK divider to /4 - max is 50 MHz from table 5.43 in www.ti.com/lit/ds/symlink/tms320f28377s.pdf
										// also see table 9-14 in www.ti.com/.../spruhx5c.pdf for codes/values to get divisors
	AdcSetMode(ADC_ADCA,RESOLUTION_12BIT,SIGNAL_SINGLE);

	//Set pulse positions to late  - ADC interrupt happens after result0 should be valid
	AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;

	//power up the ADC
	AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;

	//write configurations for ADC-B
	// External REFERENCE must be provided

	AdcbRegs.ADCCTL2.bit.PRESCALE   = 6; //set ADCCLK divider to /4
	AdcSetMode(ADC_ADCB,RESOLUTION_12BIT,SIGNAL_SINGLE);


	//Set pulse positions to late - ADC interrupt happens after Result0 should be valid
	AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;

	//power up the ADC
	AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;


	//delay for > 1ms to allow ADC time to power up
	for(i = 0; i < 1000; i++){
		asm("   RPT#255 || NOP");
	}

	EDIS;
}

and the ADCs I am reading are:

	// EPWM3 trigger channels (Resolver)

	// Resolver channels run at higher (synchronous demod) frequency on ADC A channel SOC0, SOC1
	//  For resolver these were triggered off ePWM3 SOCa to be synchronous with ePWM3 that would generate resolver excitation
	//	For GL-10 gen we are just using these inputs as analog bus measurements, so we will trigger them off ePWM7 like the rest of the system
	// Resolver Fbk - sine @ A0 (GENSET - BUS_V)
	// ********************************
	AdcaRegs.ADCSOC0CTL.bit.CHSEL     = 0;    // aSOC0 will convert pin A0
	AdcaRegs.ADCSOC0CTL.bit.ACQPS     = 30;   // sample window in SYSCLK cycles (or ADCCLK cycles?)
//	AdcaRegs.ADCSOC0CTL.bit.TRIGSEL   = 9;   // trigger on ePWM3 SOCA
	AdcaRegs.ADCSOC0CTL.bit.TRIGSEL   = 0x11;   // trigger on ePWM7 SOCA for GL-10 gen

	// Resolver Fbk - cos @ A1 (GENSET - ALT_CS)
	// ********************************
	AdcaRegs.ADCSOC1CTL.bit.CHSEL     = 15;    // aSOC1 will convert pin A15 **(A1 on AFIO board connected to A15 on CPU board thru 40pin connector)**
	AdcaRegs.ADCSOC1CTL.bit.ACQPS     = 30;   // sample window in SYSCLK cycles
//	AdcaRegs.ADCSOC1CTL.bit.TRIGSEL   = 9;   // trigger on ePWM3 SOCA
	AdcaRegs.ADCSOC1CTL.bit.TRIGSEL   = 0x11;   // trigger on ePWM7 SOCA for GL-10 gen

	// Batt current @ B0 (GENSET - BAT_CS)
	AdcbRegs.ADCSOC0CTL.bit.CHSEL     = 0;    // bSOC0 will convert pin B0
	AdcbRegs.ADCSOC0CTL.bit.ACQPS     = 30;   // sample window in SYSCLK cycles
	AdcbRegs.ADCSOC0CTL.bit.TRIGSEL   = 0x11;   // trigger on ePWM7 SOCA

Has anyone had a startup offset problem like this before? The offset seems random and inconsistent. From the technical reference manual, there is some info on zero offset calibration, but I'm not sure if I completely understand how to implement it. Is there any example code for this processor for zero offset calibration? Sometimes, a grounded pin will read ~10-20 in the ADC result register. 

Any help is appreciated - I've been trying to troubleshoot this for over 3 months!

  • Hi Vishaal,

    This does seem like very strange behavior.

    I don't think the HW offset calibration will help you here; the range of the trim is only about +/-8 LSBs in 12-bit mode. You can confirm that the offset trim register is the same each time the device is powered and configured (the set mode function will load the offset trim). Note that it is ok if the offset trim is different between ADCA and ADCB. It is also ok if the trim is '0' - the offset is quite tight even before trim.

    Since this is a custom board, the first places to look are probably the reference connections. What circuit do you have driving VREFHI, and do you have VREFLO directly and strongly connected to the ground plane? Have you used a DMM to measure the voltage on the VREFHI pin? Are you sure the VREFHI circuit isn't having issues with oscillations? - care is needed to drive a large capacitive load with an op-amp - you may also want to use an oscilloscope to observe the VREFHI pin.

    Have you tried sampling the internal VREFLO connections (these are mapped to channels 8 and 9 on every ADC)? These are definitely expected to give near 0 output when sampled.

    The next place to look could be at the input driving circuits. Note that pin A0 has a parasitic load from the buffered DAC module that makes it harder to drive than other ADC input pins which aren't muxed with a DAC. Are the ADC inputs of interest driven by an op-amp? Is there some R and C after the op-amp on the ADC pin?
  • Hi Devin,

    Apologies for the late follow-up, and thank you for your helpful response!

    I realized I had not done the HW offset calibration correctly (didn't know Ch8 and 9 were VREFLO) so I tried that again - it didn't make a difference as you suspected. Using the instructions on the technical reference manual, the HW offset calibration ends up making the OFFTRIM for A and B 100 and 95, respectively. This was achieved by converting VREFLO 16*32 times.

    Watching a SOC that is converting channel 8 on the watch window shows 0.

    I have checked the VREFHI and VREFLO pins as close to the processor as possible, and found that they are stable. The custom board I am using has a solid analog ground plane that is separate from the digital ground. I ran a test where I watched the ADC value on the watch window while simultaneously probing the processor ADC input pin on an oscilloscope. On processor reset, the ADC value would start up inconsistently by 50-100 units, whereas the voltage at the pin would only vary by ~30 mV at most.

    I also realized that the chip we are using is not the TMS, but the TMX320. Do you think this might have something to do with the problems we are seeing?

  • Hi Vishaal,

    Is the 50-100LSBs of variation only on the external input, or is this also happening when sampling the VREFLO connections?  Can you elaborate a little more on the external 30mV of variation?  It may be good to use a stable DC voltage source driven from a function generator to ensure that the problem is in the ADC itself. 

    What did you use to measure the VREFHI pin? - a multimeter may not be able to see oscillations here. 

    I don't think this device being TMX should have too much effect here.  The ADC may not be trimmed, but the offset should actually be pretty good without trim, and the offset definitely shouldn't be changing power-cycle to power-cycle.   

    Another thing to check may be power-up sequence.  Is VREFHI applied before VDDA comes up?  

    Can you provide the reference driving portions of the schematic?