[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Issue with interrupt handler on Atmel Mega 8
From: |
Jerome Kerdreux |
Subject: |
Re: [avr-gcc-list] Issue with interrupt handler on Atmel Mega 8 |
Date: |
Wed, 2 Nov 2005 01:06:12 +0100 |
On Wed, 02 Nov 2005 00:55:26 +0100
Vincent Trouilliez <address@hidden> wrote:
> On Wed, 2005-11-02 at 00:03 +0100, Jerome Kerdreux wrote:
>
> > > I'm trying to use the timer 0 on a mega 8. Everything works fine,
> > > (I mean, i can see the timer TCNT0 incrementing) but when I want
> > > to route the interrupt to an handler, I get a infinite reset.
>
> I think that's normal. You forgot to include <avr/signals.h>, so the
> "SIG_OVERFLOW0" name was unknown at compile time, and as stated in the
> avr-libc documentation, this does not generate a warning and simply
> defaults the ISR to the bad interrupt vector, which by default generates
> a reset. In the code of your ISR, you put a "return 0" (why?), so the
> "reti" instruction that the compiler generated, never gets executed,
> hence the interrupt flag doesn't get cleared, therefore it instantly
> executes the ISR egain, hence a reset, and so on, forever.
>
> Why did you put a "return" in your ISR ? Am I missing something very
> subtle ???
Hum, not really funny. I added a return to the ISR because the compilo
give a warning "missing return value for a function". (due to the lack
of SIGNAL macro)
I read the documentation about the missing-warning if signame is wrong,
so I double-checked the typo, but forget to check that I included signal.h
( Perhaps, somebody can add this to the doc, beside this error is really
stupid, but can happen if you are a newbie like me)
Thanks a lot for all answer I get.
(Apologize for my awfull english)
--