Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
jabba80
PostPosted: Jul 19, 2012 - 03:25 PM
Hangaround


Joined: Nov 27, 2007
Posts: 101


Hello,

is it possible to measure a Voltage from 0V to 5V on the differntial ADCIF of the UC3C?

I read about setting the negative input to ground (AVR32_ADCIFA_INN_GNDANA).
Nice trick, works great for all positive inputs, but what if I have to connect the signal to an ADC-Pin >= Input8 (which are negative Inputs)?

Setting the positive Input to GND (AVR32_ADCIFA_INP_GNDANA) won't help here, cause normally I'd suggest setting the positive Input to VCC. Sad

Greetings,
jabba
 
 View user's profile Send private message  
Reply with quote Back to top
jayjay1974
PostPosted: Jul 19, 2012 - 03:46 PM
Raving lunatic


Joined: Oct 30, 2002
Posts: 5720
Location: The Netherlands

You should bias one input to half way the range. 0-2.5 will read as negative and 2.5-5V as positive (or the other way around depending on which pin you bias).
 
 View user's profile Send private message  
Reply with quote Back to top
jabba80
PostPosted: Jul 19, 2012 - 04:17 PM
Hangaround


Joined: Nov 27, 2007
Posts: 101


so I need a physically existing free positive input?
 
 View user's profile Send private message  
Reply with quote Back to top
jayjay1974
PostPosted: Jul 19, 2012 - 07:40 PM
Raving lunatic


Joined: Oct 30, 2002
Posts: 5720
Location: The Netherlands

Maybe yes, maybe not. I don't know not no nothing about the AVR32.
 
 View user's profile Send private message  
Reply with quote Back to top
mikech
PostPosted: Jul 19, 2012 - 11:22 PM
Hangaround


Joined: Aug 19, 2003
Posts: 397
Location: Australia

I connect the positive input to the positive ground (input 10) which gives me a negative ADC result that can be converted to a positive value.

Now., the typedefs for the ADC make the result registers AVR32_ADCIFA.resx[] (incorrectly in my opionion) unsigned,
so if you get some really large numbers from a conversion try typecasting it to a signed 32-bit value.
 
 View user's profile Send private message  
Reply with quote Back to top
jabba80
PostPosted: Jul 20, 2012 - 07:25 AM
Hangaround


Joined: Nov 27, 2007
Posts: 101


I get the results from the sequencer which does this typecast already:
Code:
#define ADCIFA_read_resx_sequencer_0(ind)                                 ((int)AVR32_ADCIFA.resx[(ind)])

But nevertheless I think my problem is another one:
my reference is 2.5V at the ADCREF0-Input, but my single-ended measurement inputs have pull-ups to 5V. :/
 
 View user's profile Send private message  
Reply with quote Back to top
mikech
PostPosted: Jul 20, 2012 - 08:42 AM
Hangaround


Joined: Aug 19, 2003
Posts: 397
Location: Australia

Can you put a pulldown resistor on those inputs so that they form a voltage divider with the external pullups ?
 
 View user's profile Send private message  
Reply with quote Back to top
jabba80
PostPosted: Jul 20, 2012 - 10:12 AM
Hangaround


Joined: Nov 27, 2007
Posts: 101


Actually there is ... sorry for my incomplete explaination:

I now have a 4k7 to 5V VCC and a PTC (KTY11-6) for temperature measuring to GND. ( for testing purposes i replaced the KTYs by 2k resistors)

On the positive input (AVR32_ADCIFA_INP_ADCIN5) I have a voltage of 1,476V and the according negative input is set to AVR32_ADCIFA_INN_GNDANA.

On the negative input (AVR32_ADCIFA_INN_ADCIN13) I have a voltage of 1,485V and the according positive input is set to AVR32_ADCIFA_INP_GNDANA.

My reference is 2.5V on ADCREF0.

So I would expect an ADC-Value of about 1200 for the positive input and according to mikech -1200 for the negative input.
But surprisingly I get 1204 for the positive and -1084 for the negative input.

What went wrong here?
 
 View user's profile Send private message  
Reply with quote Back to top
mikech
PostPosted: Jul 21, 2012 - 01:32 AM
Hangaround


Joined: Aug 19, 2003
Posts: 397
Location: Australia

Your result for ADCIN5 is good, but your ADCIN13 is reading about .16V low, which leads me to suspect the Sample&Hold stage that handles ADCIN8-15.

Section 36.6.16 Calibration in the datasheet says to read the calibration values from the factory-page into the ADCCAL & SHCAL registers.
Factory page 15.10 Calibration Settings

Just did some reading of adcifa_configure(,,) and it sets calibration values into the registers but you will first need to call adcifa_get_calibration_data(,)
 
 View user's profile Send private message  
Reply with quote Back to top
jabba80
PostPosted: Jul 26, 2012 - 10:52 AM
Hangaround


Joined: Nov 27, 2007
Posts: 101


already appliedthe factory-page, like it's done in the adc-demo-application.

now i played a little bit with the sampling frequency and reduced it from 1Mhz to 200kHz. And surprise: i get correct values also on the negative inputs.

Why? And what to do so it works with higher frequency? (I need it, because i have to do some more samples in a defined time)
 
 View user's profile Send private message  
Reply with quote Back to top
mikech
PostPosted: Jul 26, 2012 - 12:25 PM
Hangaround


Joined: Aug 19, 2003
Posts: 397
Location: Australia

Do your 'negative' inputs have more impedance than the 'positive' inputs ?
You might need to increase the S/H settling time by setting MUXSET in the CFG register.

Another possibility is to reduce the resolution, do you need 12-bit resolution ?,
because according to the Electrical Characteristics section in the datasheet the maximum ADC clock is somewhere between 1.2 MHz and 2.4 MHz depending on what VDDANA you use and what resolution you want.

Do you really need to sample a
Quote:
PTC (KTY11-6)
thermistor at 1Msamples/sec ??????
 
 View user's profile Send private message  
Reply with quote Back to top
jabba80
PostPosted: Jul 26, 2012 - 02:26 PM
Hangaround


Joined: Nov 27, 2007
Posts: 101


Quote:
Do you really need to sample a
Quote:
PTC (KTY11-6)
thermistor at 1Msamples/sec ??????

Very Happy ... not really, but i have to do all samples (incluing some time-uncritical PTCs) within a very short period.

I'll try playing with that MUXSET-Bit you suggested.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits