I have the following sample program for the MSP430 and I wish to rearrange it so that the line PM5CTL0 &= ~LOCKLPM5;
comes before P2SEL1 |= BIT0 | BIT1;
. Would there be a problem if I did so? I. e. would there be a problem if I configure the GPIO pins after disabling the high-impedance mode?
Nothing on my application/circuit side has any issues. I am just curious about any transient currents or other instability that might yield surprises? Or is it just a ritual/convention to disable the high-impedance mode after configuring GPIO?
#include "msp430.h"
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop Watchdog
// Configure GPIO
P2SEL1 |= BIT0 | BIT1; // USCI_A0 UART operation
P2SEL0 &= ~(BIT0 | BIT1);
// Disable the GPIO power-on default high-impedance mode to activate
// previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
// rest of program
}