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.

MSP430FR5969: How to retain the code in the flash

Part Number: MSP430FR5969

Hello TI Team,

I have a question, I am flashing an LED ON/OFF code into the MSP430FR5969 but when the power switches OFF the MSP does not retain the code like I again have to reflash it. How can I save the code in the MSP so that everytime it rebots, It should execute the code.

Thank you!

Best regards,

Pukhraj Singh

Code

#include <msp430.h>

int main(void)
{
  WDTCTL = WDTPW | WDTHOLD;                 // Stop WDT

  // GPIO Setup
  P1OUT = 0;
  P1DIR = 0xFF;

  P2OUT = 0;
  P2DIR = 0xFF;

  P3OUT = 0;
  P3DIR = 0xFF;

  P4OUT = 0;
  P4DIR = 0xFF;

  PJOUT = 0;
  PJSEL0 = BIT4 | BIT5;                     // For XT1
  PJDIR = 0xFFFF;

  // Disable the GPIO power-on default high-impedance mode to activate
  // previously configured port settings
  PM5CTL0 &= ~LOCKLPM5;

  // Clock System Setup
  CSCTL0_H = CSKEY >> 8;                    // Unlock CS registers
  CSCTL1 = DCOFSEL_6;                       // Set DCO to 8MHz
  CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK;
  CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;     // Set all dividers
  CSCTL4 &= ~LFXTOFF;                       // Enable LFXT1
  do
  {
    CSCTL5 &= ~LFXTOFFG;                    // Clear XT1 fault flag
    SFRIFG1 &= ~OFIFG;
  } while (SFRIFG1&OFIFG);                  // Test oscillator fault flag
  CSCTL0_H = 0;                             // Lock CS registers

  while(1)
  {
    P1OUT ^= BIT0;                          // Toggle LED
    __delay_cycles(8000000);
  
 

**Attention** This is a public forum