99% of my flash issues are resolved.
However, I STILL see the error with the USB-BDM, and if I get that then I'm 99% certain a failure trying to write to the flash will occur. If I just exit the debugger, and power cycle the target platform, it will run just fine, updating the flash as it should. That right there shows me the problem does not appear to be in my routines.
If I am programming the code space with the BDM by hitting F5 from CW, the error seems to be the USB-BDM chokes AFTER it thinks it programs the part and I then hit F5 from the debug screen to start execution. It will not 'start' the CPU correctly. Once that happens, if I use the reset from the debug screen to the BDM and restart, the code will start and run, UP TO the point where it tries to write to flash, and then it hangs.
If hitting F5 from the debug screen starts the CPU correctly, then the CPU will continue to run and the flash can be programmed correctly.
The 'break point' is what happens AFTER the CPU is programmed and BEFORE
the F5 key is hit to 'run'. If it gets by that then it runs fine. If I have to 'kludge' past that with manual intervention, then it will fail later. If I have to kludge past that and I do it by a power-cycle of the target (and blow off the BDM and debug capability) then it will run fine.
Mike