EmbeddedRelated.com
Forums

ADC12 calibration for MSP430F149

Started by barion79 February 20, 2008
WHICH WHALE IS KILLING& AND WHO OR WHAT IS IT KILLING?

AL

microbit wrote:

>And stop the whale killing :-)
>
>Best Regards,
>Kris
>
>-----Original Message-----
>From: m... [mailto:m...] On Behalf Of Steve Sabram
>Sent: Thursday, 21 February 2008 9:49 AM
>To: m...
>Subject: Re: [msp430] Re: ADC12 calibration for MSP430F149
>
>And if this project was outsourced, you get what you pay for.
>
>Steve
>Kipton Moravec wrote:
>
>
>>You are screwed.
>>
>>You should fire the engineer for not thinking about calibration. And the
>>test engineer for not catching it was out of specifications. Probably
>>the manager for not overseeing the project and costing the company a lot
>>of money.
>>
>>Time to make a product recall.
>>
>>Kip
>>
>>On Wed, 2008-02-20 at 19:41 +0000, barion79 wrote:
>>
>>
>>
>>>Unfortunately they cannot. The owner will not open the device and
>>>most likely will not have a multimeter for this purpose.
>>>
>>>Thank you,
>>>Leon.
>>>
>>>
>>>--- In m..., "Redd, Emmett R"
>>>wrote:
>>>
>>>
>>>
>>>>Can the outside owner give any information to help you?
>>>>
>>>>Emmett Redd Ph.D. mailto:EmmettRedd@...
>>>>Professor (417)836-5221
>>>>Department of Physics, Astronomy, and Materials Science
>>>>Missouri State University Fax (417)836-6226
>>>>901 SOUTH NATIONAL Dept (417)836-5131
>>>>SPRINGFIELD, MO 65897 USA
>>>>
>>>>How much wood would a woodchuck chuck if a woodchuck could chuck
>>>>
>>>>
>>>>
>>>wood?
>>>
>>>
>>>
>>>>How much ground would a groundhog hog if a groundhog could hog
>>>>
>>>>
>>>>
>>>ground?
>>>
>>>
>>>
>>>>How much pig would a whistlepig whistle if a whistlepig could
>>>>
>>>>
>>>>
>>>whistle
>>>
>>>
>>>
>>>>pig? :-\ :-/ :-)
>>>>
>>>>
>>>>________________________________
>>>>
>>>>From: m... on behalf of barion79
>>>>Sent: Wed 2/20/2008 12:45 PM
>>>>To: m...
>>>>Subject: [msp430] Re: ADC12 calibration for MSP430F149
>>>>
>>>>
>>>>
>>>>Thank you all for replying.
>>>>
>>>>The solutions that you suggested I have already thought about.
>>>>However, the problem is that these solutions will work only with new
>>>>devices.
>>>>
>>>>Unfortunately, at this moment I have many units outside. The only
>>>>
>>>>
>>>>
>>>way
>>>
>>>
>>>
>>>>I can update those is by sending an updated FW. Thus, I need to find
>>>>a way to get a proper reading from ADC without having access to the
>>>>HW.
>>>>
>>>>Maybe someone have an idea how accurate reading can be done without
>>>>having measured reference voltage?
>>>>
>>>>Thank you,
>>>>Leon.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>I have run into an unexpected issue with getting exact value from
>>>>>
>>>>>
>>>>>
>>>>ADC.
>>>>
>>>>
>>>>
>>>>>According to data sheets the internal VREF+ can fluctuate between
>>>>>2.4V to 2.5V. In addition, the voltage regulator (3.3V) also
>>>>>fluctuates between 3.234V to 3.366V. Thus, different devices
>>>>>
>>>>>
>>>>>
>>>>provide
>>>>
>>>>
>>>>
>>>>>me with different conversion data. This data often do not reach
>>>>>
>>>>>
>>>>>
>>>the
>>>
>>>
>>>
>>>>>required limit and the device does not work properly.
>>>>>
>>>>>Now the easiest solution would be to add external reference
>>>>>
>>>>>
>>>>>
>>>voltage
>>>
>>>
>>>
>>>>>to VeREF+. However the hardware design has been done before and
>>>>>
>>>>>
>>>>>
>>>>there
>>>>
>>>>
>>>>
>>>>>are many device sent out. Thus, I need to provide a FW solution to
>>>>>such problem.
>>>>>
>>>>>Did anyone encountered this problem before and maybe has a quick
>>>>>solution.
>>>>>
>>>>>Thank you,
>>>>>Leon.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>

Beginning Microcontrollers with the MSP430

