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.

MSP430FR2111: ADC - Enable External 1.2 V Reference

Part Number: MSP430FR2111

Hello all, 

I am new to the MSP430FR2111 series MCUs, I am trying to do a simple A/D by sampling analog input with an NTC voltage divider on Pin 1.6 (A6) on the MSP430FR2111IPW16R. I have couple of questions:

1. How do I enable the internal reference of 1.2 V (reference for the ADC) to be buffered and output to pin P1.7 in software? 

SLAU445G mentions setting EXTREFEN=1 in PMMCTL2 register to enable the external 1.2 V but also talks about a password to unlock the PMM registers?

Can someone help me in providing the exact command in CCS? 

I'm trying to do this with no luck!

PMMCTL0 |= 0xA5;    // unlock access to PMM registers.
PMMCTL2 |= 0x02;    // write PMMCTL2_L bit 1 for external reference enable.

void initADC(void)
{
// Initialize ADC
PMMCTL0 |= 0xA5;
PMMCTL2 |= 0x02;

ADCCTL0 |= ADCMSC_1 | ADCON; // Conversions performed automatically
// ADC turned on

ADCCTL1 |= ADCSHP_1 | ADCSSEL_1 | ADCCONSEQ_2; // Use input signal
// ADC clock source is ACLK
// ADC conversion mode = repeat-single-channel

ADCMCTL0 |= ADCINCH_6; // Input channel set to A3 : JMS - UPDATE A3 to A0: ADCINCH_3 to ADCINCH_0
ADCIE |= ADCIE0; // Above upper threshold interrupt enabled

ADCCTL0 |= ADCSC | ADCENC; // Enable and start conversion
}

Any input is greatly appreciated.

Thanks,

Ganesan M.

  • Hi Ganesan,

    I'm afraid you wrote the PMM password to the wrong bits of PMMCTL0. As described in the UG, the PMMPW are bits8-15 of the PMMCTL0. But in your code, you just wrote the 0xA5 to the bits0-7 of the PMMCTL0. This should be the root cause that you failed to enable the 1.2V reference.

    You could take below code as an example for your code.

        // Configure reference
        PMMCTL0_H = PMMPW_H;                                      // Unlock the PMM registers
        PMMCTL2 |= EXTREFEN;                                      // Enable external reference
        __delay_cycles(400);                                      // Delay for reference settling

  • Thanks for the quick reply Wei. This resolved my issue.

    Best,
    Gan

**Attention** This is a public forum