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.

MSP430F2013: Incorrect Vcc SD16 Measurements with F2013

Part Number: MSP430F2013
Other Parts Discussed in Thread: MSP-EXP430G2ET

Hello,

I am trying to use the SD16 on the F2013 to measure Vcc internally on channel A5, but I keep getting measurements around 2.7 V to 2.8 V when I am powering with 3.3 V. I am using a MSP-EXP430G2ET with a F2013 and the IDE I am using is IAR workbench for MSP430 ( 7.12.4). I have also tried powering the board externally but it gave me similar results. Can anybody inform me of what I am doing wrong with my code?  My code is below.  I calculate Vcc by Vcc = ( ( SD16MEM0 * ( 0.5 * Vref ) ) / ( 2^16 ) ) * 11

#include <msp430.h>

int main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
  P1DIR |= 0x01;                            // Set P1.0 to output direction
  SD16CTL = SD16REFON + SD16SSEL_1;         // 1.2V ref, SMCLK
  SD16INCTL0 = SD16INTDLY_0 + SD16GAIN_1 + SD16INCH_5;                  // A5
  SD16CCTL0 =  SD16UNI + SD16IE;            // 256OSR, unipolar, interrupt enable
  SD16AE = 0;
  SD16CCTL0 |= SD16SC;                      // Set bit to start conversion

  __bis_SR_register(LPM0_bits + GIE);
}

#pragma vector = SD16_VECTOR
__interrupt void SD16ISR(void)
{
  if (SD16MEM0 < 0x7FFF)                // SD16MEM0 > 3.3V?, clears IFG
    P1OUT &= ~0x01;
  else
    P1OUT |= 0x01;
}

  • I'll just throw this in here: When I slowed down the clock to SD16DIV=2 (SMCLK/4), I got around 0x7FDA (3.296V) which is what my DMM said. It's not just a matter of elapsed time, since increasing the OSR had no effect. Unfortunately, the User Guide doesn't really say much of anything about special A5 considerations.

    I don't have a variable power supply handy, so I can't say whether this really fixes it or just changes it.

    Also, check location 0xBF to see if it's ==0x61. It was in mine, but based on Erratum SDA2 I guess it isn't in some devices. [Ref Errata sheet (SLAZ156H) p. 7]

  • Thanks Bruce, this solved my issue. I agree its not a matter of elapsed time. I even tried putting in a delay before starting the conversion, but once I divided the SMCLK/4 it worked.  I got around 7DB5 (3.24 V).  I also have 0x61 in memory location 0xBF and my CPU is a rev. F which doesnt have the Erratum SDA2.  

**Attention** This is a public forum