The ADC12 has 16 inputs, some of which are duplicated and 10 of which
(8+2) are able to be connected to external pins. What exactly is
connected to each of these pins? You may have a remote ground (useful
for auto-zero calibration), or you may have a remote stable
"reference" (eg CR32032) useful for span calibration. Provide a list
and maybe we can use some of these. Reading between the lines, it
seems you may be able to self-calibrate the signal, since you are
looking for a "change" of 240mV - a huge number. The MSP can sample
the starting value, then look for a short-term jump perhaps. So as
well as providing the list of pin connections, we also need more
details about the "change"; is it a rapid jump compared with the slow
drift of the internal reference?

Does the supply voltage drive both the MSP and the thing you are
measuring? Ratiometric measurement works by using the same excitation
voltage for both measurement and reference. If the supply goes up by
5%, then both measured vale and reference go up by 5% and they cancel
out. If the MSP has an LDO (for example) but the other device does
not, then you need to find another way of making the measurement
ratiometric. You can do this by sampling something else - which
doesn't change - using the same reference and differencing the two.

There are a couple of other techniques you can use. Use a simple
low-pass filter in the software, which will probably give you better
results, and consider the period of the external interference. On
some applications there are any number of beat frequency sources, but
in a stand-alone application (ie. battery operated) you normally have
to defeat mains-bourne interference (60Hz & 120Hz USA, 50Hz and 100Hz
elsewhere). These are from the powerline fundamental frequency, and
corresponding rectified frequency. When averaging multiple values,
set the averaging sample period to be an integer multiple of this
time, for example 300 mSecs.

You can use a single-pole low-pass filter to reduce ADC noise and
jitter. It is set by FILTER_VALUE (0 'off', 'on' range 1-255) which
controls the amount of filtering (and also the response time).

Formula:
FilteredValue = ((1-n) * FilteredValue + n * RawValue)
where n=1/FILTER_VALUE

You should suppress the filter at power-on until sufficient readings
have been taken to make it meaningful, if this affects your
application. For 16-bit ADC values, it helps to do the calculation
using 32-bit, a shown below.

Eg (paste into Notepad to line this up):
/*
* Low-Pass Filter
* ============== *
* You can use a single-pole low-pass filter to reduce ADC noise and jitter.
*
* It is set by FILTER_VALUE (0 'off', 'on' range 1-254) which controls the
* amount of filtering (and also the response time).
*
* Formula: FilteredValue = ((1-n) * FilteredValue + n * RawValue)
*
* where n=1/FILTER_VALUE
*
* You should suppress the filter at power-on until sufficient readings have
^ been taken to make it meaningful, if this affects your application.
*/

// Equaliser single-pole low-pass filter:
/ Vf = ((1-n)*Vf + n*V) where n=1/READING_FILTER_VALUE
// (note scaling by *256 since using integer arithmetic for speed)

uint16 Filter_holdoff = 0; // Current filter initial hold-off
int32 ReadingFiltered; // Current 32-bit filter output value (scaled * 256)
int16 AnalogueInput; // Raw 16-bit analogue value from ADC
int16 AnalogueOutput; // Filtered 16-bit analogue value from ADC

void UpdateFilter(void)
{
// Single-pole low-pass filter: Ff = ((1-n)*Ff + n*F) where n=1/FILTER_VALUE

// Scaling by *256 since only integer arithmetic available for speed)

ReadingFiltered = ( (ReadingFiltered*(FILTER_VALUE-1)) +
(((int32)AnalogueInput)<<8) ) / FILTER_VALUE;

if (Filter_holdoff > 5*FILTER_VALUE)
{
AnalogueOutput = (int16) ((ReadingFiltered+128) >> 8); //
Filtered 16-bit value
}
else
{
// Waiting for initial stable reading, copy input to output
AnalogueOutput = AnalogueInput;
ReadingFiltered = ((int32) AnalogueInput) << 8;
Filter_holdoff++;
}
}

Hugh
At 06:36 AM 2/22/2008, you wrote:
Hello All,

I am measuring a supply/status voltage coming from my main device to
device connected to the main. This voltage is changing according the
connected device. This is, however, is not a problem.

This voltage is produced by DC/DC regulator on the main unit. This
supply/status voltage is in the range of 14V to 20V, depending on the
connected slave device.

I need to monitor this voltage line for changes on it. That is, if
there is an increase of 240mv on it, or more, I need to know about it.

So far I have noticed a few issues in the design. First is that the
voltage divider resistors having 5% tolerance, which by itself a
cause for many problems. Second, the designers did not take into
account the range of internal reference voltage (2.4V to 2.6V).
Therefore, many times the ADC converted value is not close to real
value.

I think I can improve the quality of ADC conversion by switching
reference voltage from internal to AVcc. Even though the supply
voltage has also some range, it is much smaller and more accurate
then internal reference voltage.

I just wanted to know is there any way I can get more accurate
reading from ADC. This will reduce the reading error and will get the
reading close to desired range (or I hope it will).

Thank you,
Leon.

