Untraceable Serial Port shutdown

For some reason, the serial port on the MC9S12DJ256B 80 pin package occasionally shuts down and refuses to respond to input. I fixed the general case, but it still occurs after a power outage. The $#&!(@%& thing is supposed to reset on startup, but occasionally it hangs. I trapped the hang with the debugger, a few times. Twice, I found it pointing to RAM memory, and a third time, it was pointing to the INTERNAL REGISTERS. I set up ENABLE_COP_X at the entry point, but when I checked the associated memory location, it shows this register is disabled, as if it were never set. When it doesn't hang, but operates semi-normally, it occasionally shuts off the serial port. Trapping it with the debugger, makes the problem disappear, without giving a clue what caused the problem in the first place. This is embarassing; it makes us look really bad.

Great! I think I had RDRF and OR being set simultaneously in places where interrupts are disabled and an input comes in off the serial port. BDM seems to masquerade this somehow, but I found a workaround where I hold off on initializing the serial ports until after a particular block of initialization code has executed and the interrupts can be enabled. I had removed a Disable Interrupts block from the EEPROM write method, which resolved the issue where the serial port had shut down in the middle of operation, but it was still occurring on startup. Seems to work better now though (fingers crossed).