• AVR Freaks

Hot!Default Interrupts: How to tell what was the cause? PIC24FJ64GA702

Author
user2x
Super Member
  • Total Posts : 352
  • Reward points : 0
  • Joined: 2011/02/10 20:43:36
  • Location: 0
  • Status: offline
2019/11/13 15:14:24 (permalink)
0

Default Interrupts: How to tell what was the cause? PIC24FJ64GA702

Morning,
 
When an interrupt occurs, (unhandled / default)  how does one find out what the cause was?
I mean which register tells me what is currently happening?
 
There is the SR register and it shows the IPL (priority level) but I can't correlate the level to a vector.
There is the INTTREG with VECNUM bits but that always seems to show 0x0427, indicating a reserved vector 0x27, even for valid interrupts.
 
How does one check this?
 
#1

7 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 18060
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Default Interrupts: How to tell what was the cause? PIC24FJ64GA702 2019/11/13 17:23:12 (permalink)
    0
    Check which interrupts are enabled and have their flags set.
    But you can verify the enables interrupts all have handlers.
    Make sure you have the trap registers handled.
    #2
    user2x
    Super Member
    • Total Posts : 352
    • Reward points : 0
    • Joined: 2011/02/10 20:43:36
    • Location: 0
    • Status: offline
    Re: Default Interrupts: How to tell what was the cause? PIC24FJ64GA702 2019/11/13 19:41:37 (permalink)
    0
     
    That is not helping me.  the interrupts shown as enabled have correct handlers.
     
    It has something to do with MPLAB X misbehaving with software breakpoints (see my other post) but I am not able to convince the support that there is a problem (yet) since they they do not see it on their end.
     
    I want to see what the unhandled interrupt cause / vector actually is.
     
     
    #3
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11432
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: Default Interrupts: How to tell what was the cause? PIC24FJ64GA702 2019/11/13 20:31:40 (permalink)
    0
    Traps set flags in INTCON1.


    #4
    user2x
    Super Member
    • Total Posts : 352
    • Reward points : 0
    • Joined: 2011/02/10 20:43:36
    • Location: 0
    • Status: offline
    Re: Default Interrupts: How to tell what was the cause? PIC24FJ64GA702 2019/11/13 20:40:21 (permalink)
    0
    All my traps are handled.
     
     
    #5
    Antipodean
    Super Member
    • Total Posts : 1778
    • Reward points : 0
    • Joined: 2008/12/09 10:19:08
    • Location: Didcot, United Kingdom
    • Status: online
    Re: Default Interrupts: How to tell what was the cause? PIC24FJ64GA702 2019/11/14 03:28:13 (permalink)
    0
    user2x
     
    That is not helping me.  the interrupts shown as enabled have correct handlers.
     
    It has something to do with MPLAB X misbehaving with software breakpoints (see my other post) but I am not able to convince the support that there is a problem (yet) since they they do not see it on their end.
     
    I want to see what the unhandled interrupt cause / vector actually is.
     

     
    MPLAB-X misbehaving causing interrupts? ReallY/
     
    What other post? You haven't provided a link to it.
     
    What interrupt handler have you installed to deal with what would otherwise be unhandled interrupts? XC16 has a default handler that resets the chip, but what have you installed to override that?
     
    Have you installed handlers for the Math Error, Address Error and whatever other CPU error interrupts that exist? Microchip does have replacement handlers for these, have you installed them? My bet is that it is one of these, most likely the address error trap that is getting you.
     
     

    Do not use my alias in your message body when replying, your message will disappear ...

    Alan
    #6
    user2x
    Super Member
    • Total Posts : 352
    • Reward points : 0
    • Joined: 2011/02/10 20:43:36
    • Location: 0
    • Status: offline
    Re: Default Interrupts: How to tell what was the cause? PIC24FJ64GA702 2019/11/14 03:52:46 (permalink)
    0
    Here:
    https://www.microchip.com/forums/m1117910.aspx
     
    I have traps for all possible errors. All tested except osc fail.
    I have handlers for all my enabled interrupts.
    I have a default handler as per xc16 manual. Mine does not reset the cpu.
     
    I would still like to get an answer as to how to determine the interrupt cause from inside the default handler. Surely this is possible?
    #7
    NKurzman
    A Guy on the Net
    • Total Posts : 18060
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Default Interrupts: How to tell what was the cause? PIC24FJ64GA702 2019/11/14 09:05:04 (permalink)
    0
    In the default interrupt check the IE flag and the IF flags. That should tell you how you got there. If you find IE flags you did not set, there is your problem.
    The CPU does not need to know. So the answer maybe , it does not.
    Another way should be to put a handler in for every interrupt. At least until you find the issue.
    #8
    Jump to:
    © 2019 APG vNext Commercial Version 4.5