I have been having very strange problems with programming my controller.
I am currently using a S12X (MC9S12XS256) controller with CodeWarrior v5.9.0 and winIDEA with the iC300HS bluebox for debugging.
The aim here is to port a HCS12 project into the current controller.
To start with I have written a simple program which handles an external watchdog timer and reads values from 3 ADC channels.
The code is fine and so is the expected result from the program.
The 'very strange problems' are as follows...
Problem-1: When I download the output files to the target for debugging, the control doesnt stop at the program entry point (neither at Startup() nor at main()) even though the option has been enabled in the debugging tool). After the download is complete I get a warning message saying 'After download action cannot be performed if CPU is not stopped'.
(After I click OK, the controller looks like its running. I have measured the time interval of the watchdog retrigger, the ADC values etc and they are all as expected and that's how i know that the code is working fine. )
Problem-2: Everytime I have to debug after a change to the program, I have to explicitly Unsecure the flash and only then download the new files to the target. If i do not do this, the CPU seems to run in a random manner. If I stop execution at any moment, the control points to only one location (this is not the same every time) and doesnt seem to go anywhere else. There is no message which says 'Download failed' or anything related either!!
Problem-3: After I unsecure the flash and then download to the target and hit F5, if I create a breakpoint or stop execution, till that point I notice tat the ADC was working properly. But, after execution is resumed, the ADC doesnt convert its channel inputs at all. I have to reset the CPU for it to start working again!
I hope someone can help me on this. I have been struggling to get this working for a long time now.
The HCS12 controller also has a similar code, but that seems to work without any such problems.
Thanks in advance.