Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > Questions on AN68403 PSoC5 ADC calibration

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Questions on AN68403 PSoC5 ADC calibration
Moderator:
ANCY

Post Reply
Follow this topic



Questions on AN68403 PSoC5 ADC calibration

Hui Xin posted on 06 Jul 2012 2:07 AM PST
Member
9 Forum 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.




Re: Questions on AN68403 PSoC5 ADC calibration

Bob Marlowe posted on 06 Jul 2012 02:22 AM PST
Top Contributor
1768 Forum 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



Re: Questions on AN68403 PSoC5 ADC calibration

danaaknight posted on 06 Jul 2012 04:43 AM PST
Top Contributor
1773 Forum 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.



Re: Questions on AN68403 PSoC5 ADC calibration

Hui Xin posted on 09 Jul 2012 06:01 PM PST
Member
9 Forum Posts

Hi All,

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



Re: Questions on AN68403 PSoC5 ADC calibration

Hui Xin posted on 18 Jul 2012 02:08 AM PST
Member
9 Forum 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! :)

 



Re: Questions on AN68403 PSoC5 ADC calibration

MattCoughlin posted on 18 Jul 2012 06:10 AM PST
Senior Member
17 Forum 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:

 

read_pt = (uint8 *)CYDEV_EE_BASE;

 

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.



Re: Questions on AN68403 PSoC5 ADC calibration

danaaknight posted on 18 Jul 2012 06:43 AM PST
Top Contributor
1773 Forum 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.



Re: Questions on AN68403 PSoC5 ADC calibration

Hui Xin posted on 18 Jul 2012 08:49 PM PST
Member
9 Forum Posts

10Q for your help!

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

Would you please help me to see what i do wrong?

 



Re: Questions on AN68403 PSoC5 ADC calibration

Bob Marlowe posted on 19 Jul 2012 10:48 PM PST
Top Contributor
1768 Forum 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



Re: Questions on AN68403 PSoC5 ADC calibration

danaaknight posted on 19 Jul 2012 04:05 AM PST
Top Contributor
1773 Forum 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.

 

 



Re: Questions on AN68403 PSoC5 ADC calibration

danaaknight posted on 19 Jul 2012 04:10 AM PST
Top Contributor
1773 Forum Posts

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

 

Regards, Dana.

 



Re: Questions on AN68403 PSoC5 ADC calibration

MattCoughlin posted on 19 Jul 2012 06:04 AM PST
Senior Member
17 Forum Posts

 I assume this is where you are now trying to read:

LCD_Char_1_Position(1,0);

LCD_Char_1_PrintNumber(CY_GET_REG16(CYDEV_EE_BASE));

LCD_Char_1_Position(1,8);

LCD_Char_1_PrintNumber(CY_GET_REG16(CYDEV_EE_BASE+1));

 

CYDEV_EE_BASE + 1 will not bring you to the next value, just the next byte. You need to add an amount that will bring you to the beginning of the second value you want. I think fixing that will work.

 

Matt






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20