HCS08 resets

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

HCS08 resets

3,999 Views
beowulf
Contributor I
Hello,

I recently purchased an the DEMO9S08QG8 board and several of the HCS08 chips. I have it installed and working as far as I know. I have written a simple program that writes to an LCD screen. I am loading the program onto the chips, and then removing the chip and placing it into a breadboard. I then power it up using AA batteries. The problem I am having is that it seems to run my entire program and then reset itself and run it again and again. My program should write a single letter "A" and then stop. I have a BRA * at the end of my code, and when running it on the simulation it runs fine. However when I run the chip by itself it seems to be reseting. Any ideas would be helpful.

Josh
Labels (1)
0 Kudos
8 Replies

697 Views
peg
Senior Contributor IV

Hi Josh,

Are you resetting the COP? or disabled it?

You said it runs in the simulator OK, but have you just stepped it or run it. Run it, then leave it running for a few minutes and see if it indicates a COP reset.

BR Peg

 

0 Kudos

697 Views
WRosen
Contributor I

Hi All,

 

I've just started with HCS08 and have also encountered this problem when writing a long delay loop. I tried clearing the COPE bit by writing $72 to SOPT1 in the first line of my code. It appears to clear the bit in memory but I still get the reset. I also tried writing to $1800 every 10 ms to clear the COP register but that doesn't help either. Am I not clearing the bit correctly? 

 

I'm using an MC9S08QG8 and USBSpyder.  Any help would be greatly appreciated. Thanks.

 

WRosen 

0 Kudos

697 Views
peg
Senior Contributor IV

Hello and welcome to the fora WRosen.

 

The SOPT registers are write once so you need to make sure that these addresses have not been written to prior to your attempted write or it will not work. You will need to check your clock setup to determine whether 10 ms is sufficiently quick enough to prevent COP resets. Continuously executing a rogue ISR could slow this down from what you think it is.

 

Do you know that your problem is really the COP? Have you checked the value of the SRS register?

0 Kudos

697 Views
WRosen
Contributor I

Hi Peg,

 

Thanks for the welcome and the quick response.

 

It times out after 248 ms, which seemed to be consistent with the COP.  In simulation the SRS contains $80 and that doesn't seem to change when I run it in simulation. When I to run it on the chip it loses communications through the USBSpyder.

 

When I step through the program on the chip I can change COPE with a load/store to SOPT1 as my first instruction. I also tried using a directive to disable COPE using an org $1802 followed by a dc.b directive. This disables COPE in simulation but when I step through it on the chip it comes up with the old value of $D2. Is something else writing to SOPT1 before I get to it? Also, is there a way to disable COPE that I'm not trying?

 

Thanks again for your help.

 

Warren Rosen 

 

 

0 Kudos

697 Views
peg
Senior Contributor IV

Hi Warren,

 

It seems strange that you have two problems with the COP. You can't disable it and then you can't reset it. If the value written to SOPT1 is not "sticking" then SOPT1 is being written to prior to your attempt. Perhaps by automatically generated code. I don't know why you can't reset it. You just need a STA SRS as you don't care what the value written is.

 

0 Kudos

697 Views
beowulf
Contributor I
No I am not setting the COP and if I let it run in the simulator I get the message COP WatchDog caused a reset. How do I change that?

Josh
0 Kudos

697 Views
peg
Senior Contributor IV

Hi Josh,

You can either periodically write to the SRS register to keep resetting it or perhaps while you are just experimenting, disable it by clearing COPE (bit 7) of register SOPT1 right at the beginning of your code.

BR Peg

0 Kudos

697 Views
beowulf
Contributor I
Thank you very much, with your help I was able to solve my problem and will be able to finish my final project now. I was impressed with the speed at which you were able to help me. My sincere dratitude to you.

Joshua Updyke
0 Kudos