MC9S08GB60A - Device initialization following reset with and without BDM

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

MC9S08GB60A - Device initialization following reset with and without BDM

2,209 次查看
agreer
Contributor I
When I program the device flash and keep a debug session open with the BDM, everything works fine.  When I reset the device through the debug interface, that works fine too.  If I end the debug session and then power cycle the device to reset it, things stop working.  I think it might be some strange variable initialization issue, but I haven't been able to track it down.
Is this a known issue and if so, what is the workaround?
If this is not a know issue, what would you suggest I try doing to correct or at least identify the source of the problem?

Thanks!
标签 (1)
0 项奖励
回复
7 回复数

936 次查看
CompilerGuru
NXP Employee
NXP Employee
The usual suspects with the description "it only works with a BDM attached" are the watchdog and write once registers. Search in this forum too, the description sounds familiar  :smileyhappy:.

Daniel
0 项奖励
回复

936 次查看
agreer
Contributor I
I thought that it might be the watchdog, as you say, but when I tried defining _DO_FEED_COP_ in start08.c, everything died.  Nothing would run, not even with the BDM connected.  I do have a large number of global variables to be initialized, so I imagine the copy-down routines are running for quite a long time.  Maybe I'll just try adding some code to disable the watchdog from start08.c instead of messing around with the built in #defines.  Does the BDM keep the watchdog disabled or something?  I just can't figure out why it works with BDM, but not without...
Let me know if you have any other ideas.
Thanks!
0 项奖励
回复

936 次查看
agreer
Contributor I
I should mention too that when I power cycle the device without the BDM connected, my interrupt routines seem to run as expected, it's just part of my main loop which depends upon a global flag to run that doesn't work right.  That's what makes me think it's an initialization problem.  It doesn't seem to be resetting like it would from a watchdog problem, so maybe that's the wrong direction to be taking.
0 项奖励
回复

936 次查看
agreer
Contributor I
OK, I added code to disable the watchdog in the init function but it didn't seem to make a difference.  Maybe what I should try is disabling/removing all the initialization code (ALL of it) and just initializing the stack pointer and then jumping to main.  Is that a good idea, and how hard is it to do that with Codewarrior?  I tried searching the forums like you said and I couldn't find many thread with problems like mine.  The other potential cause you mentioned were write once registers.  I couldn't find anything in my code that accesses any of them; can you expand on what you said?
Thanks again!
0 项奖励
回复

936 次查看
JimDon
Senior Contributor III
It might help if you further clarified what you are seeing.

When you say not working, how is it that you know that?
LEDS don't flash etc. Tell more specifically what is not working.
Also, you could attach the BDM after it fails to start and perhaps gather more information.

I would not change the start up code. Normally this is not a problem, and the fact that you have many variables should not be a problem either.

 
0 项奖励
回复

936 次查看
agreer
Contributor I
Jim, I just saw your post.

How I know it's not working quite right is because from my main loop, I check if there is data in a FIFO buffer, if so, I format it and send it out the serial port, I also hold an LED on while I'm doing that.  Neither the LED nor the serial port data appears when it's not working.  I have an interrupt service routine (ISR) which runs every second and toggles an LED.  It also stores some data into the FIFO, which should then be read by the main loop (but doesn't).  I'd love to connect the BDM when the device is in it's funny state, but I'm not aware of how to do that without reprogramming the device and losing the state.  Can you please explain how to do it?
I'm thinking there may be something strange happening in the FIFO data initialization, or maybe in the way the ISR is setup.  I just can't understand why it would work with the BDM though.  What is different in the way the device is brought up with the BDM connected, compared to without it?


Message Edited by agreer on 2008-03-13 04:27 PM

Message Edited by agreer on 2008-03-13 04:28 PM

Message Edited by agreer on 2008-03-13 04:51 PM
0 项奖励
回复

936 次查看
JimDon
Senior Contributor III
If you are using a P&E BDM, the connection dialog has a button called Hotsync.
This enters Debug mode without doing a reset.

Try that and look around.

Don't feel bad - you never understand how it could be until you figure it out, then it is totally obvious.
The times I had this type of problem it was a timing issue that I had over looked.




Message Edited by JimDon on 2008-03-13 12:47 PM
0 项奖励
回复