--- In m..., Hugh Molesworth
wrote:
>
> You may be able to improve things. First, describe your measurement
> circuit and exactly what you are measuring. By this I am looking
for
> whether it is ratiometric, such as a resistive sensor primarily
> excited by the Vcc of the MSP430, or is it derived from some fixed
> reference (possibly derived from a source outside your equipment).
> The more description you can provide here the better. Then maybe I
> can give you some suggestions on fixing your problem, either by
> changing your sampling or incorporation of some filtering/scaling
to
> provide auto-calibration.
>
> Regards, Hugh
>
> At 10:45 AM 2/20/2008, you wrote:
> Thank you all for replying.
>
> The solutions that you suggested I have already thought about.
> However, the problem is that these solutions will work only with new
> devices.
>
> Unfortunately, at this moment I have many units outside. The only
way
> I can update those is by sending an updated FW. Thus, I need to find
> a way to get a proper reading from ADC without having access to the
> HW.
>
> Maybe someone have an idea how accurate reading can be done without
> having measured reference voltage?
>
> Thank you,
> Leon.
>
>
>
> > I have run into an unexpected issue with getting exact value from
> ADC.
> >
> > According to data sheets the internal VREF+ can fluctuate between
> > 2.4V to 2.5V. In addition, the voltage regulator (3.3V) also
> > fluctuates between 3.234V to 3.366V. Thus, different devices
> provide
> > me with different conversion data. This data often do not reach
the
> > required limit and the device does not work properly.
> >
> > Now the easiest solution would be to add external reference
voltage
> > to VeREF+. However the hardware design has been done before and
> there
> > are many device sent out. Thus, I need to provide a FW solution
to
> > such problem.
> >
> > Did anyone encountered this problem before and maybe has a quick
> > solution.
> >
> > Thank you,
> > Leon.
> >
>
Since there are so many design errors, I just wanted to make sure of
one thing that I've seen slips past some designers: Are there the
necesary 10uF and 100nF connected to Vref+ for the voltage generator
to work properly?

Michael K.

