Hi everybody,
So, I have decided to make a new project using the MC9S08PA4 to replace a MC9S08SH8 in a project that a I have done some time ago, until then everything was ok. The problem begins when I have started to test the new PA4 that I have ordered (samples). With this sample parts, I simply can't debug or run the code that I have made, even a simple led blink code (as below) does not work as it should...
#include <hidef.h> /* for EnableInterrupts macro */ #include "derivative.h" /* include peripheral declarations */ void main(void) { unsigned int Loop = 0; volatile unsigned char ST = 0; ST = SYS_SRS; SYS_SOPT1 = 0b00001100; // RESET and BKGD active WDOG_CS1 = 0; // disable WDT PORT_PTAOE = 0b00000001; PORT_PTAIE = 0b11111110; PORT_PTAPE = 0b11001110; PORT_PTAD_PTAD0 = 0; for(;;) { PORT_PTAD_PTAD0 = 1; for(Loop=0;Loop<50000;Loop++); PORT_PTAD_PTAD0 = 0; for(Loop=0;Loop<50000;Loop++); } }
The LED is connected on PTA0 (pin 20) with a 1K resistor to GND.
Everytime that I need to program the microcontroller (on run or debug) I must power off and power on the power supply.
When I try to debug, I can run the program step by step until line 23, after this point the program lost itself and I get the message "Target request failed: HC/RS/S12Z GDI Protocol Adapter : Stop failed. Non Fatal Error.".
When I try to run the code the LED stays lit forever.
I'm have tested this code with the CW 10.4 and CW 10.5 using the CYCLONE PRO via USB to program the microcontroller and the results are the same.
Any help is welcome!
Thanks!