• AVR Freaks

Hot!Breakpoints On WDT Reset

New Member
  • Total Posts : 19
  • Reward points : 0
  • Joined: 2018/01/30 11:27:12
  • Location: 0
  • Status: offline
2019/06/26 18:07:10 (permalink)

Breakpoints On WDT Reset

Hello Everyone,
Is possible to set a breakpoint on a WDT reset and then look back at either the call stack or something that would tell me whats getting hung up? 

3 Replies Related Threads

    Super Member
    • Total Posts : 908
    • Reward points : 0
    • Joined: 2011/12/30 09:50:47
    • Location: 0
    • Status: offline
    Re: Breakpoints On WDT Reset 2019/06/26 22:20:26 (permalink)
    Yes. You'll want to override the _on_reset function, which is called when the processor resets. Have the routine check the flags to determine if the WDT triggered it, and set your breakpoint there.
    A Guy on the Net
    • Total Posts : 17713
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: online
    Re: Breakpoints On WDT Reset 2019/06/27 03:46:48 (permalink)
    It is not nessasary to do the override.
    The flags can be checked in the users startup code.
    Super Member
    • Total Posts : 504
    • Reward points : 0
    • Joined: 2015/06/16 02:53:47
    • Location: Germany
    • Status: offline
    Re: Breakpoints On WDT Reset 2019/06/27 04:54:43 (permalink)
    Looking at RCON at start only tells you that a WTD or DMT timeout happend, but not where and why.
    Another way to find out about the "where and why" is to set RNMICON.NMICNT to a value and implement _nmi_handler(). This handler gets called on WDT or DMT timeout. Setting NMICNT gives you some time before the reset occurs (which would otherwise occur immediately). You can even remove the respecting flag which stops the reset. And you can set a breakpoint there, or write interesting information into a memory location which is defined with __attribute__((persistent,aligned(16))), which you can still read out after the reset.
    Jump to:
    © 2019 APG vNext Commercial Version 4.5