--- In m..., Hugh Molesworth wrote:
>
> The ADC12 has 16 inputs, some of which are duplicated and 10 of which
> (8+2) are able to be connected to external pins. What exactly is
> connected to each of these pins? You may have a remote ground (useful
> for auto-zero calibration), or you may have a remote stable
> "reference" (eg CR32032) useful for span calibration. Provide a list
> and maybe we can use some of these. Reading between the lines, it
> seems you may be able to self-calibrate the signal, since you are
> looking for a "change" of 240mV - a huge number. The MSP can sample
> the starting value, then look for a short-term jump perhaps. So as
> well as providing the list of pin connections, we also need more
> details about the "change"; is it a rapid jump compared with the slow
> drift of the internal reference?
>
> Does the supply voltage drive both the MSP and the thing you are
> measuring? Ratiometric measurement works by using the same excitation
> voltage for both measurement and reference. If the supply goes up by
> 5%, then both measured vale and reference go up by 5% and they cancel
> out. If the MSP has an LDO (for example) but the other device does
> not, then you need to find another way of making the measurement
> ratiometric. You can do this by sampling something else - which
> doesn't change - using the same reference and differencing the two.
>
> There are a couple of other techniques you can use. Use a simple
> low-pass filter in the software, which will probably give you better
> results, and consider the period of the external interference. On
> some applications there are any number of beat frequency sources, but
> in a stand-alone application (ie. battery operated) you normally have
> to defeat mains-bourne interference (60Hz & 120Hz USA, 50Hz and 100Hz
> elsewhere). These are from the powerline fundamental frequency, and
> corresponding rectified frequency. When averaging multiple values,
> set the averaging sample period to be an integer multiple of this
> time, for example 300 mSecs.
>
> You can use a single-pole low-pass filter to reduce ADC noise and
> jitter. It is set by FILTER_VALUE (0 'off', 'on' range 1-255) which
> controls the amount of filtering (and also the response time).
>
> Formula:
> FilteredValue = ((1-n) * FilteredValue + n * RawValue)
> where n=1/FILTER_VALUE
>
> You should suppress the filter at power-on until sufficient readings
> have been taken to make it meaningful, if this affects your
> application. For 16-bit ADC values, it helps to do the calculation
> using 32-bit, a shown below.
>
> Eg (paste into Notepad to line this up):
> /*
> * Low-Pass Filter
> * ==============> *
> * You can use a single-pole low-pass filter to reduce ADC noise
and jitter.
> *
> * It is set by FILTER_VALUE (0 'off', 'on' range 1-254) which
controls the
> * amount of filtering (and also the response time).
> *
> * Formula: FilteredValue = ((1-n) * FilteredValue + n * RawValue)
> *
> * where n=1/FILTER_VALUE
> *
> * You should suppress the filter at power-on until sufficient
readings have
> ^ been taken to make it meaningful, if this affects your application.
> */
>
> // Equaliser single-pole low-pass filter:
> / Vf = ((1-n)*Vf + n*V) where n=1/READING_FILTER_VALUE
> // (note scaling by *256 since using integer arithmetic for speed)
>
> uint16 Filter_holdoff = 0; // Current filter initial hold-off
> int32 ReadingFiltered; // Current 32-bit filter output value
(scaled * 256)
> int16 AnalogueInput; // Raw 16-bit analogue value from ADC
> int16 AnalogueOutput; // Filtered 16-bit analogue value from ADC
>
> void UpdateFilter(void)
> {
> // Single-pole low-pass filter: Ff = ((1-n)*Ff + n*F) where
n=1/FILTER_VALUE
>
> // Scaling by *256 since only integer arithmetic available for speed)
>
> ReadingFiltered = ( (ReadingFiltered*(FILTER_VALUE-1)) +
> (((int32)AnalogueInput)<<8) ) / FILTER_VALUE;
>
> if (Filter_holdoff > 5*FILTER_VALUE)
> {
> AnalogueOutput = (int16) ((ReadingFiltered+128) >> 8); //
> Filtered 16-bit value
> }
> else
> {
> // Waiting for initial stable reading, copy input to output
> AnalogueOutput = AnalogueInput;
> ReadingFiltered = ((int32) AnalogueInput) << 8;
> Filter_holdoff++;
> }
> }
>
> Hugh
> At 06:36 AM 2/22/2008, you wrote:
> Hello All,
>
> I am measuring a supply/status voltage coming from my main device to
> device connected to the main. This voltage is changing according the
> connected device. This is, however, is not a problem.
>
> This voltage is produced by DC/DC regulator on the main unit. This
> supply/status voltage is in the range of 14V to 20V, depending on the
> connected slave device.
>
> I need to monitor this voltage line for changes on it. That is, if
> there is an increase of 240mv on it, or more, I need to know about it.
>
> So far I have noticed a few issues in the design. First is that the
> voltage divider resistors having 5% tolerance, which by itself a
> cause for many problems. Second, the designers did not take into
> account the range of internal reference voltage (2.4V to 2.6V).
> Therefore, many times the ADC converted value is not close to real
> value.
>
> I think I can improve the quality of ADC conversion by switching
> reference voltage from internal to AVcc. Even though the supply
> voltage has also some range, it is much smaller and more accurate
> then internal reference voltage.
>
> I just wanted to know is there any way I can get more accurate
> reading from ADC. This will reduce the reading error and will get the
> reading close to desired range (or I hope it will).
>
> Thank you,
> Leon.
>
> --- In m..., Hugh Molesworth
> wrote:
> >
> > You may be able to improve things. First, describe your measurement
> > circuit and exactly what you are measuring. By this I am looking
> for
> > whether it is ratiometric, such as a resistive sensor primarily
> > excited by the Vcc of the MSP430, or is it derived from some fixed
> > reference (possibly derived from a source outside your equipment).
> > The more description you can provide here the better. Then maybe I
> > can give you some suggestions on fixing your problem, either by
> > changing your sampling or incorporation of some filtering/scaling
> to
> > provide auto-calibration.
> >
> > Regards, Hugh
> >
> > At 10:45 AM 2/20/2008, you wrote:
> > Thank you all for replying.
> >
> > The solutions that you suggested I have already thought about.
> > However, the problem is that these solutions will work only with new
> > devices.
> >
> > Unfortunately, at this moment I have many units outside. The only
> way
> > I can update those is by sending an updated FW. Thus, I need to find
> > a way to get a proper reading from ADC without having access to the
> > HW.
> >
> > Maybe someone have an idea how accurate reading can be done without
> > having measured reference voltage?
> >
> > Thank you,
> > Leon.
> >
> >
> >
> > > I have run into an unexpected issue with getting exact value from
> > ADC.
> > >
> > > According to data sheets the internal VREF+ can fluctuate between
> > > 2.4V to 2.5V. In addition, the voltage regulator (3.3V) also
> > > fluctuates between 3.234V to 3.366V. Thus, different devices
> > provide
> > > me with different conversion data. This data often do not reach
> the
> > > required limit and the device does not work properly.
> > >
> > > Now the easiest solution would be to add external reference
> voltage
> > > to VeREF+. However the hardware design has been done before and
> > there
> > > are many device sent out. Thus, I need to provide a FW solution
> to
> > > such problem.
> > >
> > > Did anyone encountered this problem before and maybe has a quick
> > > solution.
> > >
> > > Thank you,
> > > Leon.
> > >
>
Hello All,

I am measuring a supply/status voltage coming from my main device to
device connected to the main. This voltage is changing according the
connected device. This is, however, is not a problem.

This voltage is produced by DC/DC regulator on the main unit. This
supply/status voltage is in the range of 14V to 20V, depending on the
connected slave device.

