UART on DEMO51AC does not work in debug mode?

I am working with a DEMOAC board with the 51AC256 MCU. Codewarrior 6.2 with patch 6.2.2.

I've been trying all day to get some serial communication between two MCUs (both AC256) to work, until i FINALLY found, that the UARTs simply doent work correctly when the programm in the MCU is started from within the debugger.

When I simply close the debugger window and hit the reset button on the demo board (yeah, the real hardware reset button), then everything works just fine and reliably well.

Is there any reason for this (it seems the timing gets screwed up which is probably due to the BDM comms) and, more important, is there any way around this, since it makes using the debugger on UART applications pretty, uhm, pointless?

Im not familiar with that particular MCU, but my qualified guess would be that the SCI (UART) registers get destroyed by the debugger.

In ancient days Motorola made a huge design mistake and made it so that the SCI flag register is cleared by a read access followed by a read access to the data register. A debugger with watch variables, memory map etc will read these two registers and clear the flags. It might be possible to avoid the bug by not having those registers show in the memory map or any watch variables, and also avoid single-stepping through the SCI code.

SPI flag registers have the same problem.

While I understand why developers new to the Freescale world may not know of this problem, I find it mighty strange that the Freescale debugger isn't aware of how Freescale hardware works either...

Thank you very much for these insights. Well, I didnt have any watches or anything else setup, not even breakpoints (in other words, nothing on the screen got updated while the program was running), so I am not sure what the debugger would try to read from the MCU, but it's good to know where these problems may arise for future use.

Out of curiosity I just checked and tried to limit the memory area that is displayed by the debugger. I could not find any option to do that though, however I wonder if the read area aint already limited to the few bytes that are actually visible on screen?

More interesting though, I noticed that when I launch the program (hit F5 in the debugger), nothing works (as was the original problem). Then just pressing the reset button on the demo board makes the serial comms work again WITHOUT closing the debugger window first. Not sure if I tried this before. What's more, the debugger even notices that I did a reset, it does NOT lose connection and I can halt and step through the program, this time with working SCI.

I dont know if stepping through the SCI code would work as well, but since I debugged this project already (with the help of an LCD instead of the debugger ) I lack the time to investigate any further.

I'll just try to keep in mind to do the reset trick next time I encounter this problem.