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.

CC430F5137: enabling Vref+ on output pin.

Part Number: CC430F5137


I am having difficulty getting the internal reference voltage output on the Vref+ pin.

Stripped down code:

#include <msp430.h> 

/*
 * main.c
 */
int main(void) {
  WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog timer

  // Get write-access to port mapping regs.
  PMAPPWD = 0x02D52;
  P2MAP5 = PM_ANALOG;
  // And lock port mapping registers.
  PMAPPWD = 0;

  P2SEL = BIT4 | BIT5;

  REFCTL0 = REFMSTR + REFON + REFOUT + REFVSEL_0;

  for (;;) {;}
}

If I run this code with the debugger I do measure a (stable) voltage of 1,436V on the Vref+.  (P2.5 pin)

However when I then shut down the device and start it without the debugger the reference voltage does not appear on the pin.

Also I have set the reference to 1,5V but measure only 1,436V.

I would like to know how I get a the 1,5V on the pin also when not started from the debugger?

Any help is greatly appreciated.

  • Alwin,

    Please try a while(1) as the termination of your code. Just replace the return 0; statement with while(1);

    the return 0 has nowhere to go and then the processor starts doing undefined stuff.

    Regards,
    /TA
  • Hi TA,

    I used CCS to generate a new CCS project with an empty main. I forgot to replace the return 0.
    But anyway it is not root-cause of the Vref problem. I tried again with a for(;;) loop replacing the return 0; with the same result.
    I.e. in debug I get 1.43 Volt and when run stand-alone the Vref does not appear on the pin, instead I measure 0.11V. The pin seems to be floating as this voltage is not very stable. I tried this on an experiment board as well as on our final product. both the same result.
    I'm wondering if i need to connect Vref- pin to Vss?
  • (I updated the example code to correct for the return 0; at the end)

    The problem is not solved yet. Questions that I still have:

    1) Is the example code above indeed sufficient to get the reference voltage on the Vref+ pin?

    2) Should I do something special with regard to hardware wiring to get the reference voltage on the pin?

    3) Why do I get a 1,43V only when the debugger is running the code and not when run stand-alone from separate power supply?

    In the errata sheet of the cc430f5137 I do not see anything that could explain the problem.

  • Are you sure that the program actually runs without the debugger?

    How exactly are you trying to measure the voltage?
  • Hi Clemens,

    The problem is solved. I used an experimenter board that had a jumper not correctly set. That's why it didn't run without the debugger.
    The reference voltage I measure with a calibrated fluke multi-meter is indeed 1,43V. But I no re-checked this with an oscilloscope that shows a max value of 1,51V. So this seems to be the correct reference voltage, but there apparently is quite some ripple. That's probably why external capacitors are needed on the ref pin.

**Attention** This is a public forum