I need to monitor this voltage line for changes on it. That is, if
there is an increase of 240mv on it, or more, I need to know about it.

So far I have noticed a few issues in the design. First is that the
voltage divider resistors having 5% tolerance, which by itself a
cause for many problems. Second, the designers did not take into
account the range of internal reference voltage (2.4V to 2.6V).
Therefore, many times the ADC converted value is not close to real
value.

I think I can improve the quality of ADC conversion by switching
reference voltage from internal to AVcc. Even though the supply
voltage has also some range, it is much smaller and more accurate
then internal reference voltage.

I just wanted to know is there any way I can get more accurate
reading from ADC. This will reduce the reading error and will get the
reading close to desired range (or I hope it will).

Thank you,
Leon.
--- In m..., Hugh Molesworth
wrote:
>
> You may be able to improve things. First, describe your measurement
> circuit and exactly what you are measuring. By this I am looking
for
> whether it is ratiometric, such as a resistive sensor primarily
> excited by the Vcc of the MSP430, or is it derived from some fixed
> reference (possibly derived from a source outside your equipment).
> The more description you can provide here the better. Then maybe I
> can give you some suggestions on fixing your problem, either by
> changing your sampling or incorporation of some filtering/scaling
to
> provide auto-calibration.
>
> Regards, Hugh
>
> At 10:45 AM 2/20/2008, you wrote:
> Thank you all for replying.
>
> The solutions that you suggested I have already thought about.
> However, the problem is that these solutions will work only with new
> devices.
>
> Unfortunately, at this moment I have many units outside. The only
way
> I can update those is by sending an updated FW. Thus, I need to find
> a way to get a proper reading from ADC without having access to the
> HW.
>
> Maybe someone have an idea how accurate reading can be done without
> having measured reference voltage?
>
> Thank you,
> Leon.
>
> > I have run into an unexpected issue with getting exact value from
> ADC.
> >
> > According to data sheets the internal VREF+ can fluctuate between
> > 2.4V to 2.5V. In addition, the voltage regulator (3.3V) also
> > fluctuates between 3.234V to 3.366V. Thus, different devices
> provide
> > me with different conversion data. This data often do not reach
the
> > required limit and the device does not work properly.
> >
> > Now the easiest solution would be to add external reference
voltage
> > to VeREF+. However the hardware design has been done before and
> there
> > are many device sent out. Thus, I need to provide a FW solution
to
> > such problem.
> >
> > Did anyone encountered this problem before and maybe has a quick
> > solution.
> >
> > Thank you,
> > Leon.
>
Hello all,

Three pins of port 6 are configured as outputs and the one more pin
is floating. The rest four pins are different voltage measurements
that the device does for monitoring. Therefore, I concluded that I do
not have any reference voltage that can be used. I wanted to use AVcc
as reference but it can, according to the device data sheets, be
anywhere between 3.234V to 3.366V.

The voltage jump that I monitor is checked at the very beginning and
if the supply voltage surpasses the allowed limit, my system must
produce an error message. Since, I monitor this supply voltage for
one specific reason; I know that the jump will be around 240mV.

The supply voltages for external device and for my system are
separate, so I think I cannot use one as a reference to other.

My readings of ADC values are done using interrupts, such that I read
them when the flag is raised.

Thanks again for any help.

