News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

dsPIC33EP256MU806 - DMA0Interrupt stalls the program ?

Started by trastikata, Mar 12, 2023, 01:04 PM

Previous topic - Next topic

trastikata

Hello,

with respect to my recent post (https://protoncompiler.com/index.php?msg=12125) I've found out that simply inserting this ISR routine

Isr DMA0Interrupt

EndIsr

with or without any code in it, and with or without any interrupts enabled will stall the MCU and the program will not run.

My question is why just by putting this ISR routine name with no code in it and with no other change in the program, the program will stall?

diebobo

Check if u dont use the clear command it will work ?

trastikata

Quote from: diebobo on Mar 12, 2023, 01:34 PMCheck if u dont use the clear command it will work ?

Thanks diebobo, but commenting out the Clear command doesn't help.

trastikata

#3
Hello,

I am looking at the assembler code, generated by Positron16 and trying to understand how the Interrupt vector addressing is organized but it seems I can't understand anything, it is nothing like the Assembler code for the 8-bit MCU's.

Any help showing the interrupt vector addressing in the assembler code with following simple Positron16 code will be much appreciated:

Device = 33EP256MU806
Declare Xtal = 40

Isr INT1Interrupt
EndIsr

Isr T1Interrupt
EndIsr

Isr DMA0Interrupt
EndIsr   

Main:
End
 

SCV

I have had problems where an ISR is called when there is no code to handle it. Clearing the interrupt flag in each ISR should enable the program to continue, otherwise it could loop forever.

trastikata

#5
Quote from: SCV on Mar 14, 2023, 09:48 AMI have had problems where an ISR is called when there is no code to handle it. Clearing the interrupt flag in each ISR should enable the program to continue, otherwise it could loop forever.

The thing is that the corresponding interrupts are not even enabled. Thus that ISR should not be called at all.

I only can speculate that there's something wrong with Interrupt vectoring but I can't make heads or tales from the Assembler code and the interrupt vectors in Positron16.

8-bit Assembler interrupt looks like that and you see the interrupt addressing at org 0x08:
Device = 18F25J50
Declare Xtal = 40

On_Hardware_Interrupt GoTo ISR_HANDLER
GoTo Main
ISR_HANDLER:

Main:
End
|
|
V
;---------------------------------------------
; START OF THE COMPILER'S LIBRARY ROUTINES
_compiler__start_
    org 0x00
    nop
    nop
    goto _compiler_main_start_
    org 0x08
    bra ISR_HANDLER
_compiler_main_start_
    movlb 0
;---------------------------------------------
; START OF THE USER'S PROGRAM CODE
F1_SOF equ $ ; TEST.BAS
    movlb 0x0F
    setf ANCON0,1
    movlw 127
    movwf ANCON1,1
F1_000005 equ $ ; in [TEST.BAS] goto Main
    movlb 0x00
    bra Main
;---------------------------------------------
; HIGH PRIORITY INTERRUPT HANDLER
ISR_HANDLER
Main
F1_000009 equ $ ; in [TEST.BAS] end
_pblb__2
    bra _pblb__2
F1_EOF equ $ ; TEST.BAS
_pblb__3
    bra _pblb__3
;---------------------------------------------
__eof

16-bit Assembler interrupt looks like that but I can't understand where's the interrupt addressing for the Interrupt Vector Table?

Device = 33EP256MU806
Declare Xtal = 40

GoTo Main
Isr INT1Interrupt
EndIsr

Main:
End
|
|
V
.text
compiler_code_start_:
;------------------------------------------
; start of the compiler's library routines
.global __MathError
__MathError:
    bclr.w INTCON1,#pp_matherr
    clr.w WREG0
    clr.w WREG1
    retfie
.text
.def _pos16_main_start_
.val _pos16_main_start_
.scl 2
.type 041
.endef
;------------------------------------------
; start of the user's program
.global __reset
.global _pos16_main_start_
_pos16_main_start_:
__reset:
; setup the stack
    mov.w #0x1000,W15
    mov.w #0x108e,W0
    mov.w W0,SPLIM
    nop
; Clear the WREG sfrs
    clr.w W0
    mov.w W0,W14
    repeat #12
    mov.w W0,[++W14]
    clr.w W14
    clr.w TBLPAG
.def .bf
.val .
.scl 101
.Line 1
.endef
    clr.w PMCON
    bset.b PADCFG1,#0
    clr.w ANSELB
    clr.w ANSELC
    clr.w ANSELD
    clr.w ANSELE
    clr.w ANSELG
; rd_i000008_f001_000004_p000016,0 mkr$ in [test.bas] goto Main
    goto Main
    bra _lbli__28
.global __INT1Interrupt
__INT1Interrupt:
    disi #0x3fff
    push STATUS
    push RCOUNT
    push CORCON
    push.w W14
    mov.w #0x00,W14
    repeat #13
    mov.w [W14++],[W15++]
    push DSRPAG
    push DCOUNT
    push DOSTARTL
    push DOENDL
    disi #0x01
    disi #0x3fff
    pop DOENDL
    pop DOSTARTL
    pop DCOUNT
    pop DSRPAG
    mov.w #0x1a,W14
    repeat #13
    mov.w [--W15],[W14--]
    pop.w W14
    pop CORCON
    pop RCOUNT
    pop STATUS
    disi #0x01
    retfie
_lbli__28:
.global Main
Main:
; rd_i00009_f001_000009_p000016,0 mkr$ in [test.bas] end
1:
    bra 1b
.def .ef
.val .
.scl 101
.Line 9
.endef
__eof:
.def _pos16_main_start_
.val .
.scl -1
.endef

diebobo

Not sure if i can help, but dump the .lst as well..