I'm stuck on a problem where my Assembly project is stuck in an interrupt loop. I'm using CCS5,
I Single stepped through the code and gets stuck within an interrupt.
If I disable the interrupt it's OK , but once I enable "eint" it enters and never leaves
I tried just about everything, setting the "enable interrupt" to 0 to disable it and tried reading and writing to no avail
Now I have no Idea why it's not clearing.
P1 and P3 all 8 bits as output
P2, 0 ~ 3 output,, and 5 &6 as input ( haven't got there yet
PJ 4 & 5 as watch xtal ( 32768hz )
Any help is appreciated.
Roman
P.S. Hope all have a Happy New Year
;******************************************************************************
; MSP430fr5939
; Real Time Clock
; Stage one
;
;******************************************************************************
.cdecls C,LIST, "msp430fr5739.h"
;------------------------------------------------------------------------------
.text ; Program Start
.global RESET
;------------------------------------------------------------------------------
; ------------------- S y s t e m C o n f i g -------------------
RESET mov.w #0x02000 ,SP ; Initialize stackpointer
mov.w #WDTPW+WDTHOLD ,&WDTCTL ; Stop WDT
dint
mov.w #0xA500 ,&CSCTL0
bis.w #DCOFSEL0+DCOFSEL1 ,&CSCTL1
bis.w #SELA_0+SELS_3+SELM_3 ,&CSCTL2
bis.w #DIVA_0+DIVS_0+DIVM_0 ,&CSCTL3
bis.w #XT1DRIVE_0 ,&CSCTL4
bic.w #XT1OFF ,&CSCTL4
bis.w #BIT4+BIT5 ,&PJSEL0 ; Set J port for Xtal
bic.w #XT1OFFG ,&CSCTL5
; -----------------------------------------------------------------------------
Start_Here nop
; -----------------------------------------------------------------------------
; ------------------- S e t P o r t s -----------------------------
bis.b #0x0FF ,&PBDIR_L ; Minutes P3OUT
bis.b #0x0FF ,&PADIR_L ; Seconds P1OUT
bis.b #0x00F ,&PADIR_H ; Hours P2OUT
bic.b #0xFF ,&PAOUT_H ; &P2OUT
bic.b #0xFF ,&PBOUT_L ;&P3OUT Clr the output registrar
bic.b #0xFF ,&PAOUT_L ; &P1OUT clr the one second mux ports
mov.w #0 ,&PAIE ; disable interrupts Port 1 & 2
; ------------------- S e t R e a l T i m e C l o c k ---------------------
bic.w #RTCHOLD ,&RTCCTL01 ; start RTC
bis.w #RTCRDYIE ,&RTCCTL01 ; RTC INT Ready set
; ------------------ Special Function Register Module ----------------
bic.w #OFIFG+JMBINIE+JMBOUTIE ,&SFRIFG1 ; disable interrupt
eint
waste_time nop ; Immediately jumps to Interrupter "nothing8"PORT1_VECTOR
; call #sec_time ; If I disable interrupt
; call #hr_time ; but commenting out "eint"
; call #min_time ; it works, but my intention
jmp waste_time ; is to use the RTC interrupt
; --------------------------------------------------------
; RTC reporting OSC fault, try to clear alarm
; --------------------------------------------------------
clr_rtc_fault nop
bic.w #RTCOFIFG ,&RTCCTL01 ; clr osc fault
bit.w #RTCIV_RTCOFIFG ,&RTCIV
jnz clr_rtc_fault
ret
; *******************************************************************
; check switches and add time
; *******************************************************************
switches nop
bit.b #0x020 ,&P2IN ;inc minutes
jnz test_hrs
inc &RTCTIM0_H
test_hrs bit.b #0x040 ,&P2IN ; inc hours
jnz nope
inc &RTCTIM1_L
nope nop
ret
; ********************************************************************
; Seconds routine only part of it is here to make it easier to read
; ********************************************************************
sec_time nop
mov.b &RTCTIM0_L, R6
cmp #0, R6
jne next2
mov.b #0x07F, &P1OUT
next2 ret
;------------------------------------------------------------------------------
; Advance MIN subroutine only part of it is here
;------------------------------------------------------------------------------
min_time nop
mov.b &RTCTIM0_H, R7
nxt1 cmp #0, R7
jne nxt2
mov.b #0x07F, &P3OUT
nxt2 ret
;------------------------------------------------------------------------------
; subroutines Hour
;------------------------------------------------------------------------------
hr_time nop
mov.b &RTCTIM1_L ,R8
bis.b #0x00 ,&P2OUT
nt1 cmp #0 ,R8
jne nt2
bic.b #0x0F ,&P2OUT
nt2 ret
;------------------------------------------------------------------------------
; X t a l F a u l t I n t e r r u p t
;------------------------------------------------------------------------------
UNMI_ISR nop
again bic.w #XT1OFFG ,&CSCTL5
bic.w #OFIFG ,&SFRIFG1
mov.w #0x2000 ,R15
delay_1 dec.w R15
jnz delay_1
cmp.w #0x01 ,&OFIFG
jz again
reti
; ---------------------------------------------------------------
; RTC interrupt
; ---------------------------------------------------------------
run_clk nop ; RTC ready interrupt
call #min_time
call #hr_time
call #sec_time
call #switches
reti
; ----------------------------------------------------------------
nothing1 nop
reti
nothing2 nop
reti
nothing3 nop
reti
nothing4 nop
reti
nothing5 nop
reti
nothing6 nop
reti
nothing7 nop
reti
; Stays in this interrupt and never exits WHY ?????
; Tried Clearing, and writing
nothing8 nop ; PORT1_VECTOR Alway Jumps here
mov.w #0 ,&P1IE ; and stays here
mov.w #0 ,&P2IE ; WHY ?????
mov.w #0 ,&PAIFG
mov.w #0 ,&PBIFG
mov.b #0 ,&P1IFG
mov.b #0 ,&P2IFG
mov.b #5 ,&P2OUT ; LED on stuck means stuck here
reti
nothing9 nop
reti
nothing10 nop
reti
nothing11 nop
reti
nothing12 nop
reti
nothing13 nop
reti
nothing14 nop
reti
nothing15 nop
reti
nothing16 nop
reti
nothing17 nop
reti
nothing18 nop
reti
nothing19 nop
reti
nothing20 nop
reti
nothing21 nop
reti
;------------------------------------------------------------------------------
; Interrupt Vectors
;------------------------------------------------------------------------------
.sect RTC_VECTOR ; int39
.short run_clk ; -------------- RTC
.sect PORT4_VECTOR ; int40
.short nothing1
.sect PORT3_VECTOR ; int41
.short nothing2
.sect TIMER2_B1_VECTOR ; int42
.short nothing3
.sect TIMER2_B0_VECTOR ; int43
.short nothing4
.sect PORT2_VECTOR ; int44
.short nothing5
.sect TIMER1_B1_VECTOR ; int45
.short nothing6
.sect TIMER1_B0_VECTOR ; int46
.short nothing7
.sect PORT1_VECTOR ; int47
.short nothing8
.sect TIMER1_A1_VECTOR ; int48
.short nothing9
.sect TIMER1_A0_VECTOR ; int49
.short nothing10
.sect DMA_VECTOR ; int50
.short nothing11
.sect USCI_A1_VECTOR ; int51
.short nothing12
.sect TIMER0_A1_VECTOR ; int52
.short nothing13
.sect TIMER0_A0_VECTOR ; int53
.short nothing14
.sect ADC10_VECTOR ; int54
.short nothing15
.sect USCI_B0_VECTOR ; int55
.short nothing16
.sect USCI_A0_VECTOR ; int56
.short nothing17
.sect WDT_VECTOR ; int57
.short nothing18
.sect TIMER0_B1_VECTOR ; int58
.short nothing19
.sect TIMER0_B0_VECTOR ; int59
.short nothing20
.sect COMP_D_VECTOR ; int60
.short nothing21
.sect UNMI_VECTOR ; int61
.short UNMI_ISR ; ------- A clk has failed or not started
.sect SYSNMI_VECTOR ; int62
.short RESET ; -------------- RESET
.sect RESET_VECTOR ; int63
.short RESET ; -------------- RESET
.end