# Cypress Developer CommunityTM

## Questions on AN68403 PSoC5 ADC calibration

Summary: 11 Replies, Latest post by MattCoughlin on 19 Jul 2012 08:04 AM PDT
User
9 posts

I have read the application note AN68403 on the analog signal chain calibration.

Theoretically the offset of Delta-Sigma ADC should be constant across the full input range.

Based on the attached programm code, I found that this is not the case. The offset is the smallest around input range of 2-3V. At the range out of 2-3V, the offset becomes larger.

I am using the PSoC5 development kit CY8CKIT-050.

I modified the sample code found with AN68403.

Can someone please advise what went wrong? I need the offset of the ADC to be less than 2mV.

Thanks.

Attachments:
User
9242 posts

When you define (mathematically) the offset to be a constant, then the residing difference in ADC-conversion is the gain-error as stated in the mentioned app-note. So you will have to take the corrections needed to compensate for both, the offset error and the gain error.

Despite any non-linearities, but if you measure two values (below 2V and above 3V) you can solve the equation

Y = aX +b

for your specific PSoC. Here b is the offset (constant) and (1-a) is the gain error.

If you would like to exclude non-linearities as well, you will have to use a polynome of higher order, preferrably a Chebychew-solution.

Bob

User
7646 posts

I tried this on a PSOC 3 kit, looped on the signal chain gain and offset

measurement portion of routine, and got a fixed offset over a range

of VDAC = 1 to 4 V.

Regards, Dana.

User
9 posts

Hi All,

Thanks very much for your reply. I will try it again. :)

User
9 posts

Hi all,

I am still trying the AD calibration. I am using resistor ladder to provide Y value, and AD measurement as X value, then use the data to calculate a and b value of the formula Y=aX+b. Then i write a and b to EEPROM. After that i read a and b from EEPROM, and calculate actual value = a * measured value + b.

But i encounter the problem that i cannot read a & b from EEPROM, the value i write and i read are different.

Can anyone help me that what i do is wrong?

Thank a lot! :)

Attachments:
User
17 posts

I don't see anywhere you actually read from the EEPROM. You have the following statement, which I think you meant to be a read:

CYDEV_EE_BASE won't give you the contents of EEPROM at point 0 itself because it's really just a constant. The way I do EEPROM reads is by using a for loop similar to this:

for (i = 0; i < limit; i++)

{

buffer[i] = CY_GET_REG8(CYDEV_EE_BASE + i);

}

It's not exactly like that, because I wrote an NVM manager to make reads and writes simpler, but that should get you the information you want. This will fill the buffer array with the values from EEPROM, starting at CYDEV_EE_BASE and continuing until it's copied the limit you set.

Hope this helps.

User
7646 posts

If you are trying to wring out every last non linearity, offset, you might

consider using a power equation as curve fit, ~ 5'th order.

The reason I bring this up is most cmos OA's with R-R input CM range have

a problem with non linearity when the input stage switches over from N to P,

or vice versa, usually this is not disclosed in datasheets. A straight line equation

will not serve you well to handle this.

Here is a good description of the issue. http://www.maxim-ic.com/app-notes/index.mvp/id/656

Just a thought.

Regards, Dana.

User
9 posts

I have tried, but i can only read the first value correctly, the second one is still not correct.

Attachments:
User
9242 posts

I am not quite sure what the "first value" is you refer to but debugging may disturb ADC-conversions.

Although listed in the appnote I would (I tried, worked) remove the ADC_Startconvert() and ADC_Stopconvert() out of the loop and so convert more smoothly. Especially I would not read a result from ADC after stopping it. To check for correct values during test phase I would store some 10 values in an array and fill it, then looking at the values in the debugger. You may even capture (by software) the minimum and maximum values of converting the 1024 samples and haing a look at the derivation.

Check with an oscilloscope the noise level on your power-supply which will be an important item for precision and stability.

Bob

User
7646 posts

Several possibilities, but questions first -

1) Is first sample coming thru Chan 0 of mux ? And second mesurement thru Chan 1 ?

2) Are both these channels tied to your R divider ?

Some thoughts.

1) Using scope in differential comparator mode, offset scope so that you can see DC trace

centered on screen, at highest gain. Set scope to infinite persistance, and measure the

pk - pk noise over a few seconds. Does that value approximate the deviation you are seeing ?

Or stated another way how many LSBs of noise do you see on the scope ? If see 10's you have

too much system noise.

2) Bypassing, use polymer tantalums on both your R network and PSOC. Add .1 uF MLC

cermanics to both items.

3) Pay attention to any possible thermoelectric routing issues, see attached ap note.

Regards, Dana.

User
7646 posts

Another ap note that may be useful on grounding and coupling, attached.

Regards, Dana.

Attachments: