HCS08GT60 Startup trouble

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HCS08GT60 Startup trouble

4,295 Views
shiloh
Contributor I
I finished some code today for a hcs08gt60.  The code works great when I start it from CodeWarrior.  However, the code does not start when I simply power up the device.  I have never ran into this problem before.  Where should I look in CW to track down this problem?  Thanks.
Labels (1)
0 Kudos
10 Replies

803 Views
shiloh
Contributor I
I managed to solve this problem by updating my compiler.  I was running v3.1 and it was not fully patched.  I switched to v5.1 and fully patched it.  Then I created a new project in v5.1 and moved my code over to the new project.  Works like a champ now.
0 Kudos

803 Views
shiloh
Contributor I
On this project, I am just using the internal clock.  I don't think this is a hardware problem, because I checked previous project code on this hardware and it worked as expected.  My hunch is that I have something messed up in CodeWarrior, but I just don't know what yet.
0 Kudos

803 Views
peg
Senior Contributor IV
Hi shiloh,
 
When you say 'from CW' do you mean simulation or debugging with BDM?
 
Set some spare outputs throughout your init code and see how many come on.
 
C? ASM? PE?
 
Regards
Peg
 
0 Kudos

803 Views
shiloh
Contributor I
I wrote my app in C and am debugging with BDM using a USB P&E Multilink.
 
I have several outputs that turn LEDs on when it powers up.  That is how I know it is not starting.  I have looked through the Start08.c file and in P&E_ICD_linker.prm, but I do not see anything obviously wrong.
 
If I go into debug through CodeWarrior and then hit the start button, the code works as expected and the LEDs come on during my init code.  However, if I power the device up normally (not connected to the PC), it does not start.
0 Kudos

803 Views
CompilerGuru
NXP Employee
NXP Employee
The usual suspects when it works with a debugger attached, and not without:
- COP (really the most common thing)
- write once registers (with debugger/special mode, many can be written multiple times)
- reset vector or other vectors.

Daniel
0 Kudos

803 Views
shiloh
Contributor I
The first thing I do in my main function is configure some LEDs and then light them up.  This works when hooked to the debugger, but does not if I turn the device on without connecting it to the debugger.  Also, the lights do not even flicker for a split second.  They just stay off.  So as far as I can tell, the main function is not executing.
 
How can I debug COP, registers, and vectors when I do not have the unit connected to a debugger and the main function is not launching?
0 Kudos

803 Views
CompilerGuru
NXP Employee
NXP Employee
When the debugger is connected and you press reset, does PC change to the initial function (usually _Startup). If not, check the vectors. If it does, the first thing I would try is to disable the COP at this location (_Startup), and see if you get further.
Of course don't forget to re-enable the COP.

Can you run an wizard generated new application on your device?
(with the only addition of enabling your debug led)


Daniel
0 Kudos

803 Views
shiloh
Contributor I
I just created a simple new application using the New Project Wizard in CodeWarrior.  Then I added these lines of code to main() to turn on an LED.
 
 /* setup LEDs */
 PTCDD_PTCDD0=1; // set to output
 PTCDD_PTCDD1=1; // set to output
 PTCDD_PTCDD2=1; // set to output
 PTCDD_PTCDD3=1; // set to output
 PTCDD_PTCDD4=1; // set to output
 PTCDD_PTCDD5=1; // set to output
 PTCD_PTCD0=0; // set default value
 PTCD_PTCD1=1; // set default value
 PTCD_PTCD2=1; // set default value
 PTCD_PTCD3=1; // set default value
 PTCD_PTCD4=1; // set default value
 PTCD_PTCD5=1; // set default value
 
I flashed the code onto the MCU using the debugger.  When I turn the device on with or without the debugger, it turns on as expected and lights up an LED.  So this confirms that the hardware is working properly.  The problem has to be somewhere in the software in my other project. 
0 Kudos

803 Views
shiloh
Contributor I
I added SOPT=83; to my startup routine as the first command.  I started the device with the BDM and looked at the SOPT bits.  The COPE bit is 0.  So I assume the COP is disabled.
 
When I hit reset in the debugger, it goes to the _Startup function.  It does not immediately execute it, though.  It just shows that it is in the _Startup in the "Source" Window in the upper left corner of the debugger. 
 
When I turn the device on outside of the debugger, it still does not turn on.
 
I have flash other project of mine onto this device and it turns on without any problem.  I have not tried a ckean new project on it yet, because the other project code already confirmed that the device works.  I assume that is why you asked about trying a new application on it.
0 Kudos

803 Views
joerg
Contributor II
Hi shiloh

Do you use an external clock source? If yes is the oscillator running?

Saluti joerg
0 Kudos