Interrupt handler macro bug

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using interrupt handler functions for the USART. The ISR macro doesn't work for this so I am forced to use the SIGNAL macro. The interrupt.h header file says the SIGNAL macro shouldn't be used in new code as it will be deprecated, but that's all I have available.

If I use:
SIGNAL(SIG_USART_RECV)
It works okay.

But if I use:
ISR(USART0_RX_vect)
I get a compiler warning and my interrupt handler is never called. This is the warning message I get:
usart_driver.cpp:11: warning: `USART0_RX_vect' appears to be a misspelled signal handler

Should this be submitted as a bug? Where do I do that?

If I try to go here:
https://savannah.nongnu.org/bugs...
my browser gives me a website security certificate warning. Should I ignore the warning?

I've looked at sample code to see how others have done it but it seems nobody but me uses interrupts for the USART.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> But if I use:
> ISR(USART0_RX_vect)

> I get a compiler warning and my interrupt handler is never
> called. This is the warning message I get:

> usart_driver.cpp:11: warning: `USART0_RX_vect' appears to be a misspelled signal handler

Then this vector does not exist for your MCU type. You didn't tell us
which MCU type you are using, and apparently, you didn't check the
documentation.

Hint: the name is as exact as possible the name as written in the
datasheet, with the "_vect" added.

> Should this be submitted as a bug?

Probably not. We cannot fix your usage bugs. ;-)

> https://savannah.nongnu.org/bugs...

> my browser gives me a website security certificate warning. Should I
> ignore the warning?

Yes, they use a self-signed certificate only. You can replace the
"https" by "http" if you want.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm using the atmega169, on the Atmel Butterfly.

I used what I could find in the iom169.h header file. Here's an excerpt:

/* USART0, Rx Complete */
#define USART0_RX_vect			_VECTOR(13)
#define SIG_USART_RECV			_VECTOR(13)

Where should I be looking?

The SIG_USART_RECV works but the USART0_RX_vect doesn't work. I'm spelling it right too. I copied and pasted. I also tried some variations of the spelling, to no avail.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I should add that its only the USART that has this problem. For instance the LCD interrupt handler works when I use the info in iom169.h

ISR(LCD_vect)
works, but
ISR(USART0_RX_vect)
doesn't work.

The zero on the end of USART0 is suspicious. I believe the documentation always calls it USART, not USART0. I tried removing the zero but that doesn't work either.

I never get a compiler error no matter what string of text I put there. But I always get the above mentioned warning about misspelling no matter what I put there, and the interrupt handler function never gets called.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> Where should I be looking?

The respective avr/ioXXX.h file is OK. Another option is to use
the official documentation:

http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html

There's a table that lists every possible vector name.

So yes, for an ATmega169, USART0_RX_vect is OK.

> The zero on the end of USART0 is suspicious. I believe the
> documentation always calls it USART, not USART0.

At least the XML file uses USART0, but maintains an alias to USART:

 
         $01A
         USART0, RX
         USART, RX
         USART0, Rx Complete
 

I think our XML parser is currently not prepared to also parse the
aliases listed there.

You don't write which avr-libc version you are using. I'm guessing
this is a C++ issue. I can't see it anymore here, both versions work
identical, both in C and C++. Just browsing the CVS log make me think
this is savannah bug #15732 which has been fixed in avr-libc 1.4.4.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your help. I am using avr-libc 1.4.4.
This lib includes the fix for savannah bug #15732

I found a solution, but I don't understand it.

If I include before I include then everything works. I can use the vector names that end with _vect.

If I don't include or if I include it after then the vector names ending with _vect don't work, but the old names still work.

It's not surprising that including io.h after interrupt.h has no effect because interrupt.h includes io.h.

The problem has nothing to do with USART, it happens with all vectors. I was confused because the source file that used the LCD_vect worked okay, but that was because it included pgmspace.h which included io.h.

So that's the story. Seems bizarre to me. :?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Still strange, I cannot see it here. When I change the name to a
really unknown vector name, I get the warning though (as intented).

Please submit a bug report, and attach the preprocessed source code
to the report.

What version of the compiler are you using?

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It was my problem. I am using a header file I made a couple of years ago and it was stupidly including an old copy of io.h.

This is embarrasing. I apologize.