INT3 Broken

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

Using latest AVR32 Studio, GNU, UC3B framework.

I've got different devices on different interrupt levels. The devices on levels 0-2 all get executed at the correct level but the one registered to level 3 is executed at level 2 instead.

I'm using the Newlib addons to get the register_interrupt function. I've verified that it indeed is running at level 2 by looking at the SR register as well as the Interrupt Cause registers.

I've traced the register_interrupt execution into interrupts.c and it is indeed executing the "case 3" code.

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

What is the content of R12 register when get_interrupt_handler is called? R12 is used as the argument register from the exceptions.s (evba) part, containing a number between 0 and 3. The value is passed to the get_interrupt_handler function (int_lev) which calculates the address to your handler from the level and cause registers.

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

I see the problem. The interrupt controller only allows setting priority/handler for an entire group, not per interrupt.

The 3 timer interrupts are all group 14. The timer 0 setup registers as interrupt level 3 but when the timer 2 setup registers as interrupt level 2 it is simply overwriting the table entry since it's the same group.

Bummer. Need to come up with some clever software to get around the hardware deficiency, but that seems to be what embedded programming is all about :(