Reply by finfets August 24, 20052005-08-24
Ok I figured out my problem of why it was 0,1024,0,1024 instead of
0,0,0,0,1024,1024,1024,1024,0,0,etc

I measured my TX rate wrong, my TX rate was actually 70 KHz. And I was
sampling at 195 KHz. Well, this seems to imply I should be getting
something like a very skewed: 0,0,1024,1024, etc, but at least this is
a step in the right direction.

Thanks,
Rich

--- In msp430@msp4..., "finfets" <finfets@y...> wrote:
> Hi,
> 
> Thanks again for the helpful information:
> 
> --- In msp430@msp4..., Micah Stevens <micah@9...> wrote:
> > 
> > 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? 
> > 
> 
> So, I got it to give as close to 48 as possible, trying both 46.5 kHz
> and 50.67 kHz. Both give much better results than before, as I had
> alot fewer clumps of 2 consecutive, same values. I tried sending at a
> worse frequency just to test, so at 40.0 kHz, and indeed I got alot of
>  clumps of 2 same values. 
> 
> As for the reason why I only have 0,1024,0,1024 instead of clumps of 4
> same values, I think its because of my setting for ADC10SHT_X. I am
> using ADC10SHT_3 == 64 x ADC10CLK, and I am using SMCLK for ADC10CLK,
> where SMCLK==MCLK==8.0 MHz external crystal.
> 
> I calculated to use ADC10SHT_3 because:
> 
> Using ADC10SR=1, max sample rate is 50 kbps. CLK period = 1/8Mhz = 125
>  ns.
> Using a worst-case impedance Rs = 2.0 KOhm,
> 
> tsample > (Rs + 2k)*7.625*20pF + 2.5us = 3.11 us.
> 
> Number of divisions of ADC10CLK needed = tsample_min / CLK_Period > 3.11
us / 125 ns = 24.88
> 
> I divide ADC10CLK by 1, however, and instead use the Sample Timer
> Division (ADC10SHT_X) to do my division.
> 
> So since 24.88 > 16 divisions, I must use 64 divisions. Then my total
> ADC10CLK cycles needed = 64+13+1 = 78, giving total time = 78*125ns
> 9.75 us, which is Freq2.6 KHz.
> 
> This frequency is the frequency I *should* be sampling at, but instead
> I used 196 which is roughly double that. I tested sampling at 100 KHz,
> but results were the same: 0,1024,0,1024 with the occasional clump of 2.
> 
> 
> > 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.
> > 
> 
> Initially I had the GPIO debug toggle in my ADC10_ISR vector, which
> gave an ok signal with not too much jitter. My DTC n  transfers were
> giving a ADC10_ISR at a constant freq=4.6 kHz.
> 
> So I am using TimerA to auto trigger the ADC10, but I still doing this
> in my TimerA ISR:
> 
> // Timer A0 interrupt service routine
> #pragma vector=TIMERA0_VECTOR
> __interrupt void Timer_A (void)
> {
>   ADC10CTL0 = ADC10SHT_3 | REFON | ADC10ON | ADC10IE | ADC10SR;
>   ADC10CTL0 |= ENC;                         // ADC10 enable set
>   
>   P2OUT ^= DOUT; // debug
> }
> 
> The TimerA ISR is happening at the expected 195 kHz, but there is
> quite alot of jitter on the edges. In fact, the frequency varies from
> 195 to 200 kHz!
> 
> 
> Thanks alot for you help and time,
> Regards,
> Rich



Beginning Microcontrollers with the MSP430

Reply by finfets August 23, 20052005-08-23
Hi,

Thanks again for the helpful information:

--- In msp430@msp4..., Micah Stevens <micah@9...> wrote:
> 
> 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? 
> 

So, I got it to give as close to 48 as possible, trying both 46.5 kHz
and 50.67 kHz. Both give much better results than before, as I had
alot fewer clumps of 2 consecutive, same values. I tried sending at a
worse frequency just to test, so at 40.0 kHz, and indeed I got alot of
 clumps of 2 same values. 

As for the reason why I only have 0,1024,0,1024 instead of clumps of 4
same values, I think its because of my setting for ADC10SHT_X. I am
using ADC10SHT_3 == 64 x ADC10CLK, and I am using SMCLK for ADC10CLK,
where SMCLK==MCLK==8.0 MHz external crystal.

I calculated to use ADC10SHT_3 because:

Using ADC10SR=1, max sample rate is 50 kbps. CLK period = 1/8Mhz = 125
 ns.
Using a worst-case impedance Rs = 2.0 KOhm,

tsample > (Rs + 2k)*7.625*20pF + 2.5us = 3.11 us.

Number of divisions of ADC10CLK needed = tsample_min / CLK_Period 3.11 us / 125
ns = 24.88

I divide ADC10CLK by 1, however, and instead use the Sample Timer
Division (ADC10SHT_X) to do my division.

So since 24.88 > 16 divisions, I must use 64 divisions. Then my total
ADC10CLK cycles needed = 64+13+1 = 78, giving total time = 78*125ns 9.75
us, which is Freq2.6 KHz.

This frequency is the frequency I *should* be sampling at, but instead
I used 196 which is roughly double that. I tested sampling at 100 KHz,
but results were the same: 0,1024,0,1024 with the occasional clump of 2.


> 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.
> 

Initially I had the GPIO debug toggle in my ADC10_ISR vector, which
gave an ok signal with not too much jitter. My DTC n  transfers were
giving a ADC10_ISR at a constant freq=4.6 kHz.

So I am using TimerA to auto trigger the ADC10, but I still doing this
in my TimerA ISR:

// Timer A0 interrupt service routine
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void)
{
  ADC10CTL0 = ADC10SHT_3 | REFON | ADC10ON | ADC10IE | ADC10SR;
  ADC10CTL0 |= ENC;                         // ADC10 enable set
  
  P2OUT ^= DOUT; // debug
}

The TimerA ISR is happening at the expected 195 kHz, but there is
quite alot of jitter on the edges. In fact, the frequency varies from
195 to 200 kHz!


Thanks alot for you help and time,
Regards,
Rich



Reply by augusto einsfeldt 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
 


Reply by finfets 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 augusto einsfeldt 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 Micah Stevens 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 Hugh Molesworth 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 augusto einsfeldt 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 finfets 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 Micah Stevens 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