[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] How to determine which interrupt fired?
From: |
Ned Konz |
Subject: |
Re: [avr-gcc-list] How to determine which interrupt fired? |
Date: |
Sun, 12 Feb 2006 09:06:45 -0800 |
On Feb 11, 2006, at 7:44 PM, Rick Mann wrote:
I have a simple app that only defines the UART0 receive interrupt
handler for an ATmega128. I can set that it's getting called in gdb
(and because its code is executing), but then something happens and
my code jumps to the top of main. I'm assuming some other interrupt/
reset is occurring, but I can't figure out what it is.
Any suggestions on how I can determine this? Thanks!
Most interrupts have associated flag bits.
As far as restart reasons, look at the section in the datasheet on
the "MCU Control and Status Register - MCUSR" (under "System Control
and Reset"). There are flags for each of the reset sources.
They note:
To make use of the reset flags to identify a reset condition, the
user should read and
then reset the MCUCSR as early as possible in the program. If the
register is cleared
before another reset occurs, the source of the reset can be found by
examining the reset
flags.
You might also want to:
* verify that the reset pin is tied directly to Vcc (at least for
testing)
* verify that you have good bypassing close to the processor
* set the startup time to maximum
* try disabling the brown-out reset (via the BODEN fuse)
* ensure that the watchdog timer is disabled (via the WDTON fuse)
* try running your JTAGICE at its slowest rate (just in case you
happen to have a slow clock)
--
Ned Konz
address@hidden