I just got done wasting 10 very frustrating hours on a Interrupt Service Routine problem. In this case it was a pin change interrupt that causes the chip/board to reset. It turned out to be a simple capitalization error but luckily I also discovered some info about the AVR default ISR. I wanted to post it here in case somebody accidentally found it useful.
I was using a pin change interrupt on a custom board I’d made (ATMEGA328P acting as an Arduino Uno). I read everything I could find and thought I had everything set up but noticed that every time my ISR should have triggered, the board reset instead.
I checked everything until I was re-reading an ATMEL support document and realized that if you have enabled interrupts on a specific pin and an interrupt occurs and you do not have an ISR defined for that interrupt, the chip will execute the default ISR which in most cases activates the reset ISR and the board resets.
The first thing to note is that you can write your own default ISR if you don’t want this to happen. Just make sure you #include <avr/interrupt.h> and then create a function:
// code to execute here
This allowed me to realize that I had mis-capitalized the pin change ISR I wrote, which is why I thought it existed but the chip didn’t. Below are the correct and incorrect versions. See if you can find the difference.
// Incorrect Version
// Correct Version