This is a tricky problem for me. I'm looking for debug suggestions. I'm using a Cygnal F320 with the Cygnal IDE/debugger/JTAG, Keil C51 V7.07 I have a system that I've been working on for 3 months. This problem has come and gone for the last two months, now everything is done except finding this bug. My system is about 7KB of code, it has two I2C port extenders that drive LEDs & a keypad, ADC inputs, UART interface, using Timer 0 for internal timing (1khz), Timer 1 for UART (19.2K), Timer2 drives I2C clock (400khz), Timer3 is timeout device for I2C (25msec), 4 external rotary encoders generate interrupts based on pos&neg edges... Anyway my system runs fine except randomly it just hangs! I've tried taking out each peripheral from the system, but nothing makes this go away, it only changes the hang event... Adding the watchdog timer will reset, then it restarts and runs fine for some period. I've tried: - NOOVERLAY at link - monitoring the SP (no overflows) - looked at the linker map till I was blue - reviewed type matches in extern/global variables - moved variables from xdata to idata and data looking for a clue - reviewed stack operations of C interrupt drivers (in resulting assembly) - reviewed register bank selection code - placed break points in unused int vectors - The biggest problem is when it hangs (assuming I disable the WDT) the JTAG interface to the debuggger disconnects, so I can not examine the environment. I was using the TASKING compiler early in the project and was having this same issue, Then I switched to Keil V7.06, I just upgrade to V7.07... no difference I do not think it is a compiler thing. This problem will go away completly and then reappear. I definitly need to fix this, it smells like I'm stomping on the HW stack, but I don't know how to find it. I am using C51S library inside Interrupt routines, are these OK to use in a nonreentrant design, (but within interrupts). This happens using my Cygnal prototype board and now we have production boards that all behave the same way. I have some test code that flashes LEDS (on I2C) and makes ADC measurements (4/sec) it runs all weekend along. When the UART or the 4 edge triggered interrupts start the system will hang in a few minutes. Today I found that when I send data from the PC to the 51 it seems to hang quickly, but when I turn the encoders it will hang as well. So I'm at the point now of trying to focus on these routines. Can anyone suggest any methods to attack this? -Jim