Leon.
--- In m..., Hugh Molesworth
wrote:
>
> The ADC12 has 16 inputs, some of which are duplicated and 10 of
which
> (8+2) are able to be connected to external pins. What exactly is
> connected to each of these pins? You may have a remote ground
(useful
> for auto-zero calibration), or you may have a remote stable
> "reference" (eg CR32032) useful for span calibration. Provide a
list
> and maybe we can use some of these. Reading between the lines, it
> seems you may be able to self-calibrate the signal, since you are
> looking for a "change" of 240mV - a huge number. The MSP can sample
> the starting value, then look for a short-term jump perhaps. So as
> well as providing the list of pin connections, we also need more
> details about the "change"; is it a rapid jump compared with the
slow
> drift of the internal reference?
>
> Does the supply voltage drive both the MSP and the thing you are
> measuring? Ratiometric measurement works by using the same
excitation
> voltage for both measurement and reference. If the supply goes up
by
> 5%, then both measured vale and reference go up by 5% and they
cancel
> out. If the MSP has an LDO (for example) but the other device does
> not, then you need to find another way of making the measurement
> ratiometric. You can do this by sampling something else - which
> doesn't change - using the same reference and differencing the two.
>
> There are a couple of other techniques you can use. Use a simple
> low-pass filter in the software, which will probably give you
better
> results, and consider the period of the external interference. On
> some applications there are any number of beat frequency sources,
but
> in a stand-alone application (ie. battery operated) you normally
have
> to defeat mains-bourne interference (60Hz & 120Hz USA, 50Hz and
100Hz
> elsewhere). These are from the powerline fundamental frequency, and
> corresponding rectified frequency. When averaging multiple values,
> set the averaging sample period to be an integer multiple of this
> time, for example 300 mSecs.
>
> You can use a single-pole low-pass filter to reduce ADC noise and
> jitter. It is set by FILTER_VALUE (0 'off', 'on' range 1-255) which
> controls the amount of filtering (and also the response time).
>
> Formula:
> FilteredValue = ((1-n) * FilteredValue + n * RawValue)
> where n=1/FILTER_VALUE
>
> You should suppress the filter at power-on until sufficient
readings
> have been taken to make it meaningful, if this affects your
> application. For 16-bit ADC values, it helps to do the calculation
> using 32-bit, a shown below.
>
> Eg (paste into Notepad to line this up):
> /*
> * Low-Pass Filter
> * ==============> *
> * You can use a single-pole low-pass filter to reduce ADC noise
and jitter.
> *
> * It is set by FILTER_VALUE (0 'off', 'on' range 1-254) which
controls the
> * amount of filtering (and also the response time).
> *
> * Formula: FilteredValue = ((1-n) * FilteredValue + n * RawValue)
> *
> * where n=1/FILTER_VALUE
> *
> * You should suppress the filter at power-on until sufficient
readings have
> ^ been taken to make it meaningful, if this affects your
application.
> */
>
> // Equaliser single-pole low-pass filter:
> / Vf = ((1-n)*Vf + n*V) where n=1/READING_FILTER_VALUE
> // (note scaling by *256 since using integer arithmetic for speed)
>
> uint16 Filter_holdoff = 0; // Current filter initial hold-off
> int32 ReadingFiltered; // Current 32-bit filter output value
(scaled * 256)
> int16 AnalogueInput; // Raw 16-bit analogue value from ADC
> int16 AnalogueOutput; // Filtered 16-bit analogue value from
ADC
>
> void UpdateFilter(void)
> {
> // Single-pole low-pass filter: Ff = ((1-n)*Ff + n*F) where
n=1/FILTER_VALUE
>
> // Scaling by *256 since only integer arithmetic available for
speed)
>
> ReadingFiltered = ( (ReadingFiltered*(FILTER_VALUE-1)) +
> (((int32)AnalogueInput)<<8) ) / FILTER_VALUE;
>
> if (Filter_holdoff > 5*FILTER_VALUE)
> {
> AnalogueOutput = (int16) ((ReadingFiltered+128) >> 8); //
> Filtered 16-bit value
> }
> else
> {
> // Waiting for initial stable reading, copy input to output
> AnalogueOutput = AnalogueInput;
> ReadingFiltered = ((int32) AnalogueInput) << 8;
> Filter_holdoff++;
> }
> }
>
> Hugh
> At 06:36 AM 2/22/2008, you wrote:
> Hello All,
>
> I am measuring a supply/status voltage coming from my main device to
> device connected to the main. This voltage is changing according the
> connected device. This is, however, is not a problem.
>
> This voltage is produced by DC/DC regulator on the main unit. This
> supply/status voltage is in the range of 14V to 20V, depending on
the
> connected slave device.
>
> I need to monitor this voltage line for changes on it. That is, if
> there is an increase of 240mv on it, or more, I need to know about
it.
>
> So far I have noticed a few issues in the design. First is that the
> voltage divider resistors having 5% tolerance, which by itself a
> cause for many problems. Second, the designers did not take into
> account the range of internal reference voltage (2.4V to 2.6V).
> Therefore, many times the ADC converted value is not close to real
> value.
>
> I think I can improve the quality of ADC conversion by switching
> reference voltage from internal to AVcc. Even though the supply
> voltage has also some range, it is much smaller and more accurate
> then internal reference voltage.
>
> I just wanted to know is there any way I can get more accurate
> reading from ADC. This will reduce the reading error and will get
the
> reading close to desired range (or I hope it will).
>
> Thank you,
> Leon.
>
> --- In m..., Hugh Molesworth
> wrote:
> >
> > You may be able to improve things. First, describe your
measurement
> > circuit and exactly what you are measuring. By this I am looking
> for
> > whether it is ratiometric, such as a resistive sensor primarily
> > excited by the Vcc of the MSP430, or is it derived from some
fixed
> > reference (possibly derived from a source outside your
equipment).
> > The more description you can provide here the better. Then maybe
I
> > can give you some suggestions on fixing your problem, either by
> > changing your sampling or incorporation of some filtering/scaling
> to
> > provide auto-calibration.
> >
> > Regards, Hugh
> >
> > At 10:45 AM 2/20/2008, you wrote:
> > Thank you all for replying.
> >
> > The solutions that you suggested I have already thought about.
> > However, the problem is that these solutions will work only with
new
> > devices.
> >
> > Unfortunately, at this moment I have many units outside. The only
> way
> > I can update those is by sending an updated FW. Thus, I need to
find
> > a way to get a proper reading from ADC without having access to
the
> > HW.
> >
> > Maybe someone have an idea how accurate reading can be done
without
> > having measured reference voltage?
> >
> > Thank you,
> > Leon.
> >
> >
> >
> > > I have run into an unexpected issue with getting exact value
from
> > ADC.
> > >
> > > According to data sheets the internal VREF+ can fluctuate
between
> > > 2.4V to 2.5V. In addition, the voltage regulator (3.3V) also
> > > fluctuates between 3.234V to 3.366V. Thus, different devices
> > provide
> > > me with different conversion data. This data often do not
reach
> the
> > > required limit and the device does not work properly.
> > >
> > > Now the easiest solution would be to add external reference
> voltage
> > > to VeREF+. However the hardware design has been done before
and
> > there
> > > are many device sent out. Thus, I need to provide a FW
solution
> to
> > > such problem.
> > >
> > > Did anyone encountered this problem before and maybe has a
quick
> > > solution.
> > >
> > > Thank you,
> > > Leon.
> > >
>
Hello,

