EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Issues with ADC on MSP430FG4618

Started by mastarre May 26, 2009
I have been given an MSP430FG4618 on an experimenters board which has a non-functional ADC. Regardless of the input voltage, the ADC stores maybe 0x07 or 0x06 @ Vref = 1.5, and ~0x04 @ Vref = 2.5

I do not know any history on it other than that it did work previously (confirmed).

Originally I tried to test it using a simple code that samples the ADC (to which I applied 1.0V) and sends the result out over serial to docklight. On a known-good the result came back correctly however when I swapped in the problematic MCU the result was always 07.

I simplified things by using the TI example (code below) and the mem always shows the same results, 07.

Any ideas?

ti eg:
//******************************************************************************
// MSP430xG461x Demo - ADC12, Using the Internal Reference
//
// This example shows how to use the internal reference of the ADC12.
// It uses the internal 2.5V reference and performs a single conversion
// on channel A0. The conversion results are stored in ADC12MEM0. Test by
// applying a voltage to channel A0, then setting and running to a breakpoint
// at "__no_operation()".
// To view the conversion results, open a register window in Debugger and
// view the contents of ADC12MEM0.
// ACLK = 32kHz, MCLK = SMCLK = default DCO 1048576Hz, ADC12CLK = ADC12OSC
//
//
// MSP430xG461x
// ---------------
// | XIN|-
// | | 32kHz
// Vin -->|P6.0/A0 XOUT|-
// | |
//
//
// A. Dannenberg/ M. Mitchell
// Texas Instruments Inc.
// October 2006
// Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.41A
//******************************************************************************
#include "msp430xG46x.h"

volatile unsigned int i;

void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog
P6SEL |= 0x01; // Enable A/D channel A0
ADC12CTL0 = REFON + REF2_5V + ADC12ON + SHT0_2;
// turn on 2.5V ref, set samp time
ADC12CTL1 = SHP; // Use sampling timer
ADC12MCTL0 = SREF_1; // Vr+=Vref+

for (i = 0x3600; i; i--); // Delay for needed ref start-up.
// See datasheet for details.
ADC12CTL0 |= ENC; // Enable conversions
while (1)
{
ADC12CTL0 |= ADC12SC; // Start conversions
while (!(ADC12IFG & 0x0001)); // Conversion done?
ADC12MEM0; // Access result
__no_operation(); // SET BREAKPOINT HERE
}
}

Beginning Microcontrollers with the MSP430

I could use some help here -- anyone?

What do you mean by "known good"? If it's also a MSP430FG4618 and
you're running the exact same code on it without issue, sounds like a
hardware problem to me.

- Bart

On Wed, May 27, 2009 at 2:37 PM, mastarre wrote:
> I could use some help here -- anyone?
--- In m..., "mastarre" wrote:
>
> I could use some help here -- anyone?
>

Not sure. You seem to imply that this particular FG4618 on this particular board is damaged. Did you say that the same code in a different FG4818 gives reasonable results but this one gives unreasonable results? If that is the case, there is hardly anything one can do. Do you think one can open up the packaging and do micro-surgery on the damaged silicon? I know you are using c to write code. But can this all-mighty do silicon repair?

If the damage is limited to the input pin and/or the analog multiplexer, you may be able to use a different analog channel at a different input pin. Have you tried that?

Let me put it simplier: Someone gave you a LED. He told you it was working fine. You connect it the same way you connected another working LED of the same model, but this one doesn't light up. What do you do? You grab a tester and test it.
Have you tested the Vref+ pin voltage?
Have you tried other analog input?
Have you tried using AVcc (SREF_0) instead of Vref+ ?

> I do not know any history on it other than that it did work
> previously (confirmed).

So WHO confirmed that it worked previously (and how)? If it's broken, either he didn't know it was broken, or he lied, or you broke it before this test.

Michael K.

--- In m..., "mastarre" wrote:
>
> I could use some help here -- anyone?
>

--- In m..., "mastarre" wrote:
>
> I have been given an MSP430FG4618 on an experimenters board which has a non-functional ADC. Regardless of the input voltage, the ADC stores maybe 0x07 or 0x06 @ Vref = 1.5, and ~0x04 @ Vref = 2.5
>
> I do not know any history on it other than that it did work previously (confirmed).
>
> Originally I tried to test it using a simple code that samples the ADC (to which I applied 1.0V) and sends the result out over serial to docklight. On a known-good the result came back correctly however when I swapped in the problematic MCU the result was always 07.
>
> I simplified things by using the TI example (code below) and the mem always shows the same results, 07.
>
> Any ideas?
>
> ti eg:
> //******************************************************************************
> // MSP430xG461x Demo - ADC12, Using the Internal Reference
> //
> // This example shows how to use the internal reference of the ADC12.
> // It uses the internal 2.5V reference and performs a single conversion
> // on channel A0. The conversion results are stored in ADC12MEM0. Test by
> // applying a voltage to channel A0, then setting and running to a breakpoint
> // at "__no_operation()".
> // To view the conversion results, open a register window in Debugger and
> // view the contents of ADC12MEM0.
> // ACLK = 32kHz, MCLK = SMCLK = default DCO 1048576Hz, ADC12CLK = ADC12OSC
> //
> //
> // MSP430xG461x
> // ---------------
> // | XIN|-
> // | | 32kHz
> // Vin -->|P6.0/A0 XOUT|-
> // | |
> //
> //
> // A. Dannenberg/ M. Mitchell
> // Texas Instruments Inc.
> // October 2006
> // Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.41A
> //******************************************************************************
> #include "msp430xG46x.h"
>
> volatile unsigned int i;
>
> void main(void)
> {
> WDTCTL = WDTPW + WDTHOLD; // Stop watchdog
> P6SEL |= 0x01; // Enable A/D channel A0
> ADC12CTL0 = REFON + REF2_5V + ADC12ON + SHT0_2;
> // turn on 2.5V ref, set samp time
> ADC12CTL1 = SHP; // Use sampling timer
> ADC12MCTL0 = SREF_1; // Vr+=Vref+
>
> for (i = 0x3600; i; i--); // Delay for needed ref start-up.
> // See datasheet for details.
> ADC12CTL0 |= ENC; // Enable conversions
> while (1)
> {
> ADC12CTL0 |= ADC12SC; // Start conversions
> while (!(ADC12IFG & 0x0001)); // Conversion done?
> ADC12MEM0; // Access result
> __no_operation(); // SET BREAKPOINT HERE
> }
> }
>

Thank you for the feedback. I was hoping for more ideas to test it which is what I was given. I know that it was working because it was used during a course by the same student successfully (including a lab which began with the exact code I posted above -- again, successfully) until he began his independent project, at which point the ADC begin acting up.

I am sure that he did something funky to it, I was just hoping for more ideas to test them as I am a grad student and I don't have all of the experience in the world with these yet. I am working on it!

I'll post back with the results of the trials soon.


Memfault Beyond the Launch