Is there a simple way of determining which module causes an interrupt on an ATmega169PA? I have 3,000 units executing the same code and there were 10 units that executed my ISR(BADISR_vect) handler causing these units to stop and display a bad interrupt error code. I'm trying to figure out which interrupt vector is being used or which module is generating the bad interrupt. I disabled the modules by writing a "1" in it's corresponding bit in the PRR except for the LCD, UART and Timer2. Both UART and Timer 2 have their own interrupt handlers and the LCD's interrupt enable bit is "0". The other module's interrupt enable bit is "0" by default. Is it possible that a disabled module can generate an interrupt?
I think I have seen this issue before. Since the Interrupt Vectors are at the beginning of the chip's code section, there is a chance that you will accidentally jump somewhere to this region. Since all the vectors are implicitly set to jump to BADISR, pretty much everytime you jump there, BADISR will be executed.
Are you working with function pointers? Perhaps an array of function pointers? Make sure you are not using uninitialized fields, and not exceeding boundaries.