Problem with single ended ADC example project CY8CKIT-030

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi there,

   

I have CY8CKIT-030. I am using PSoC since last 6 months. I have downloaded example of ADC single ended mode. I am using the POT connected on P6[5] for VR. I wanted ADC conversation like this:

   

VR = VDDA Adc value = 0xFFFF

   

VR= VSSA Adc value = 0x0000

   

But when I have set the property window of ADC component for this I am getting wrong values. for VR = VSSA it shows 0xFFF8, and for VR = VDDA it shows 0x01B6, if I changes the POT position slightly above VSSA and below VDDA it gives correct values.

   

I have also included ADC_CountsTo_mVolts, but it also shows 4999 when VR = VSSA and 3398 when VR = VDDA. I have tried all modes of buffer, but no luck. I am not getting what i want. Is it like I missing something..?? I am attaching my Project Archive file generated from File---Create Workspace Bundle menu.

0 Likes
1 Solution
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I believe that basic operation, with buffer bypassed, gives you

   

a range of Vss to Vdd and correct readings. Its when you go outside

   

CM range, in this case Vss - 100 mV > Vx > Vdd + 100 mV that your

   

readings go outside 0 - 0xFFFF.

   

 

   

So just saturate your readings, eg

   

 

   

Vx = ( Vx > 0xFFFF ) ? 0xFFFF : Vx;        // Test for radings exceeding Vdd

   

Vx = ( Vx < 0 ) ? 0 : Vx;                              // Test for readings < 0

   

 

   

You can add the 100 mV into above tests is so desired, although that would

   

generate result < 0 or > 0xFFFF.

   

 

   

Regards, Dana.

View solution in original post

0 Likes
13 Replies
Anonymous
Not applicable

Hi Modrator,

   

I dont know how to move this thread from PSoC 3 "Device Programming" catagory to "PSoC 3 Architecture" Catagory. It is my sincere apology to all viewer, that I have made this mistake. Please help.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Don't worry about the placing of your question, we'll find it as long as you use a PSoC 3 entry, forum software is not capable of editing or re-positioning a post (to be true, forum software isn't capable of many things at all)..

   

 

   

There are some knowledge-base entries concerning your issue: Since ADC cannot be made totally error-free they always show some mismatching, but this can be calculated-off with some simple math.

   

Errors you find are

   

- Noise

   

- Offset Error

   

- Gain error

   

- Temerature error

   

and probably some more I've forgotten. Each of these errors initially built into the chip can be minimized,

   

have a look aththis knowledge-base articles (I found them by typing "ADC error" into the field "Keyword search" at top of this page) http://www.cypress.com/?id=4&rID=43218

   

 

   

Happy coding!

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You are using the wrong GetResult, GetResult16, should be GetResult32,

   

see notes below for API (dont forget to decalre output as 32 bit) -

   

 

   

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

You also need to be careful with the input configuration. It decides how close to the rails your input signal can get.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

When you config the DelSig the range is shown pictorialy

   

 

   

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi Bob Marlowe

   

Thank you for your valuable time, interest and reply. I will defiantly consider it with tuning of my ADC.

   

Hi danaaknight

   

Yes.. I got my answers from your post when I have gone (again and again) through component datasheet. My final result is attached here. Thanks again.

   

But still My question is what I have to do to get 0x0000 to 0xFFFF for 0v-5v.? (Vssa to Vdda) (my actual requirement). Thanks in advance.

   

Hi hli

   

Thank you for your reply. Can you suggest me the buffer mode.? It will be saving me from lot of pain. After seeing in snap as danaaknight suggested in above post, I think it will be Rail to Rail, Still it does not serve the purpose. Thanks in advance.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

If you are looking for real R-R performance you have to bypass the buffer. If you are

   

not concerned or need the gain the buffer provides. Look at your current config,

   

R-R with G = 1, buffer enabled., if you look at the graphic its not R-R, its < R-R

   

performance. Does not allow you to get to ground or to Vdd with input to buffer.

   

 

   

I am getting a Keil error, "Build error: L251: RESTRICTED MODULE IN LIBRARY NOT SUPPORTED "

   

So I cannot run your code.

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

I could open it and compile free of any warning with Creator 3.0

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Looks like my desktop Creator has to be reinstalled, compile on laptop fine.

   

I debugged, and changed/addeed code with this -

   

 

   

    

   

          

   

#include <stdio.h>

   

  

   

unsigned char buff[ 20 ];     // Buffer holding character conversion of ADC results in mV

   

unsigned char i = 0;

   

 

   

 

   

LCD_Position(1u,10u);

   

sprintf( buff, "%6d", ADC_DelSig_1_CountsTo_mVolts ( i32Output ) );

   

for ( i = 0; i < 6; LCD_Position( 1u, 10u + i ), LCD_PutChar( buff[ i ] ), i++ );

   

//LCD_PrintNumber( ADC_DelSig_1_CountsTo_mVolts (i32Output) );

   

 

   

And I get basically results you are looking for.

   

 

   

Note I do see values > 0xFFFF and have not measured to see if

   

input went outside CM range.

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi Top Contributor(s)

   

Thanks for replying. You guys helping a lot.

   

I don't know what is going on.. But more I dig, more I got confused.

   

To be frank I needed to calculate some parameters from this ADC output result(some counter and a 16bit PWM). It requires 16-bit resolution, I tried for even 15 bit but my ultimate slope is not satisfactory. For 16-bit what ever buffer mode I try, I can not get full range of 16 bit (0-65535 for VSS to VDD). For the buffer bypass mode I got some -Ve value (as result is 32 bit signed, thanks for the point Dana) for VSS and 0x000101B5 for VDD. I have tried this by shorting the ADC Input pin directly to VSSA and VDDA. The value between this two point is OK and according to the current configuration. Is it like I am getting the desired result, but I am confused enough to get the conversation done...??

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I believe that basic operation, with buffer bypassed, gives you

   

a range of Vss to Vdd and correct readings. Its when you go outside

   

CM range, in this case Vss - 100 mV > Vx > Vdd + 100 mV that your

   

readings go outside 0 - 0xFFFF.

   

 

   

So just saturate your readings, eg

   

 

   

Vx = ( Vx > 0xFFFF ) ? 0xFFFF : Vx;        // Test for radings exceeding Vdd

   

Vx = ( Vx < 0 ) ? 0 : Vx;                              // Test for readings < 0

   

 

   

You can add the 100 mV into above tests is so desired, although that would

   

generate result < 0 or > 0xFFFF.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Hi Dona,

   

Thanks you, finally you saved me from days pain. I think this satisfy my requirements. Even if I am saturating results here, it does not affect my other application result. My counter slope (ultimate parameters depends on ADC value) is within the range with this settings.

   

Thanks again.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi Dana,

   

Sorry for wrongly spelling your name.

   

Here with I am including the final concluded project example, in any case if someone need it. Please do comment if I have mistaken.

0 Likes