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.

REFCTL0 reg on Msp430f5438a

Other Parts Discussed in Thread: MSP430F5438, MSP430F5438A, MSP430F5341


In the Family Guide, the following is stated:

This mode is implemented in all devices with ADC10_A. Also all ADC12_A devices except for
MSP430F5438 and MSP430F5438A support this mode."

So does this mean the reference module register has no affect on the Msp430f5438a?  The part specific data sheet links to the REF module documentation, so I'm a bit confused.

In this case, how do you ensure the temp sensor is powered?

  • I think theF5438A has it while F5438 does not.

    The data-sheet should state what the chip has. (It probably will not state what the chip does not have.)

  • I know, I'm used to the 438 having lots of exceptions and legacy issues, but  was surprised that the more recent 438a doesn't have REF support.  I think it's a typo.

  • Found this on another post from a TI employee:



    MSP430F5438A is one of the new 5xx devices that have the temperature sensor built into the integrated REF module. Therefore configuration of the REF module is required in order to sample the temp sensor. Additionally, the device's coefficients are different from the MSP430F5438 (please check the latest datasheet) so you would also need to change the parameters for the temperature calculation. Attached is an updated code example in C that addresses the aforementioned changes.




    Dung Dang"

    Sounds like they're just not bothering to update their documentation.  Typical.  This post was from 4 years ago

  • The 54xxA devices do have a REF module and REFMSTR is set by default. So the REF controls in the ADC registers are don't care. However, clearing REFMSTR will turn control back to the ADC registers.

    It's a little bit unfortunate that the default configuration breaks existing code from the non-A versions. While this is consistent with other MSPs of the 5x family, I had expected that the defaults for a successor of the non-A would be backwards compatible, offering additional functionality but not replacing it in an incompatible way.
    (same for the PMMCOREV setting).

    Well, now it is as it is. :(

  • True, I noticed that default setting, which was problem enough for exactly the kind of legacy code you mentioned.

    But really, official documents claiming the 438a doesn't have a REF module?  Really irritating.  

  • Alex E said:
    But really, official documents claiming the 438a doesn't have a REF module?

    To be exact, the users guide tells that the 5438A does not support REFMSTR=1 mode, but it doesn't say there is no REF module :)

    Well, the authoritative answer is given by the device datasheet. And it tells the A devices have, the non-A don't.

    IMHO, the users guide tells too much here. It should simply say that there is a REF module and how it works. If a device has no REF module, then it hasn't, and the datasheet will tell.

    However, this statement is obviously wrong and I have included it into my documentation errata sheet. Likely, it has not been updated because nothing has changed that would have required an update, and nobody noticed that the initial version was wrong.

  • I have a MSP430F5341 with 1.500V (verified) connected to the analog input A3, the internal 2.5V reference selected and am attempting to see A/D conversion results of 2457 counts. (2457 / 4096 * 2.5 = 1.5V)

    Here are the two code versions I have tried:

    Version 1:

    P6SEL |= BIT3; // Enable A/D channel A3
    REFCTL0 = REFVSEL_3 + REFON; // 2.5V ref active
    ADC12CTL0 = ADC12ON + ADC12SHT0_2; // Turn on ADC12, Sampling time
    ADC12CTL1 = ADC12SHP; // Use sampling timer
    ADC12MCTL0 = ADC12SREF_1; // Vr+ = internal 2.5V Vr- = VSS
    for ( i=0; i < 0x30; i++); // Delay for reference start-up
    ADC12CTL0 |= ADC12ENC; // Enable conversions

    Version 2:

    P6SEL |= BIT3; // Enable A/D channel A3
    REFCTL0 &= ~REFMSTR; // Reset REFMSTR to hand over control to ADC12_A ref control registers
    ADC12CTL0 = ADC12ON + ADC12SHT0_2 + ADC12REFON + ADC12REF2_5V; // Turn on ADC12, Sampling time
    ADC12CTL1 = ADC12SHP; // Use sampling timer
    ADC12MCTL0 = ADC12SREF_1; // Vr+ = internal 2.5V Vr- = VSS
    for ( i=0; i<0x30; i++); // Delay for reference start-up
    ADC12CTL0 |= ADC12ENC; // Enable conversions

    This code returns the A/D counts:

    ADC12MCTL0 = ADC12SREF_1 + ADC12INCH_3; // select input channel 3 - test voltage to be measured
    ADC12IFG=0;//clear all flags
    ADC12CTL0 |= ADC12SC; // Start conversion
    while (ADC12IFG==0); //while no conversions are complete on any A/D channel...
    lcounts = ADC12MEM0;

    Both versions return counts that bounce all around 2457 (low of 1857 to high of 3093). Power supply is a quiet 3V battery source. 1.5V test voltage is quiet with only about 30-40mV of noise p-p.

    I'd really like to see this work with both references so I can evaluate which is best for my product.

    Any help is greatly appreciated.
  • The reference startup delay migt be a bit short. Especially if the compiler detects that the loop ha sno effect and eliminates it :)
    Depending on your signal sourc eimpedance, ASC12SHT0_2 could be too low, resulting in instable measurements. The sampling capacitor needs to charge. 16 clock cycles (2-3µs at default MODCLOCK) aren't much.
    On some MSPs and at certain conversion speeds, it is necessary to stabilize the internal reference by enablignthe reference output and placing a 10µ tantalum and 100n ceramic cap there.
    Also, you should decouple AVCC from DVCC by a series resistor and a 10µ/100n cap combo. Else the reference might pulse with the digital side operating current (that's why there are two VCC inputs for D and A). Ideally, AVSS is routed to your signal GND before joining DVSS, so GND currents don't change you reference baseline.

    It's usually not necessary to set PxSEL for analog inputs. The analog input is activated independently of the digital port function selection. In some cases, it is intentional to monitor the digital signal level (e.g. to determine the output current).
    Apparently, the port schematics in the datasheet is copied from P5.7 instead from P5.1 (see there what I mean), which is still wrong but would fit a bit better.
    However, switchng away from plain digital I/O won't hurt in this case. It disables the input driver and maybe reduces input capacitance a bit. And reduce digital input supply current for analog input voltages around the high/low input threshold.