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.

MSP430F5635 lost in space

Greetings,

I've been trying to get a handle on this for a day, but can't seem to figure it out. 

I'm using a TI MSP-TS430PZ100USB and IAR.

Also enabling the 4 Mhz crystal and the 32.7 crysstal.

I have the following for unused interrupts:

#include "msp430f5635.h"

#pragma vector = PORT4_VECTOR,PORT3_VECTOR,TIMER2_A1_VECTOR,TIMER2_A0_VECTOR,\
                   TIMER1_A0_VECTOR, WDT_VECTOR,TIMER0_B1_VECTOR,TIMER0_B0_VECTOR,COMP_B_VECTOR,UNMI_VECTOR,SYSNMI_VECTOR
__interrupt void unused_handler(void)
  {
	 while(1);
  }

My issue occurs in main() where I have:

	while(1)
	{
	
		 __no_operation();
          
                 __bis_SR_register(LPM0_bits + GIE);   //wait for an interrupt

		__no_operation();

              .....
         }

 After the SR bit setting I immediately end up (according to the disassembly screen) here:

000000    D032 00F0          bis.w   #0xF0,SR
 000004    3FFF               jmp     0x4
 000006    DFFF 0000          bis.b   @R15+,0x0(R15)
 00000A    FFFF FFFF          and.b   @R15+,0xFFFF(R15)
 00000E    FFFF FFFF          and.b   @R15+,0xFFFF(R15)
 000012    FFFF BFFF          and.b   @R15+,0xBFFF(R15)
 000016    7FFF 7FFF          subc.b  @R15+,0x7FFF(R15)
 00001A    FFFF FFFF          and.b   @R15+,0xFFFF(R15)
 00001E    FFFF 0000          and.b   @R15+,0x0(R15)
 000022    0000               ????
 000024    0000               ????
 000026    0000               ????
 000028    0000               ????
 00002A    0000               ????
 00002C    0000               ????
 00002E    0000               ????

I have been coding MSP430F2618s and other variants successfully for years and I'm probably missing something obvious, but would appreciate any help and debugging tips. Let me know if more info is needed.

Thanks.

  • I would immediately try some simple LED blink or similar but confirmed to work, code example to see how it behaves comparing to my code. Then look for behavior and code differences until problem with my code found.

    You say that you initialize crystals but do not show code. Maybe clock init code causes crash?


  • Thank you for your prompt reply. I have the clocks coming out on pins and they are just fine. I have programmed this module with some simple code prior to this and it worked okay so I know the hardware works. But here is the clock init code:


    void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P1DIR |= BIT0; // ACLK set out to pins P1SEL |= BIT0; P3DIR |= BIT4; // SMCLK set out to pins P3SEL |= BIT4; BAKCTL |= BAKDIS; //disable battery backup while(BAKCTL & LOCKBAK) // Unlock XT1 pins for operation BAKCTL &= ~(LOCKBAK); P7SEL |= BIT2+BIT3; // Port select XT2 UCSCTL6 &= ~(XT1OFF); // XT1 On UCSCTL6 |= XCAP_3; // Internal load cap // Loop until XT1 fault flag is cleared UCSCTL3 = SELREF_2; //set DCO reference = UCSCTL4 = SELA_0 | SELS_3 | SELM_3; //set ACLK = xt1 UCSCTL5 = DIVS_2; UCSCTL6 &= ~(XT2OFF + XT1OFF); UCSCTL6 |= XCAP_3; UCSCTL0 = 0x0000; //set lowest possible DCOx, MODx //loop 'til stable do { UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG); SFRIFG1 &= ~OFIFG; __no_operation(); }while(SFRIFG1 & OFIFG); __bis_SR_register(SCG0); //disable FLL control loop UCSCTL1 = DCORSEL_6; //select DCO range 16 Mhz operation UCSCTL2 |= 1; //set DCO multiplier for 8 Mhz //(N + 1)*FLLRef = Fdco //(249 + 1)*32768 = 8 Mhz __bic_SR_register(SCG0); //enable FLL control loop //32*32*8 Mhz = 250000 = MCLK cycles for DCO to settle __delay_cycles(250000);

    Also here is my timer interrupt code which may fire once or twice before I get lost at the same spot:

    void TimerA_init(void)
    {
      TA0CTL |= (TASSEL_1 + ID_0 + MC_2); 
    
      TA0CCR0 = 0x8000;         // 32768
      TA0CCR1 = 1600;           
    }
    
    
    #pragma vector=TIMER0_A0_VECTOR
    __interrupt void Timer_A0_ISR (void)
    {
      TA0CCR0 += 0x8000;
      heart_beat++;
      sleep_timer++;
     __bic_SR_register(LPM0_bits);
    }
    

  • Sheesh, a typo in a timer isr.
    Working now.

**Attention** This is a public forum