I am a software engineer but my background is in windows application development. My first exposure to the AVR has turned into a trial by fire scenario. I have taken over development of a system with an ATMega32 that provides a serial user interface to a PC, does some basic control and monitoring functions, and translates I/O from two legacy HC11 controllers through a pair of external UARTs. This equates to about 2500 lines of C code. A contractor wrote the ATMega32 code so I am not completely familiar with it.
The system is functional but has a few small bugs (and one BIG one). After running for several days the AVR will simply stop responding to the internal serial port. I have only seen this happen if the AVR is in a mode where the it is continually polling both HC11’s through the external UARTs. It also stops sending status requests to the HC11’s. I’m guessing it’s stuck in a loop somewhere. Without some type of trace functionality I’m having a hard time locating it. I’m also wondering if a stack overrun, or memory leak might cause this type of behavior.
Can someone suggest a good primer or reference for debugging? I need to know how to introduce serial data, generate timer interrupts, and step through interrupt routines. The only tools I have so far are CodevisionAVR, AVRStudio 4 and an STK500. There appear to be a lot of ICE options. Any suggestion on what is the best bang-for-the-buck?