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.

Bizarre behavior using assembly language with the MSP430FR4133. Need Help!!

Other Parts Discussed in Thread: MSP-EXP430FR4133

Hello everyone!

I have been programming my MSP-EXP430FR4133 Launch Pad Development Kit using Code Composer Studio version  6.1.3.00034

My programs up to this point have been C code and they have been working great! I can compile them and download them onto the board and everything works as it should.

Recently I started learning assembly language and now I am seeing some very odd behavior that I cannot describe and I really need someone who has experience in this area to help me. This is NOT for a class project. I am a simple hobbyist who loves to tinker and right now I am at this dead end and could use some help.

The issue is that when I try to run a very simple assembly program to blink an LED on the board, nothing happens. That is not odd and I am sure we all have been there when your program doesnt do what it is supposed to do, right? But here comes the weird part. If I run a C program to do the same thing; turn on an LED; the C program will work just fine. If I then go back to my assembly program and try to run my assembly program again, it will work this time!! But if I shutdown and restart CCS and try to run my assembly program I again get the same output of having no LED turn on. What is going on?!

I have been reading all of these documents from TI and pouring over examples from the web and nothing can explain why my assembly program will only work if I first run a C program before I try to run my assembly program.

Here is the assembly program code:

;-------------------------------------------------------------------------------
; MSP430 Assembler Code Template for use with TI Code Composer Studio
;
;
;-------------------------------------------------------------------------------
            .cdecls C,LIST,"msp430fr4133.h"       ; Include device header file
            
;-------------------------------------------------------------------------------
            .def    RESET                   ; Export program entry-point to
                                            ; make it known to linker.
;-------------------------------------------------------------------------------
            .text                           ; Assemble into program memory.
            .retain                         ; Override ELF conditional linking
                                            ; and retain current section.
            .retainrefs                     ; And retain any sections that have
                                            ; references to current section.

;-------------------------------------------------------------------------------
RESET       mov.w   #__STACK_END,SP             ; Initialize stackpointer
StopWDT     mov.w   #WDTPW|WDTHOLD,&WDTCTL      ; Stop watchdog timer
	    mov.b   #00000001b, &P1OUT		; Load the P1OUT register so it turns on LED # 1 which is tied to bit 0 of the P1OUT register
	    mov.b   #00000001b, &P1DIR		; Set the direction of the P1 register to be an output for bit 0 which is tied to LED 1

;-------------------------------------------------------------------------------
; Main loop here
;-------------------------------------------------------------------------------

InfLoop:	jmp InfLoop
		NOP

;-------------------------------------------------------------------------------
; Stack Pointer definition
;-------------------------------------------------------------------------------
            .global __STACK_END
            .sect   .stack
            
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
            .sect   ".reset"                ; MSP430 RESET Vector
            .short  RESET
            

Now here is the C code that does the same thing:

#include <msp430fr4133.h>

int main(void)
{
    PM5CTL0 &= ~LOCKLPM5;                   // Disable the GPIO power-on default high-impedance mode
                                            // to activate previously configured port settings
    WDTCTL = WDTPW | WDTHOLD;				// Stop the watchdog timer

    P1DIR = 0x01;

    P1OUT = 0x01;

    for(;;)
    {
    }

	return (0);
}

Can anyone please help me understand why the assembly language project will only work if I first run the C program????

**Attention** This is a public forum