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.

MSP430F6659: Can't get ADC12 working on MSP430F6659

Part Number: MSP430F6659
Other Parts Discussed in Thread: MSPWARE, INA126

Hi

I get all FFF's and I tried all different setup commands, including the example in MSPware. An example code of what I tried is below. I am using a 128msec timer A to enable the A/D. If I break in the A/D ISR and look at the registers such ADC12MEM1, it's always 0xFFF even though the voltage on the pin is 1V. 

 Any clues as to what is going on?

Thanks,


void main(void)
{ WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
P6SEL |=0x3F;//0-5 A/D
P6OUT |=0x20; //to keep power on
// set up basic tomer A for interval count
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
TA1CCTL0 = CCIE; // CCR0 interrupt enabled
TA1CCR0 = 4096;
TA1CTL = TASSEL_1 + MC_1 + TACLR; // A`CLK, upmode, clear TAR
INIT_A_D(); //initialize A/D
_EINT();
while(1);
}

void INIT_A_D(void) //function init A/D
{
REFCTL0=0;//REFON+REFOUT;
ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_2+ADC12SHT1_2+ADC12REFON+ADC12REF2_5V; // Turn on ADC12, set sampling time
ADC12CTL1 = ADC12SHP+ADC12CONSEQ_1+ADC12SSEL_1; // single sequence
ADC12CTL2 = ADC12REFOUT+ADC12RES_2;

ADC12MCTL0 = ADC12INCH_0+ADC12SREF_1; //
ADC12MCTL1 = ADC12INCH_1+ADC12SREF_1; //
ADC12MCTL2 = ADC12INCH_2+ADC12SREF_1;
ADC12MCTL3 = ADC12INCH_3+ADC12SREF_1; //
ADC12MCTL4 = ADC12INCH_4+ADC12SREF_1; //
ADC12MCTL12 = ADC12INCH_12+ADC12SREF_1; //
ADC12MCTL13 = ADC12INCH_13+ADC12SREF_1+ADC12EOS; //

ADC12IE = 0x08; // Enable ADC12IFG.3
ADC12CTL0 |= ADC12ENC; // Enable conversions

}//
//
#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR(void)
{
Results[1] = ADC12MEM1; // Hi_Temp
Results[2] = ADC12MEM2; // Lo_Temp
Results[3] = ADC12MEM12; //
Results[4] = ADC12MEM13; // Ref_Temp
Results[5] = ADC12MEM0; //
Results[6] = ADC12MEM3; //
Results[7] = ADC12MEM4; //
}//end of a/d int service routine
//##########################################
//timer Int set to 128msec ints
#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER1_A0_ISR(void)
{
ADC12CTL0 |= ADC12SC;//enable a/d interrupt
}//end

  • [Removed. I missed your next-to-last line of code.]

  • I don't see your symptom when running on an F5529 (Launchpad), which is a first-cousin of the F6659. I didn't have a 1V source, but I did try 3v3 and 0V. The floating ADC pins gave floating readings.

    This isn't a solution, but it might be a clue.
  • Hi Jerry Bucci,

    In case the clue provided by Bruce doesn't solve it for you, can you please share more background on your hardware? Are you using a LaunchPad and if yes, which one? How do you supply the 1V to the measured pin?

    Thanks and best regards,
    Max
  • I'm using a custom board that will go into manufacturing. I've used similar software in the past on other lower end MSP430's, so I know it basically works. The 1V is derived from the Vref 2.5 coming from the micro. I divide it down through a voltage follower for references to some INA126 op amps on the board.

    I'm think it maybe a hardware problem. Question- Are all the AVSS grounds tied together inside the IC? This is a prototype board and a couple of the grounds were not connected when I first turned on the board(due to my error in the artwork). I have fixed them with wires, but I'm wondering if I damaged something inside the chip when they were floating.

    Thanks

    Jerry
  • Sorry guys- I found the problem, it was in my circuit and not software. All the voltages were above 2.5V, so of course I would get FFF. The 1V I thought was on an input was after a divider , but the input to the pin was actually seeing about 2.8V.
    I really appreciate the responses though!