Yes, these capacitors are connected to reference voltage. This was
the first thing I checked myself. :)

Leon.

--- In m..., "tintronic" wrote:
>
> Since there are so many design errors, I just wanted to make sure of
> one thing that I've seen slips past some designers: Are there the
> necesary 10uF and 100nF connected to Vref+ for the voltage generator
> to work properly?
>
> Michael K.
>
> --- In m..., Hugh Molesworth
wrote:
> >
> > The ADC12 has 16 inputs, some of which are duplicated and 10 of
which
> > (8+2) are able to be connected to external pins. What exactly is
> > connected to each of these pins? You may have a remote ground
(useful
> > for auto-zero calibration), or you may have a remote stable
> > "reference" (eg CR32032) useful for span calibration. Provide a
list
> > and maybe we can use some of these. Reading between the lines, it
> > seems you may be able to self-calibrate the signal, since you are
> > looking for a "change" of 240mV - a huge number. The MSP can
sample
> > the starting value, then look for a short-term jump perhaps. So
as
> > well as providing the list of pin connections, we also need more
> > details about the "change"; is it a rapid jump compared with the
slow
> > drift of the internal reference?
> >
> > Does the supply voltage drive both the MSP and the thing you are
> > measuring? Ratiometric measurement works by using the same
excitation
> > voltage for both measurement and reference. If the supply goes up
by
> > 5%, then both measured vale and reference go up by 5% and they
cancel
> > out. If the MSP has an LDO (for example) but the other device
does
> > not, then you need to find another way of making the measurement
> > ratiometric. You can do this by sampling something else - which
> > doesn't change - using the same reference and differencing the
two.
> >
> > There are a couple of other techniques you can use. Use a simple
> > low-pass filter in the software, which will probably give you
better
> > results, and consider the period of the external interference. On
> > some applications there are any number of beat frequency sources,
but
> > in a stand-alone application (ie. battery operated) you normally
have
> > to defeat mains-bourne interference (60Hz & 120Hz USA, 50Hz and
100Hz
> > elsewhere). These are from the powerline fundamental frequency,
and
> > corresponding rectified frequency. When averaging multiple
values,
> > set the averaging sample period to be an integer multiple of this
> > time, for example 300 mSecs.
> >
> > You can use a single-pole low-pass filter to reduce ADC noise and
> > jitter. It is set by FILTER_VALUE (0 'off', 'on' range 1-255)
which
> > controls the amount of filtering (and also the response time).
> >
> > Formula:
> > FilteredValue = ((1-n) * FilteredValue + n * RawValue)
> > where n=1/FILTER_VALUE
> >
> > You should suppress the filter at power-on until sufficient
readings
> > have been taken to make it meaningful, if this affects your
> > application. For 16-bit ADC values, it helps to do the
calculation
> > using 32-bit, a shown below.
> >
> > Eg (paste into Notepad to line this up):
> > /*
> > * Low-Pass Filter
> > * ==============> > *
> > * You can use a single-pole low-pass filter to reduce ADC noise
> and jitter.
> > *
> > * It is set by FILTER_VALUE (0 'off', 'on' range 1-254) which
> controls the
> > * amount of filtering (and also the response time).
> > *
> > * Formula: FilteredValue = ((1-n) * FilteredValue + n *
RawValue)
> > *
> > * where n=1/FILTER_VALUE
> > *
> > * You should suppress the filter at power-on until sufficient
> readings have
> > ^ been taken to make it meaningful, if this affects your
application.
> > */
> >
> > // Equaliser single-pole low-pass filter:
> > / Vf = ((1-n)*Vf + n*V) where n=1/READING_FILTER_VALUE
> > // (note scaling by *256 since using integer arithmetic for speed)
> >
> > uint16 Filter_holdoff = 0; // Current filter initial hold-off
> > int32 ReadingFiltered; // Current 32-bit filter output value
> (scaled * 256)
> > int16 AnalogueInput; // Raw 16-bit analogue value from ADC
> > int16 AnalogueOutput; // Filtered 16-bit analogue value from
ADC
> >
> > void UpdateFilter(void)
> > {
> > // Single-pole low-pass filter: Ff = ((1-n)*Ff + n*F) where
> n=1/FILTER_VALUE
> >
> > // Scaling by *256 since only integer arithmetic available for
speed)
> >
> > ReadingFiltered = ( (ReadingFiltered*(FILTER_VALUE-1)) +
> > (((int32)AnalogueInput)<<8) ) / FILTER_VALUE;
> >
> > if (Filter_holdoff > 5*FILTER_VALUE)
> > {
> > AnalogueOutput = (int16) ((ReadingFiltered+128) >> 8); //
> > Filtered 16-bit value
> > }
> > else
> > {
> > // Waiting for initial stable reading, copy input to output
> > AnalogueOutput = AnalogueInput;
> > ReadingFiltered = ((int32) AnalogueInput) << 8;
> > Filter_holdoff++;
> > }
> > }
> >
> > Hugh
> >
> >
> > At 06:36 AM 2/22/2008, you wrote:
> > Hello All,
> >
> > I am measuring a supply/status voltage coming from my main device
to
> > device connected to the main. This voltage is changing according
the
> > connected device. This is, however, is not a problem.
> >
> > This voltage is produced by DC/DC regulator on the main unit. This
> > supply/status voltage is in the range of 14V to 20V, depending on
the
> > connected slave device.
> >
> > I need to monitor this voltage line for changes on it. That is, if
> > there is an increase of 240mv on it, or more, I need to know
about it.
> >
> > So far I have noticed a few issues in the design. First is that
the
> > voltage divider resistors having 5% tolerance, which by itself a
> > cause for many problems. Second, the designers did not take into
> > account the range of internal reference voltage (2.4V to 2.6V).
> > Therefore, many times the ADC converted value is not close to real
> > value.
> >
> > I think I can improve the quality of ADC conversion by switching
> > reference voltage from internal to AVcc. Even though the supply
> > voltage has also some range, it is much smaller and more accurate
> > then internal reference voltage.
> >
> > I just wanted to know is there any way I can get more accurate
> > reading from ADC. This will reduce the reading error and will get
the
> > reading close to desired range (or I hope it will).
> >
> > Thank you,
> > Leon.
> >
> > --- In m..., Hugh Molesworth
> > wrote:
> > >
> > > You may be able to improve things. First, describe your
measurement
> > > circuit and exactly what you are measuring. By this I am
looking
> > for
> > > whether it is ratiometric, such as a resistive sensor primarily
> > > excited by the Vcc of the MSP430, or is it derived from some
fixed
> > > reference (possibly derived from a source outside your
equipment).
> > > The more description you can provide here the better. Then
maybe I
> > > can give you some suggestions on fixing your problem, either by
> > > changing your sampling or incorporation of some
filtering/scaling
> > to
> > > provide auto-calibration.
> > >
> > > Regards, Hugh
> > >
> > > At 10:45 AM 2/20/2008, you wrote:
> > > Thank you all for replying.
> > >
> > > The solutions that you suggested I have already thought about.
> > > However, the problem is that these solutions will work only
with new
> > > devices.
> > >
> > > Unfortunately, at this moment I have many units outside. The
only
> > way
> > > I can update those is by sending an updated FW. Thus, I need
to find
> > > a way to get a proper reading from ADC without having access
to the
> > > HW.
> > >
> > > Maybe someone have an idea how accurate reading can be done
without
> > > having measured reference voltage?
> > >
> > > Thank you,
> > > Leon.
> > >
> > >
> > >
> > > > I have run into an unexpected issue with getting exact
value from
> > > ADC.
> > > >
> > > > According to data sheets the internal VREF+ can fluctuate
between
> > > > 2.4V to 2.5V. In addition, the voltage regulator (3.3V) also
> > > > fluctuates between 3.234V to 3.366V. Thus, different devices
> > > provide
> > > > me with different conversion data. This data often do not
reach
> > the
> > > > required limit and the device does not work properly.
> > > >
> > > > Now the easiest solution would be to add external reference
> > voltage
> > > > to VeREF+. However the hardware design has been done before
and
> > > there
> > > > are many device sent out. Thus, I need to provide a FW
solution
> > to
> > > > such problem.
> > > >
> > > > Did anyone encountered this problem before and maybe has a
quick
> > > > solution.
> > > >
> > > > Thank you,
> > > > Leon.
> > > >
> > >
>