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.

Program not working after Flash

Other Parts Discussed in Thread: MSP430G2131, MSP430G2553, UNIFLASH

Hi All,

Can someone please help me out. I'm struggling with my MSP430 on my Launchpad!

I want to flash my MSP430G2553 (also tried with a MSP430G2131). After flashing the LED's blink and my application stops running. Timer interrupts are not fired (in the debugger it works fine)!

I've tried: MSP430Flasher, UniFlash and FET-Pro430 Lite. All without luck!

This is my code:

#include <msp430.h> 

unsigned int i = 0;

void main(void) {

  WDTCTL = WDTPW + WDTHOLD;
  P1DIR |= BIT6;
  P1OUT &= ~BIT6;

  //Do some stupid blinking...
  for (i=10; i>0; i--)
  {
	 P1OUT ^= BIT6;
	 __delay_cycles(100000);
  }
  P1OUT &= ~BIT6;
  __delay_cycles(200000);

  TA0CCR0 = 12000;
  TA0CCTL0 = 0x10;
  TA0CTL = TASSEL_1 + MC_1;

  _BIS_SR(LPM0_bits + GIE);

  while(1) { }
}

#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer0_A0 (void)
{
   P1OUT ^= BIT6;
}

Did I miss something? Many thanks!!

Sander

  • KiwiFreaK said:
    Did I miss something?

    Yes! I found it!

      BCSCTL3 |= LFXT1S_2;

    After adding this line it works perfectly!! Can anyone explain me why?

  • By power-on default, ACLK (which you use for the timer)  is configured to run from XT1. Which is (by default) not populated on the LaunchPad. Therefore your timer has no clock to count.
    Your additional line switches ACLK to use the internal VLO (~12kHz).

    I don’t know why it should work in the debugger. I could only imagine that when using a simulator (not running the code on the actual MPU), the simulator assumes XT1 to be working and simulates the proper ACLK signal.

**Attention** This is a public forum