Part Number: MSP430FR5994
When running the Launchpad in active mode (using the supercap) the RTC counters does not read correctly if a SVSH was triggered.
;--COPYRIGHT--,BSD_EX
; Copyright (c) 2012, Texas Instruments Incorporated
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
;
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
;
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; * Neither the name of Texas Instruments Incorporated nor the names of
; its contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;
; ******************************************************************************
;
; MSP430 CODE EXAMPLE DISCLAIMER
;
; MSP430 code examples are self-contained low-level programs that typically
; demonstrate a single peripheral function or device feature in a highly
; concise manner. For this the code may rely on the device's power-on default
; register values and settings such as the clock configuration and care must
; be taken when combining code from several examples to avoid potential side
; effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
; for an API functional library-approach to peripheral configuration.
;
; --/COPYRIGHT--
;******************************************************************************
; MSP430FR59x Demo - Toggle P1.0 using software
;
; Description: Toggle P1.0 using software.
; ACLK = n/a, MCLK = SMCLK = TACLK = default DCO = ~625 KHz
;
; MSP430FR5969
; ---------------
; /|\| |
; | | |
; --|RST |
; | |
; | P1.0|-->LED
;
; Tyler Witt/ P. Thanigai
; Texas Instruments Inc.
; August 2012
; Built with Code Composer Studio V5.5
;******************************************************************************
;-------------------------------------------------------------------------------
.cdecls C,LIST,"msp430.h" ; Include device header file
;-------------------------------------------------------------------------------
.def RESET ; Export program entry-point to
; make it known to linker.
;-------------------------------------------------------------------------------
.global _main
.global __STACK_END
.sect .stack ; Make stack linker segment ?known?
.text ; Assemble to Flash memory
.retain ; Ensure current section gets linked
.retainrefs
;-------------------------------------------------------------------------------
; Main code here
;-------------------------------------------------------------------------------
_main
RESET mov.w #__STACK_END,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
UnlockGPIO bic.w #LOCKLPM5,&PM5CTL0 ; Disable the GPIO power-on default
; high-impedance mode to activate
; previously configured port settings
;-------------------------------------------------------------------------------
; SVSH reset code here
;-------------------------------------------------------------------------------
cmp.b &IV, &SYSRSTIV ; Check if reset is SVSH
jne SKIPSVSH
mov.b &RTCCNT1, &CNT1
mov.b &RTCCNT2, &CNT2
mov.b &RTCCNT3, &CNT3
mov.b &RTCCNT4, &CNT4
add.w #1, &RESETCNT
SKIPSVSH:
mov.b #0x10, &PJSEL0 ; PJ SEL0 lfxt
mov.b #0xA5, &RTCCTL0_H ; unlock
mov.b #RT1SSEL, &RTCCTL1 ; setup counter mode.
mov.b #0x1C, &RTCPS0CTL
mov.b #RT1SSEL+RT1PSDIV+RT1IP, &RTCPS1CTL
bic.b #RTCHOLD, &RTCCTL1 ; clear the RTCHOLD and bit to start the counter.
mov.b #0xA5, &RTCCTL0_H ; lock
SetupP1 bis.b #BIT0,&P1OUT ; Clear P1.0 output latch for a defined power-on state
bis.b #BIT0,&P1DIR ; Set P1.0 to output direction
MainLoop:
nop
jmp MainLoop
nop
;-------------------------------------------------------------------------------
; Variable definitions
;-------------------------------------------------------------------------------
.text
CNT1 .byte 0xFF
CNT2 .byte 0xFF
CNT3 .byte 0xFF
CNT4 .byte 0xFF
RESETCNT .word 0xFFFF
IV .word 0x000E
.end
;-------------------------------------------------------------------------------
; Stack Pointer definition
;-------------------------------------------------------------------------------
.global __STACK_END
.sect .stack
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; MSP430 RESET Vector
.short RESET
and here are the results of the diagnostic variables:
CNT1 3021 CNT3 0002 RESETCNT 0000 IV 000E

