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.

MSP430F235 ADC12 Full-Scale-Range problem

Other Parts Discussed in Thread: MSP430F235


I've got a mysterious problem with my ADC12 on my MSP430F235. Independently of using it in single or sequence conversion mode, the ADC seems to be not able to use his full-scale range from 0V to 2.5V (internal reference voltage). It behaves like this:

Channel A0:

Input voltage: 0V => ADC value: 0 => RIGHT

Input voltage: about 1.95 V => ADC value: about 3180 => RIGHT

Input voltage: about 2 V and more (but less than 2.5 V)  => ADC value always 2047 (constant) => WHY THAT?

Curiously the channels A1 and A2 are both only able to measure voltages above 1.25 V e.g. ADC values larger than 2047. Voltages below 1.25 V always result in ADC values 0.

I also measured the 2.5 V reference voltage, which is pretty okay. Of course I also checked my hardware for short circuits, but everything is fine and the voltages to measure appear correctly at the analog input pins of the microcontroller.

Has anyone ever had this problem or an idea what can be wrong?

  • I forgot to attach my source code, here it is:

    void adc12_sample(u16_t * vbat_high, u16_t * vbat_mid, u16_t * current)
        adc12_init();                   // Initialize ADC
        ADC12CTL0 |= (ENC | ADC12SC);   // Start conversion with sampling
        while ((ADC12IFG & 0x0004) != 0x0004) ;  // Wait while conversion is active
        *vbat_high = (ADC12MEM0 & 0x0FFF);
        *vbat_mid = (ADC12MEM1 & 0x0FFF);
        *current = (ADC12MEM2 & 0x0FFF);
        ADC12CTL0 &= ~ENC;       // Disable conversion
    void adc12_init(void)
        ADC12_VBAT_HIGH_PxDIR &= ~ADC12_VBAT_HIGH_PIN;  // ADC pin is input
        ADC12_VBAT_HIGH_PxSEL |= ADC12_VBAT_HIGH_PIN;   // ADC functionality for pin
        ADC12_VBAT_MID_PxDIR &= ~ADC12_VBAT_MID_PIN;    // ADC pin is input
        ADC12_VBAT_MID_PxSEL |= ADC12_VBAT_MID_PIN;     // ADC functionality for pin
        ADC12_CURRENT_PxDIR &= ~ADC12_CURRENT_PIN;      // ADC pin is input
        ADC12_CURRENT_PxSEL |= ADC12_CURRENT_PIN;       // ADC functionality for pin
        ADC12CTL0 = 0x0000;     // Clear ADC12 Control Register 0
        ADC12CTL0 |= SHT02;     // S&H 64 ADC12CLK cyles (=> 64 �s > 37.56 �s)
        ADC12CTL0 |= MSC;       // Further sample-and-conversions are performed automatically
        ADC12CTL0 |= REF2_5V;   // 2.5 V reference voltage
        ADC12CTL0 |= REFON;     // Enable reference voltage
        ADC12CTL0 |= ADC12ON;   // Enable ADC12
        ADC12CTL1 = 0x0000;     // Clear ADC12 Control Register 1
        // Save conversion results to ADC12MEM0 ...
        // ADC12CLK = SMCLK / 1
        ADC12CTL1 &= ~(ADC12DIV2 | ADC12DIV1 | ADC12DIV0);
        ADC12CTL1 |= (ADC12SSEL1 | ADC12SSEL1);
        // Sequence-of-channels, no repeat
        ADC12CTL1 &= ~(CONSEQ1);
        ADC12CTL1 |= CONSEQ0;
        ADC12CTL1 |= SHP;       // SAMPCON sourced from sampling timer
        ADC12MCTL0 = (SREF_1 | INCH_0);    // Input channel A0, VR+ = VREF+, VR- = AVss
        ADC12MCTL1 = (SREF_1 | INCH_1);    // Input channel A1, VR+ = VREF+, VR- = AVss
        ADC12MCTL2 = (SREF_1 | INCH_2 | EOS);    // Input channel A2, VR+ = VREF+, VR- = AVss, End of sequence

    Thanks a lot for your ideas and your help!

  • Please describe your signal (voltage) source and it's properties, especially internal resistance.

    // ADC12CLK = SMCLK / 1
    ADC12CTL1 &= ~(ADC12DIV2 | ADC12DIV1 | ADC12DIV0);

    What's SMCLK freq?

  • The voltag source is low-impedance, for test purposes a simple DC power supply.

    SMCLK is 8 MHz. Is it possible that I get this problem because of the clock? Now that you said said that, you reminded me that I changed the clock frequency a few days ago (before I had 1 MHz). I'll try the lower clock frequency directly...

  • Phillip D. said:
    I'll try the lower clock frequency directly...

    Also please make sure that ADC clock is withing operating range, check datasheet/user_manual.

  • Ah yeah, thanks a lot! I just tried 1 MHz again and everything works fine. So I took a look into the datasheet where it says 6.3 MHz max. ADC clock.

    Problem solved :) Thanks again!

  • Phillip D. said:
    Problem solved :)

    Then please check this thread as answered so other readers know.

    Phillip D. said:
    Thanks again!

    Be my guest :)