Can't start Micro without CW Real Time Debugger connected

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Can't start Micro without CW Real Time Debugger connected

5,215 次查看
sauliuz
Contributor I
Hi,

I am writing program with C for MC9S12C32. I am using Turbo BDM Light interface (by Daniel Malik). I download code to the device with Code Warrior Real Time debugger (RTD). The problem is that I can not start the device when disconnected from RTD. When it is connected the code works (SCI, timers...). When I disconnect RTD (I mean the programming wires to RESET and BKGD pins) and reset the power - it hangs. I checked:
1. I get low pulse of ~8.4us on the reset pin after reset.
2. When device starts it should turn on the LED on a pin. And keep it on. After reset the LED blinks once. I get a pulse for about 16,4ms. (I use 15 MHz quartz). - It seem that it start and then goes down.
3. I tried to start a new project in Code Warrior with pure assembler, and wrote couple of lines to toggle the pins. After downloading the code to device and disconnecting the RTD it worked!!! I make a conclusion that when compiling C, CW also adds extra code for real time device debugging, which then halts the device when RTD not connected.

Does anybody know were is the problem?
Any help will be very valuable - confused....
0 项奖励
回复
3 回复数

948 次查看
CompilerGuru
NXP Employee
NXP Employee
the "usual" things for this type of failures:
- COP
- special modes (and different rules for write once registers)
- (reset) vector

Daniel
0 项奖励
回复

948 次查看
sauliuz
Contributor I
Yes that was COP problem. Thanks.
The C code for __RESET_WATCHDOG(); is define in mc9s12c32.h as:
#define __RESET_WATCHDOG() {asm staa COPCTL;} /* Just write a byte to feed the dog */
which is not right as I see from data sheet.
So I changed it to my code (instead of __RESET_WATCHDOG()):
initialize watchdog in the main (the longest period, normal mode):
COPCTL = 0x07;
and restart watchdog code in the main forever loop:
ARMCOP = 0x0055;
ARMCOP = 0x00AA;

But now I face another problem. I made a changeable delay to test the watchdog. It seems that it works at the right time. But after reset happens the device hangs - it looks like it does not start as it does after power off reset. ??? Does anybody knows why?
0 项奖励
回复

948 次查看
Lundin
Senior Contributor IV
If you have the debugger up and running it may place the CPU in stop mode and then the watchdog will freeze as well.
Do you get the same behaviour without any BDM connected to the device?

Also check that the COP reset vector (FFFA-FFFB) is pointing at the default reset vector (FFFE-FFFF).
0 项奖励
回复