avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] help debugging resets


From: Erik Christiansen
Subject: Re: [avr-gcc-list] help debugging resets
Date: Wed, 27 Oct 2004 10:56:59 +1000
User-agent: Mutt/1.5.6+20040722i

On Tue, Oct 26, 2004 at 01:21:10PM -0700, David Morrison wrote:
> Is there a way that I can have the reset handler print out the
> module/line number that the MCU was on when it resets?  I am having an
> issue where my board with a ATmega162 is resetting and I can not
> narrow down where it is due to the fact that print statements change
> the behavior.

   Is it perhaps more a question of "why", rather than "where"? In this
situation, I've found that printing the reset cause information
available in MCUCSR to be most important in debugging resets.

   Even if MCUCSR tells you that the cause is a watchdog reset, any link
with the code running at the time of reset can be somewhat indirect,
unless you have a tight endless loop. However, I like to placate the
watchdog only in the scheduler main loop. If this is done before each
task, then task control data would identify the time hogging task, if
examined at the reset vector.

   It usually hasn't been too hard to track it from there. (Unless it's
not a real reset, but rather a "ret" to location 0, due to stack
corruption. Again, MCUCSR provides vital evidence.) 

> Oh, and to make this more difficult the board I am using doesn't
> support the use of Jtag debuggers so it looks like I would have to use
> a completely software driven solution. 

   Logging via the serial port has been sufficient, in my experience.
(To the extent that proficiency with the JTAG-ICE has suffered.)

hth,
Erik


reply via email to

[Prev in Thread] Current Thread [Next in Thread]