This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

I am having a problem with ADC module of msp-expF5529 EVM. How to troubleshoot?

Other Parts Discussed in Thread: MSP430WARE

I am dealing with ADC module. Just  at initial stage of testing. Since my board msp-expF5529 has its on board POT of 10Kohm, I am intended to use that as my analog voltage generator, no matter what I tried, how many times I tried, but unsuccessful. An alternative was, I applied a fixed DC voltage(less than Vref) to pin 6.7(A7) on my board and write the code for the same. I am attaching a copy of my code with(modified version of code from msp430ware, code for adc sampling with internal reference). Please help me out. OR

Let me know What an ADC module takes to initiate and work, give me some directives for the same. 

"

#include <msp430.h>

int main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
// P6DIR |= 0x00;


P6SEL |= BIT7; // Enable A/D channel A0
REFCTL0 &= ~REFMSTR; // Reset REFMSTR to hand over control to
// ADC12_A ref control registers
ADC12CTL0 = ADC12ON+ADC12SHT02+ADC12REFON+ADC12REF2_5V;
// Turn on ADC12, Sampling time
// On Reference Generator and set to
// 2.5V
ADC12CTL1 = ADC12SHP; // Use sampling timer
ADC12MCTL7 = ADC12SREF_1; // Vr+=Vref+ and Vr-=AVss
ADC12MCTL7 = ADC12INCH_7;

for ( i=0; i<0x30; i++); // Delay for reference start-up

ADC12CTL0 |= ADC12ENC; // Enable conversions

while (1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
while (!(ADC12IFG & BIT7));
__no_operation(); // SET BREAKPOINT HERE

}
}

"

  • Hi Sourabh,
    I had a look at your code and would like to give you some ideas what you can try to get the ADC working.

    Please disable the pull-ups/downs for the input channel:
    P6REN &= ~BIT7;
    P6DIR &= ~BIT7;

    With setting the input channel you're setting the reference back to default, make it please in one line:
    ADC12MCTL7 = ADC12SREF_1; // Vr+=Vref+ and Vr-=AVss
    ADC12MCTL7 = ADC12INCH_7;
    change to:
    ADC12MCTL7 = ADC12SREF_1+ADC12INCH_7;

    You could also try to enable the reference manually with this code:
    REFCTL0 = REFON+REFMSTR+REFTCOFF;
    But in general it should also work like you did it.

    I'll send you an working .asm code to you email address. Maybe this will help you to get the ADC working.

    Best regards,
    Tobias
  • it should be added that a for loop is no suitable delay function. It might be optimized away completely by the compiler as it doesn't influence the system state. (the compiler doesn't know that wasting time without doing anything is intentional). Use __delay_cycles(x) or a timer for a delay.

**Attention** This is a public forum