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.

MSP430F5172: Enabling GPIO pin

Part Number: MSP430F5172

Is there an alternate to enable GPIO pin? I am using the function below. I am getting some on and off signals (which mainly results from noise in my sensor).I am using some of the P3 pins for PWM generation, I was wondering if that interferes with the signal I get from these pins. 

void OnBattery(){
P3OUT |= BIT0; //set 3.0 to high - enable battery GD
P2OUT |= BIT6; //set 2.6 to high
}

Thank you

  • P2DIR and P3DIR are? (I am assuming that the PxSEL bits are at their power up defaults.)

  • This is the configuration I have in the main loop. 

    P3SEL &= (~BIT0); // Set P3.0 to GPIO and to output direction - BAT_GD_EN
    P3DIR |= BIT0;

    P2SEL &= (~BIT6); // Set P2.6 as GPIO and to output direction - Vgate BAT
    P2DIR |= BIT6;

  • Many parts have the .5 LPM modes and require that you clear LOCKLPM5 to enable the GPIO ports. Check to see if you have one of those parts.

  • I am using MSP430f5172 and the datasheet says it has LPM4.5 mode but I am not sure how to configure it as I was only able to find low power modes up to 4. Is there an example code that I should reference to? 

  • In addition, in the user guide it says that all clock sources are disabled when it enters LPM4.5 Mode, however, I will be generating PWM signals to control one of the power stages. Will it affect the PWM generation? 

     One thing I didn't mention was also that disabling the GPIO pins gives me the correct output, I only have issue when I enable them. 

  • As I understand it: In the F5 series, LOCKLPM5 is only on if you're (re-)starting from LPMx.5. (On the FR2 and FR5 series, it's always on at startup.) If you're not using LPMx.5, I don't expect it will be on. There will be no PWM (nor much of anything else) running in LPMx.5, so I don't think you're interested in it.

    I'm still not clear what you mean by "enabled": (a) driven (PxDIR=1)? (b) driven high (PxDIR=1, PxOUT=1)? (c) GPIO function (PxSEL=0)? (d) unlocked (LOCKLPM5=0)? (I suggest you use the debugger to look directly at those registers, just in case an accident happened.)

    And what is your symptom? Is it that you set it high but it reads low? What's connected to those pins?

**Attention** This is a public forum