3
votes

Using Atmel Studio 6.2.1563, created an GCC C++ Executable build for ATXMEGA64A3U. Setup timer TCC1 to generate overflow interrupts every 1 millisecond. But compiler seems to ignore the ISR definition.

ISR(TCC1_OVF_vect)
{
      Cyclic_Do();
}

In debug mode I see that timer is functioning correctly and OVF interrupt flag is set but I cannot get the control to pass on to my service routine.

IDE message: The breakpoint (the one I set inside ISR function) will not currently be hit. Unable to set requested breakpoint on Target.

Also tried using extern "C" { } for relevant c files inclusions. Same issue if I try to use any other timers.

Open for suggestions.

2
I've always had to set either a vector to the address of the function or put the address of the function into a hardware register (such as the Vector Interrupt Controller). The compiler never knows how to do this automatically. Maybe your compiler has a #pragma to indicate that the function is an ISR and which vector it belongs to.Thomas Matthews

2 Answers

0
votes

What seems to make it work in the end is moving ISR to different file. But curiously i did not have to use the declaration: using extern "C" to make it work even through the source file was .cpp.

Hope this helps someone else trying to setup C++ build on atmel AT/Xmega controllers.

Please note that atmel support works too, i did get a response from atmel for my atmel studio related question.

0
votes

I ran into the same problem, but I came across a slightly more satisfying fix than moving ISR to a different file.

In my case the flag bit was set, but my ISR was also not being called. Interrupts were enabled globally and at each priority level and at the UART peripheral. I'm using the Atmel Studio 7 SMART code generation tool.

I was able to hit breakpoints in my ISR after I unchecked "IVSEL: Interrupt Vector Select" in the PMIC tab of the START tool. Seems like there could be many possible causes for this type of problem, but I did not find anyone else writing to check the IVSEL bit.

I imagine the SMART tool could have (ideally should have) still generated code that would work with this bit set, but I don't need the function so I'm happy to let that mystery go.