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.

MSP430FR5964: Toggle ADC/GPIO functionality

Part Number: MSP430FR5964

Hi,

I need to toggle P1.1 (A1) from ADC to GPIO after every sampling.

When I set P1SELC |= BIT1, just before I set ADC12CTL0 |= ADC12ENC | ADC12SC, the ADC is not working.

It works when I set P1SELC |= BIT1 at the beginning of the code (just before PM5CTL0 &= ~LOCKLPM5. But than I cannot change the GPIO functionality on the fly.

Any ideas?

Thanks,

Itay

  • In what way does it not work? The pin is actually always connected to the ADC, but if PSEL != 3 the Schmitt triggers are still engaged so the result is boring [Ref data sheet (SLASE54D) Fig 9-3].

    I count 5x Errata related to ADC operation [Ref Errata sheet (SLAZ682L) Sec 1]. Is it possible some other code (which you haven't shown) is tripping over one of these?

  • Hi,

    The solution was to add small delay between changing the port functional selection and start sampling:

    P1SELC |= BIT1; // Configure P1.1 for ADC
    __delay_cycles(500);
    ADC12CTL0 |= ADC12ENC | ADC12SC; // Start sampling/conversion

    Thanks,

    Itay

**Attention** This is a public forum