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.

G2101 operates weird without emulator being connected.

Other Parts Discussed in Thread: MSP430G2101

CCS v5.5

MSP430G2101

MSP-FET430UIF

Hi there,

I have a custom board with G2101 which works fine with emulator connected even without simulation. It is just enough to have emulator connected. However,  when I unplug the emulator and reset the board it works in a really weird way. The reset scheme is made according to the recommendation: 

What ever I did with SW it did not help until I increased DCO from 1Mhz to 8Mhz. Now It works fine no complaints. But I would like to know the reason of such behavior and to save power it is preferable to work on 1Mhz.

What it might be?

  • Stan, could you please show your code? The MSP will work with both, 1MHz and 8MHz (and everything else up to 16MHz). If it is no hardware issue, then it must be software. So you have a 47k resistor from RST to Vcc and a 2n2 capacitor from RST to GND? And decoupling capacitors on Vcc to GND? Your supply stays within the recommended voltage ranges? Maybe you have interrupts enabled and no handler? Or the watchdog is running? Hard to say...please provide more information.

    Dennis
  • Thanks for the quick response.  I can confirm that Vcc is stable and I do have 47k  from RST to Vcc and a 2n2 capacitor from RST to GND. I double check the HW and pretty sure that there is no issues.

    I am using GRACE for configuring. However, I tried to built that project without any extra tools. The behavior is the same.

    Here is my code:

    	WDTCTL = WDTPW + WDTHOLD;               // Stop WDT
    
    	//1Mhz
    	if (CALBC1_1MHZ==0xFF)					// If calibration constants erased
    	{
    	     while(1);                          // do not load, trap CPU!!
    	}
    	DCOCTL = 0;                             // Select lowest DCOx and MODx settings
    	BCSCTL1 = CALBC1_1MHZ;                  // Set range
    	DCOCTL = CALDCO_1MHZ;                   // Set DCO step + modulation */
    
    	/* Port 1 Output Register */
    	P1OUT = 0;
    	/* Port 1 Direction Register */
    	P1DIR = BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT7;
    	/* Port 1 Interrupt Edge Select Register */
    	P1IES = 0;
    	/* Port 1 Interrupt Flag Register */
    	P1IFG = 0;
    	/* Port 2 Output Register */
    	P2OUT = 0;
    	/* Port 2 Port Select Register */
    	P2SEL &= ~(BIT6 | BIT7);
    	/* Port 2 Direction Register */
    	P2DIR = 0;
    	/* Port 2 Interrupt Edge Select Register */
    	P2IES = 0;
    	/* Port 2 Interrupt Flag Register */
    	P2IFG = 0;
    
    	// TIMER
    	CCTL0 = CCIE;                           // CCR0 interrupt enabled
    	TACCR0 = 6249;
    	TACTL = TASSEL_2 | ID_3 | MC_1;
    
            TACTL |= MC_1;						// Start 5mS timer
    
            __bis_SR_register(GIE);     			// General interrupt enable

    I have only one interrupt enable which is from Timer A0:

    // Timer A0 interrupt service routine
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=TIMERA0_VECTOR
    __interrupt void Timer_A (void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(TIMERA0_VECTOR))) Timer_A (void)
    #else
    #error Compiler not supported!
    #endif
    {
    /*
    
    */
    
    }

    Thank you.

  • There is missing your "main" program in form of a

    while( 1 )
    {
    }

    inside your main. Your program will run to it's end. And you set the MC_1 twice which is not necessary

    TACTL = TASSEL_2 | ID_3 | MC_1;
    TACTL |= MC_1;

    but isn't a problem. When the timer is sourced from SMCLK at 1MHz and you have an input divider of 8 (ID_3), then

    TACCR0 = 6249;

    will lead to 50ms not 5ms. Are you sure your calibration constants are still present? Or does the code run into

    if( CALBC1_1MHZ == 0xFF ) // If calibration constants erased
    {
      while( 1 );             // do not load, trap CPU!!
    }

    ? What do you mean by "G2101 operates weird..."? I cannot see anything in your code that outputs something.

    Dennis

  • Hi Dennis,

    Thanks for your help. The simplest way I can demonstrate the problem is this. P1.6 is input with no pull up/down resistor. I shorted it to GND. After initialization micro should turn P1.2 in HIGH. However, P1.0 always goes HIGH instead.

    #include <msp430.h> 
    
    
    void main(void)
    {
    	WDTCTL = WDTPW + WDTHOLD;               // Stop WDT
    
    	//1Mhz
    	if (CALBC1_1MHZ==0xFF)					// If calibration constants erased
    	{
    	     while(1);                          // do not load, trap CPU!!
    	}
    	DCOCTL = 0;                             // Select lowest DCOx and MODx settings
    	BCSCTL1 = CALBC1_1MHZ;                  // Set range
    	DCOCTL = CALDCO_1MHZ;                   // Set DCO step + modulation */
    
    	/* Port 1 Output Register */
    	P1OUT = 0;
    	/* Port 1 Direction Register */
    	P1DIR = BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT7;
    	/* Port 1 Interrupt Edge Select Register */
    	P1IES = 0;
    	/* Port 1 Interrupt Flag Register */
    	P1IFG = 0;
    	/* Port 2 Output Register */
    	P2OUT = 0;
    	/* Port 2 Port Select Register */
    	P2SEL &= ~(BIT6 | BIT7);
    	/* Port 2 Direction Register */
    	P2DIR = 0;
    	/* Port 2 Interrupt Edge Select Register */
    	P2IES = 0;
    	/* Port 2 Interrupt Flag Register */
    	P2IFG = 0;
    
    	if (!(P1IN & BIT6)) // if P1.6 is LOW
    		P1OUT |= BIT2;
    	else
    		P1OUT |= BIT0;
    
      	while(1);
    
    }
    

    Cheers,

    Stan 

  • Any ideas why it goes a wrong way?

  • Does the code work OK on Launchpad with all jumpers except Vcc removed?

    Sometimes reset does not work unless you exit debug-mode correctly by first pause button then stop button.

    I guess there is something not right with you external board, schematic and gerbers will help.

  • Hi Tony,

    I assembled this scheme on a prototype board and pretty sure that it is not HW issue.


    I have a launchpad with G2452 will check this code there. In terms of the exit of debug mode will check it too.

    Thank you

  • No matter how I exit debug mode custom board always works wrong. Launchpad with G2452 works well, no questions.

  • Stan,

    you will not get releiable values when doing this

    if( !(P1IN & BIT6) ) // if P1.6 is LOW
      P1OUT |= BIT2;
    else
      P1OUT |= BIT0;

    without having a pull-up/down-resistor connected to the input pin. Don't leave the pin floating. It will change it's value randomly. With a set jumper the potential is defined to 0, but without it, both statements could be true (only one at a time of course).

    Dennis

  • Exactly. But in my case jumper on J8 always shorts P1.6 to ground.
  • From the partial schematic you have posted, I cannot see anything wrong in your connections.
  • With a multimeter did you measure the voltage close to P1.6pin, maybe the jumper is not making good contact.
    Why not enable pull-down on P1.6 to see if that proves jumper is bad.
    Why not move it to P1.7 to see if pin have gone bad.
    Remove the ! in if statement to make sure an opposite works and this code actually is reached.

    These are all typical debugging you have to make first before posting as we can not check it in person.

  • I checked everything already. Just replaced the micro. Now it works fine. Thanks everybody.

**Attention** This is a public forum