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.

MSP-EXP430FR5969: MSP-EXP430FR5969

Part Number: MSP-EXP430FR5969

Hey all,

I am doing some testing with the MSP-EXP430FR5969 Launchpad dev board, and I am going to eventually need to connect the "RST" pin to an external push-button in my design, with the intention of resetting the code from the start of the infinite while loop so I wanted to test it out by using the onboard switch, P1.1 as an input - using this input, I wanted to control an I/O pin, P4.3 as a makeshift "trigger", which is jumper-wired to the "RST" pin onboard the launchpad.

My goal is to use this switch, P1.1, to trigger GPIO P4.3 to send a pseudo logic low to the "RST" pin to essentially jump back to the beginning of my infinite while loop.

Here are the relevant snippets of my code:

#include "io430.h"
#define SWITCH                         P1IN_bit.P1IN1
#define CLK                                P3IN_bit.P3IN0
#define RESET_TRIGGER         P4OUT_bit.P4OUT3
#define PIN1                               P3OUT_bit.P3OUT4
#define PIN2                               P1OUT_bit.P1OUT3
#define PIN3                               P1OUT_bit.P1OUT4
#define PIN4                               P1OUT_bit.P1OUT5

int main (void)
{

WDTCTL = WDTPW + WDTHOLD;          // Disable WDT.

PMMCTL0 = PMMPW;                              // Open PMM.

PM5CTL0 &= ~LOCKLPM5;                     // Clear LPM5 / locked IO pins.

...

...

P1DIR_bit.P1DIR1 |= 0;

P1REN_bit.P1REN1 = 1;

P1OUT_bit.P1OUT1 = 1;       //Along with above 2 lines of code, config SWITCH (P1.1) to have Pullup resistors.

P4DIR_bit.P4DIR3 |= 1;         //Config P4.3 to be output.

P4OUT_bit.P4OUT3 |= 1;      //Config P4.3 to be Logic High from the start.

...

...

...

while(1)
{
if (CLK == 1 && state == 0)
{
  if (pinSelect == 0)
  {
    PIN1 = 1;
    state = 1;
  }
  else if (pinSelect == 1)
  {
    PIN2 = 1;
    state = 1;
  }
  else if (pinSelect == 2)
  {
    PIN3 = 1;
    state = 1;
  }
  else if(pinSelect == 3)
  {
    PIN4 = 1;
    state = 1;
  }
}

if (CLK == 0 && state == 1)
{
  if (pinSelect == 0)
  {
    PIN1 = 0;
    state = 0;
    pinSelect++;
  }

  else if (pinSelect == 1)
  {
    PIN2 = 0;
    state = 0;
    pinSelect++;
  }

  else if (pinSelect == 2)
  {
    PIN3 = 0;
    state = 0;
    pinSelect++;
  }

  else if (pinSelect == 3)
  {
    PIN4 = 0;
    state = 0;
    pinSelect = 0;
  }
}

if (SWITCH == 0)
{
  P4OUT_bit.P4OUT3 = 0;
}

}   //End while loop.

}   //End main loop.

My cases are such that there are 3 main if statements, my intention is to RESET the while loop with the push of a button, so I wanted to try using one of the onboard switch buttons to control a GPIO pin to signal the RST pin...

This could be entirely wrong to do - any and all suggestions are helpful! Slight smile

  • Hello Jacob, 

    I am sorry that I will be out of office until 14th April, and I will help you after I back to office. And if your issue is urgent, you can set a new post, and our American colleague will help you and respond to you in 24 hours.

    Best Regards,

    Janz Bai

  • I'm not quite sure of your goal. 

    If your goal is to return to the top of the while(1), you can just use "continue;" (or even "goto" if need be).

    If your goal is to start main() from the beginning, with all the globals re-initialized, software can generate a Reset, e.g. with "WDTCTL=0;".

    Connecting RST to a pushbutton is fine (your Launchpad has one). Driving it with a GPIO seems like the long way around.

  • My goal is to return to the top of the while - not necessarily a BOR/ full reset, a BOR would clear all of the GPIO settings I have, right?

    I have never used "continue" or "goto" - I will look into these.

    Also, I spent some time reading through the MSP430FRxx User's Guide, particularly on the reset sub-sections from section 1.2 "System Reset and Initialization" - I haven't fully understood which bits to manipulate in my third if statement quite yet but I assume something in that section would be useful to control a reset of some sort.

  • Hello Jacob,

    If you use the RST pin to reset your device, it will start main () from the beginning and all the globals re-initialized, Bruce is right. So has your issue been resolved now, Jacob?

    Best Regards,

    Janz Bai

  • Yes, this made sense.

    The datasheet mentions the same thing, and having this lesson learned help solidify this understanding.

  • Would you happen to know some good resources that could enlighten me on these?

    I have novice level C coding background, so any kind of good database to learn about these would be great - book, website, etc.

  • Hello Jacob,

    If you want to get some resources of MSP430, you can download SDK from ti.com, which is the example code of MSP430 application. And you can also get other software or document resources from ti.com about MSP430.

    Best Regards,

    Janz Bai

**Attention** This is a public forum