Hi, After lots of figuring out, I finally seem to have gotten my ADC10 to work. I used another MSP430 to send a square wave to my receiving MSP430, and my receiving MSP430 seemed to get data results ok: ie: results: 0, 1023, 0, 3, 1023, 0, 1024, 0, 0, 1024, 1023,... The annoying thing is that interspersed at times is a group of two values that are the same.. I guess my baseband algorithm will have to take care of that? The *real* problem occured when I hooked up a DC supply to test out my ADC10. So, I set my DC voltage at ~1.0V and input it to my MSP430 ADC10. However, my results buffer looks like: results: 360, 369, 358, 359, 360, 363, ... Granted, they are all the same values as they should be (DC power supply as input), but the values are *way* off. If I change my supply to ~0.5V (so 0.5V input DC signal to ADC10), results: 125, 127, 126, 126, 125, ... If I change my supply voltage to 0V, results: 26, 21, 22, 21, 21, 13, 24, 23, ... If I change my supply voltage (ADC10 input) to ~1.2V, results: 370, 367, 370, 367, ... I am using the TI starter kit test board, so I'm pretty sure there is no voltage division going on at the ADC10 input pin (I am using port 3.7, which is input channel A7). Does someone know why I am getting such weird results for the power supply as input, but good results using another MSP430? Am I doing something very wrong? If my code is needed, I'd be glad to post it. Thanks for your time, Sincerely, Rich
Weird ADC results
Started by ●August 23, 2005
Reply by ●August 23, 20052005-08-23
I'm guessing these results are just too weird for anyone to know the
problem? Any takers?
--- In msp430@msp4..., "finfets" <finfets@y...> wrote:
> Hi,
>
> After lots of figuring out, I finally seem to have gotten my ADC10 to
> work. I used another MSP430 to send a square wave to my receiving
> MSP430, and my receiving MSP430 seemed to get data results ok: ie:
>
> results: 0, 1023, 0, 3, 1023, 0, 1024, 0, 0, 1024, 1023,...
>
> The annoying thing is that interspersed at times is a group of two
> values that are the same.. I guess my baseband algorithm will have to
> take care of that?
>
>
> The *real* problem occured when I hooked up a DC supply to test out my
> ADC10. So, I set my DC voltage at ~1.0V and input it to my MSP430
> ADC10. However, my results buffer looks like:
>
> results: 360, 369, 358, 359, 360, 363, ...
>
>
> Granted, they are all the same values as they should be (DC power
> supply as input), but the values are *way* off. If I change my supply
> to ~0.5V (so 0.5V input DC signal to ADC10),
>
> results: 125, 127, 126, 126, 125, ...
>
>
> If I change my supply voltage to 0V,
> results: 26, 21, 22, 21, 21, 13, 24, 23, ...
>
> If I change my supply voltage (ADC10 input) to ~1.2V,
> results: 370, 367, 370, 367, ...
>
>
>
> I am using the TI starter kit test board, so I'm pretty sure there is
> no voltage division going on at the ADC10 input pin (I am using port
> 3.7, which is input channel A7).
>
>
> Does someone know why I am getting such weird results for the power
> supply as input, but good results using another MSP430? Am I doing
> something very wrong? If my code is needed, I'd be glad to post it.
>
>
> Thanks for your time,
> Sincerely,
> Rich
Reply by ●August 23, 20052005-08-23
I'll do my best: On Tuesday 23 August 2005 12:10 pm, finfets wrote: > I'm guessing these results are just too weird for anyone to know the > problem? Any takers? > > --- In msp430@msp4..., "finfets" <finfets@y...> wrote: > > Hi, > > > > After lots of figuring out, I finally seem to have gotten my ADC10 to > > work. I used another MSP430 to send a square wave to my receiving > > MSP430, and my receiving MSP430 seemed to get data results ok: ie: > > > > results: 0, 1023, 0, 3, 1023, 0, 1024, 0, 0, 1024, 1023,... This just seems that the square wave is very near your nyquist frequency. What are you sampling at? What freq is the square wave? > > The annoying thing is that interspersed at times is a group of two > > values that are the same.. I guess my baseband algorithm will have to > > take care of that? You should be able to get the resolution you need by upping the sampling rate. If you don't want that many samples, just average out the results. > > > > The *real* problem occured when I hooked up a DC supply to test out my > > ADC10. So, I set my DC voltage at ~1.0V and input it to my MSP430 > > ADC10. However, my results buffer looks like: > > > > results: 360, 369, 358, 359, 360, 363, ... I don't see a problem here, assuming 3.3 volts reference: (3.3volts / 2^10) * 360 = 1.16 1.16 is close enough to 1.0 that I'd say it's within tolerance. > > > > Granted, they are all the same values as they should be (DC power > > supply as input), but the values are *way* off. If I change my supply > > to ~0.5V (so 0.5V input DC signal to ADC10), > > > > results: 125, 127, 126, 126, 125, ... Same here: (3.3volts / 2^10) * 125 = 0.402 once again definitely in the ballpark. > > > > If I change my supply voltage to 0V, > > results: 26, 21, 22, 21, 21, 13, 24, 23, ... Again, in the ballpark. > > If I change my supply voltage (ADC10 input) to ~1.2V, > > results: 370, 367, 370, 367, .. Same..it's all making sense to me so far, what's the problem? > > Does someone know why I am getting such weird results for the power > > supply as input, but good results using another MSP430? Am I doing > > something very wrong? If my code is needed, I'd be glad to post it. I don't see anything weird myself. Can you explain what you think is weird in more detail? -Micah
Reply by ●August 23, 20052005-08-23
Hello Micah, Thanks for the quick response: --- In msp430@msp4..., Micah Stevens <micah@9...> wrote: > > I'll do my best: > > On Tuesday 23 August 2005 12:10 pm, finfets wrote: > > I'm guessing these results are just too weird for anyone to know the > > problem? Any takers? > > > > --- In msp430@msp4..., "finfets" <finfets@y...> wrote: > > > Hi, > > > > > > After lots of figuring out, I finally seem to have gotten my ADC10 to > > > work. I used another MSP430 to send a square wave to my receiving > > > MSP430, and my receiving MSP430 seemed to get data results ok: ie: > > > > > > results: 0, 1023, 0, 3, 1023, 0, 1024, 0, 0, 1024, 1023,... > > This just seems that the square wave is very near your nyquist frequency. What > are you sampling at? What freq is the square wave? > I am sending my square wave at 43.0 kHz. I am sampling at 196 kHz, as that is my frequency of my TimerA (which is used to trigger the ADC10). As an aside, I will be taking the basic upper division signals and systems course this fall, so I will definitely become more familiar with the nyquist stuff. I did learn about it in the intro signals and systems course, but I forgot it :D > > > The annoying thing is that interspersed at times is a group of two > > > values that are the same.. I guess my baseband algorithm will have to > > > take care of that? > > You should be able to get the resolution you need by upping the sampling rate. > If you don't want that many samples, just average out the results. > > > > > > > The *real* problem occured when I hooked up a DC supply to test out my > > > ADC10. So, I set my DC voltage at ~1.0V and input it to my MSP430 > > > ADC10. However, my results buffer looks like: > > > > > > results: 360, 369, 358, 359, 360, 363, ... > > I don't see a problem here, assuming 3.3 volts reference: > > (3.3volts / 2^10) * 360 = 1.16 > > 1.16 is close enough to 1.0 that I'd say it's within tolerance. > Ok, you are totally right! I *am* using a 3.3V reference. That was quite stupid of me. > > > > > > Granted, they are all the same values as they should be (DC power > > > supply as input), but the values are *way* off. If I change my supply > > > to ~0.5V (so 0.5V input DC signal to ADC10), > > > > > > results: 125, 127, 126, 126, 125, ... > Same here: > (3.3volts / 2^10) * 125 = 0.402 > > once again definitely in the ballpark. > > > > > > > If I change my supply voltage to 0V, > > > results: 26, 21, 22, 21, 21, 13, 24, 23, ... > Again, in the ballpark. > > > > If I change my supply voltage (ADC10 input) to ~1.2V, > > > results: 370, 367, 370, 367, .. > > Same..it's all making sense to me so far, what's the problem? > > > > Does someone know why I am getting such weird results for the power > > > supply as input, but good results using another MSP430? Am I doing > > > something very wrong? If my code is needed, I'd be glad to post it. > > I don't see anything weird myself. Can you explain what you think is weird in > more detail? > Ok, thanks alot for clearing it up! I was being quite retarded! Everything *does* work out :) Rich
Reply by ●August 23, 20052005-08-23
Of course, the proble you talk about is scale and not the variation between
measures (they are there because noise coupling or your DC source is not DC
in the resolution of the ADC10).
You seems to have a scale problem probably a resistor divider in the input
or another impedance mismatch (like your DC source has a similar impedance
compared to the input impedance, causing a voltage divider like two
resistors).
You may have problems regarding ground connection between your board and DC
source.
When you connect the MSP pin with the square wave you get 1023 because it is
the result for saturation (input above VRef that may be 1.5 or 2.5V).
Also, you say "~1.0V". For measuring in the ADC you must know exactly
what
you have in the DC source. Do not rely on a Power Supply's display. Use a
DMM (even then you can have some error but it is usually better than a
PSU's
display).
If you are using 2.5V reference you should read a value near 410 for 1.000V.
Your VRef may be without enough stability (low capacitor in the VRef line).
You, maybe, is using a sampling time to short and give not enough time to
the internal sampling capacitor to charge to the same value you have in the
inputs.
I don't know the schematics of the board you are using. You must check
every
detail.
-Augusto
-----Original Message-----
From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of
finfets
Sent: Tuesday, August 23, 2005 4:11 PM
To: msp430@msp4...
Subject: [msp430] Re: Weird ADC results
I'm guessing these results are just too weird for anyone to know the
problem? Any takers?
--- In msp430@msp4..., "finfets" <finfets@y...> wrote:
> Hi,
>
> After lots of figuring out, I finally seem to have gotten my ADC10 to
> work. I used another MSP430 to send a square wave to my receiving
> MSP430, and my receiving MSP430 seemed to get data results ok: ie:
>
> results: 0, 1023, 0, 3, 1023, 0, 1024, 0, 0, 1024, 1023,...
>
> The annoying thing is that interspersed at times is a group of two
> values that are the same.. I guess my baseband algorithm will have to
> take care of that?
>
>
> The *real* problem occured when I hooked up a DC supply to test out my
> ADC10. So, I set my DC voltage at ~1.0V and input it to my MSP430
> ADC10. However, my results buffer looks like:
>
> results: 360, 369, 358, 359, 360, 363, ...
>
>
> Granted, they are all the same values as they should be (DC power
> supply as input), but the values are *way* off. If I change my supply
> to ~0.5V (so 0.5V input DC signal to ADC10),
>
> results: 125, 127, 126, 126, 125, ...
>
>
> If I change my supply voltage to 0V,
> results: 26, 21, 22, 21, 21, 13, 24, 23, ...
>
> If I change my supply voltage (ADC10 input) to ~1.2V,
> results: 370, 367, 370, 367, ...
>
>
>
> I am using the TI starter kit test board, so I'm pretty sure there is
> no voltage division going on at the ADC10 input pin (I am using port
> 3.7, which is input channel A7).
>
>
> Does someone know why I am getting such weird results for the power
> supply as input, but good results using another MSP430? Am I doing
> something very wrong? If my code is needed, I'd be glad to post it.
>
>
> Thanks for your time,
> Sincerely,
> Rich
.
Yahoo! Groups Links
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.12/77 - Release Date: 18/8/2005
Reply by ●August 23, 20052005-08-23
Tip: It's always worth lengthening the sample time to see if it has any effect on the output numbers, particularly when switching between ADC channels. If the numbers are different when using a longer sampling window (aperture) then you can be sure this is a signal input rise time issue and can adjust the sample width to the necessary size. Start with the maximum sample width. The required width depends on your hardware, adjacent channels and clock frequency. Hugh At 19:21 23/08/2005 +0000, you wrote: I'll do my best: On Tuesday 23 August 2005 12:10 pm, finfets wrote: > I'm guessing these results are just too weird for anyone to know the > problem? Any takers? > > --- In msp430@msp4..., "finfets" <finfets@y...> wrote: > > Hi, > > > > After lots of figuring out, I finally seem to have gotten my ADC10 to > > work. I used another MSP430 to send a square wave to my receiving > > MSP430, and my receiving MSP430 seemed to get data results ok: ie: > > > > results: 0, 1023, 0, 3, 1023, 0, 1024, 0, 0, 1024, 1023,... This just seems that the square wave is very near your nyquist frequency. What are you sampling at? What freq is the square wave? > > The annoying thing is that interspersed at times is a group of two > > values that are the same.. I guess my baseband algorithm will have to > > take care of that? You should be able to get the resolution you need by upping the sampling rate. If you don't want that many samples, just average out the results. > > > > The *real* problem occured when I hooked up a DC supply to test out my > > ADC10. So, I set my DC voltage at ~1.0V and input it to my MSP430 > > ADC10. However, my results buffer looks like: > > > > results: 360, 369, 358, 359, 360, 363, ... I don't see a problem here, assuming 3.3 volts reference: (3.3volts / 2^10) * 360 = 1.16 1.16 is close enough to 1.0 that I'd say it's within tolerance. > > > > Granted, they are all the same values as they should be (DC power > > supply as input), but the values are *way* off. If I change my supply > > to ~0.5V (so 0.5V input DC signal to ADC10), > > > > results: 125, 127, 126, 126, 125, ... Same here: (3.3volts / 2^10) * 125 = 0.402 once again definitely in the ballpark. > > > > If I change my supply voltage to 0V, > > results: 26, 21, 22, 21, 21, 13, 24, 23, ... Again, in the ballpark. > > If I change my supply voltage (ADC10 input) to ~1.2V, > > results: 370, 367, 370, 367, .. Same..it's all making sense to me so far, what's the problem? > > Does someone know why I am getting such weird results for the power > > supply as input, but good results using another MSP430? Am I doing > > something very wrong? If my code is needed, I'd be glad to post it. I don't see anything weird myself. Can you explain what you think is weird in more detail? -Micah
Reply by ●August 23, 20052005-08-23
Hi,
More below:
On Tuesday 23 August 2005 12:31 pm, finfets wrote:
> --- In msp430@msp4..., Micah Stevens <micah@9...> wrote:
> > > > After lots of figuring out, I finally seem to have gotten
my
>
> ADC10 to
>
> > > > work. I used another MSP430 to send a square wave to my
receiving
> > > > MSP430, and my receiving MSP430 seemed to get data results
ok: ie:
> > > >
> > > > results: 0, 1023, 0, 3, 1023, 0, 1024, 0, 0, 1024,
1023,...
> >
> > This just seems that the square wave is very near your nyquist
>
> frequency. What
>
> > are you sampling at? What freq is the square wave?
>
> I am sending my square wave at 43.0 kHz. I am sampling at 196 kHz, as
> that is my frequency of my TimerA (which is used to trigger the ADC10).
>
> As an aside, I will be taking the basic upper division signals and
> systems course this fall, so I will definitely become more familiar
> with the nyquist stuff. I did learn about it in the intro signals and
> systems course, but I forgot it :D
>
Essentially, the rule is, in order to sample a frequency of x, you must sample
at x*2. From what you're saying, you're well above the nyquist with
your
sampling rate, so that's not an issue like I thought. That's > 4
samples per
cycle. However this confuses me, in a perfect work with everything synced up,
this would lead to this sort of data:
0,0,0,0, 1024, 1024, 1024, 1024, 0, 0, 0, 0, 1024, 1024, 1024, 1024, 0, 0, 0,
0, etc..
Of course that will never happen, and since your sampling rate isn't a
direct
multiple of the signal, that will hose things too, as well as it seems (I may
be wrong) that you aren't syncing the signal with the sample clock, so
there
is likely some jitter going on.
How about injecting a nice 48Khz (sample/4) signal and seeing how that works
out for you?
Also, I would try toggling a spare GPIO pin at every sample, to see how
regular the sample clock is.. you might find your clock is a little screwey
depending on how you've set things up.
-Micah
Reply by ●August 23, 20052005-08-23
Ok. It was easier than I thought. I am used to use the internal reference that is usually more stable then VCC. It does also helps to make calibrations since it will remain the same value (under known conditions) while VCC may vary a lot according power source, switching noise, etc. -Augusto -----Original Message----- From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of finfets Sent: Tuesday, August 23, 2005 4:32 PM To: msp430@msp4... Subject: [msp430] Re: Weird ADC results Hello Micah, Thanks for the quick response: --- In msp430@msp4..., Micah Stevens <micah@9...> wrote: > > I'll do my best: > > On Tuesday 23 August 2005 12:10 pm, finfets wrote: > > I'm guessing these results are just too weird for anyone to know the > > problem? Any takers? > > > > --- In msp430@msp4..., "finfets" <finfets@y...> wrote: > > > Hi, > > > > After lots of figuring out, I finally seem to have gotten my ADC10 to > > > work. I used another MSP430 to send a square wave to my receiving > > > MSP430, and my receiving MSP430 seemed to get data results ok: ie: > > > > results: 0, 1023, 0, 3, 1023, 0, 1024, 0, 0, 1024, 1023,... > > This just seems that the square wave is very near your nyquist frequency. What > are you sampling at? What freq is the square wave? > I am sending my square wave at 43.0 kHz. I am sampling at 196 kHz, as that is my frequency of my TimerA (which is used to trigger the ADC10). As an aside, I will be taking the basic upper division signals and systems course this fall, so I will definitely become more familiar with the nyquist stuff. I did learn about it in the intro signals and systems course, but I forgot it :D > > > The annoying thing is that interspersed at times is a group of two > > > values that are the same.. I guess my baseband algorithm will have to > > > take care of that? > > You should be able to get the resolution you need by upping the sampling rate. > If you don't want that many samples, just average out the results. > > > > > > > The *real* problem occured when I hooked up a DC supply to test out my > > > ADC10. So, I set my DC voltage at ~1.0V and input it to my MSP430 > > > ADC10. However, my results buffer looks like: > > > > > > results: 360, 369, 358, 359, 360, 363, ... > > I don't see a problem here, assuming 3.3 volts reference: > > (3.3volts / 2^10) * 360 = 1.16 > > 1.16 is close enough to 1.0 that I'd say it's within tolerance. > Ok, you are totally right! I *am* using a 3.3V reference. That was quite stupid of me. > > > > > > Granted, they are all the same values as they should be (DC power > > > supply as input), but the values are *way* off. If I change my supply > > > to ~0.5V (so 0.5V input DC signal to ADC10), > > > > > > results: 125, 127, 126, 126, 125, ... > Same here: > (3.3volts / 2^10) * 125 = 0.402 > > once again definitely in the ballpark. > > > > > > > If I change my supply voltage to 0V, > > > results: 26, 21, 22, 21, 21, 13, 24, 23, ... > Again, in the ballpark. > > > > If I change my supply voltage (ADC10 input) to ~1.2V, > > > results: 370, 367, 370, 367, .. > > Same..it's all making sense to me so far, what's the problem? > > > > Does someone know why I am getting such weird results for the power > > > supply as input, but good results using another MSP430? Am I doing > > > something very wrong? If my code is needed, I'd be glad to post it. > > I don't see anything weird myself. Can you explain what you think is weird in > more detail? > Ok, thanks alot for clearing it up! I was being quite retarded! Everything *does* work out :) Rich . Yahoo! Groups Links -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.12/77 - Release Date: 18/8/2005
Reply by ●August 23, 20052005-08-23
Hi Augusto: Thanks for the detailed response: --- In msp430@msp4..., "augusto einsfeldt" <aee@t...> wrote: > Of course, the proble you talk about is scale and not the variation between > measures (they are there because noise coupling or your DC source is not DC > in the resolution of the ADC10). > > You seems to have a scale problem probably a resistor divider in the input > or another impedance mismatch (like your DC source has a similar impedance > compared to the input impedance, causing a voltage divider like two > resistors). > > You may have problems regarding ground connection between your board and DC > source. > I'm not sure about this being a problem anymore, because as Micah pointed out, I neglected the 3.3V reference and did not do the proper calculation. If I do the proper calculation, the values do work out, even for 1023 ones. Because the MSP that is sending is referenced to VCC=3.3V, so 1023/1024 * 3.3 ~= 3.3V for a '1'. However, one thing I am confused about is "reference-generator" voltage. Actually, this was the reason for my initial miscalculation. I thought that since I had set REF2_5V = 0, so 1.5V for reference-generator voltage, that this would be my 'scale' for the ADC, not 3.3V. I am a little confused as to what the purpose of REF2_5V is for? > When you connect the MSP pin with the square wave you get 1023 because it is > the result for saturation (input above VRef that may be 1.5 or 2.5V). > > Also, you say "~1.0V". For measuring in the ADC you must know exactly what > you have in the DC source. Do not rely on a Power Supply's display. Use a > DMM (even then you can have some error but it is usually better than a PSU's > display). > Yes, you are completely right. I have a DMM right next to the power supply too. Gotta find that extra ground cable lying around somewhere though... > If you are using 2.5V reference you should read a value near 410 for 1.000V. > > Your VRef may be without enough stability (low capacitor in the VRef line). > You, maybe, is using a sampling time to short and give not enough time to > the internal sampling capacitor to charge to the same value you have in the > inputs. Yes, this sounds like a very plausible explanation for what my initial problem seemed to be. Thanks for your help! Rich
Reply by ●August 23, 20052005-08-23
You can choose the Vref source (internal 1.5V, 2.5V, AVCC or external). You also need to turn internal reference on. If necessary you can route the internal reference to external circuits. Look the ADC10 Block Diagram in the user's guide. Of course, when using the internal Vref your ADC's full scale will be the Vref value. Using them are a good choice because they are more stable (providing more valid bits) and while you get near 3.2mV per step using 3.3V as reference you could get 1.4mV/step using 1.5V reference. You also need to adjust the m,aximum input voltage to do not exceed the Vref (you can go to AVCC value but everything above Vref will be read as 1023 - saturation). -Augusto -----Original Message----- From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of finfets Sent: Tuesday, August 23, 2005 4:47 PM To: msp430@msp4... Subject: [msp430] Re: Weird ADC results Hi Augusto: Thanks for the detailed response: --- In msp430@msp4..., "augusto einsfeldt" <aee@t...> wrote: > Of course, the proble you talk about is scale and not the variation between > measures (they are there because noise coupling or your DC source is not DC > in the resolution of the ADC10). > > You seems to have a scale problem probably a resistor divider in the input > or another impedance mismatch (like your DC source has a similar impedance > compared to the input impedance, causing a voltage divider like two > resistors). > > You may have problems regarding ground connection between your board and DC > source. > I'm not sure about this being a problem anymore, because as Micah pointed out, I neglected the 3.3V reference and did not do the proper calculation. If I do the proper calculation, the values do work out, even for 1023 ones. Because the MSP that is sending is referenced to VCC=3.3V, so 1023/1024 * 3.3 ~= 3.3V for a '1'. However, one thing I am confused about is "reference-generator" voltage. Actually, this was the reason for my initial miscalculation. I thought that since I had set REF2_5V = 0, so 1.5V for reference-generator voltage, that this would be my 'scale' for the ADC, not 3.3V. I am a little confused as to what the purpose of REF2_5V is for? > When you connect the MSP pin with the square wave you get 1023 because it is > the result for saturation (input above VRef that may be 1.5 or 2.5V). > > Also, you say "~1.0V". For measuring in the ADC you must know exactly what > you have in the DC source. Do not rely on a Power Supply's display. Use a > DMM (even then you can have some error but it is usually better than a PSU's > display). > Yes, you are completely right. I have a DMM right next to the power supply too. Gotta find that extra ground cable lying around somewhere though... > If you are using 2.5V reference you should read a value near 410 for 1.000V. > > Your VRef may be without enough stability (low capacitor in the VRef line). > You, maybe, is using a sampling time to short and give not enough time to > the internal sampling capacitor to charge to the same value you have in the > inputs. Yes, this sounds like a very plausible explanation for what my initial problem seemed to be. Thanks for your help! Rich . Yahoo! Groups Links -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.12/77 - Release Date: 18/8/2005