Resetting HCS12 using software

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

Resetting HCS12 using software

5,217 次查看
RChapman
Contributor I
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
 
Posted: Tue Sep 20, 2005 5:40 pm    
 
Is it possible, to cause the HCS122 to reset itself using softare.
 
Posted: Wed Sep 21, 2005 8:09 pm    
 
yes surely

just activate the cop, register COPCTL
and trigger directly with a false value written to the ARMCOP register.

Normally you would write 0x55 and then 0xAA; try some other value and you will get a reset at once

e.g.
COPCTL = 0x01; // cop activated with shortest timeout
ARMCOP = 0x47; // her we will get kicked by the dog
 
Posted: Thu Sep 22, 2005 4:55 pm    
 
 am assuming that Quantum needs to "simulate" a Power-On reset.
If you make sure that the COP reset vector is the same as the Power-On reset vector, Cristian's method should work perfectly.

I tried the suggested approach, it didn't work with me. I read a little in the "CPU12 Reference Manual" and figured the reason is probably that the HC12 differentiates between 4 types of Reset (Power-On, External Reset, COP/Watchdog and Clock Monitor Reset). The first two types use the same Reset vector, the other two have their own vectors.

Another possibility which I have used is to wire the (open drain) /RESET pin to an I/O pin (possibly with a diode in between?). Now if you make the I/O pin be a LOW output, it resets the controller (making the I/O pin an input).

Notice:
a) without the diode the I/O pin should not be set to be a HIGH output (potential short-circuit)
b) this is not a pure SW method
标签 (1)
0 项奖励
回复
2 回复数

2,352 次查看
javadshabani
Contributor I
thank you It worked well
0 项奖励
回复

2,601 次查看
wilero17
Contributor I

I was sawing some tips in the forum about the watchdog timer and I have some questions.

 

actually
I'm working with the HCS12 microcontroller and I need to use the
watchdog timer in order to do  reset. I've configurated the COPCTL
register with 71 (COPCTL=71) the program
stay in a infinite for loop showing a caracter ascii in the
hyperterminal until the watchdog finish. The problem is:  after the
watchdog timer has finished the program doesn't reset o may be yes, but
I can't see more caracters in the hyperterminal until I do a manual
reset.  I've attached the program. I hope that you can help me. many
thanks.


 

 

This is the main function:



 void main(void) {
  /* put your own code here */

  char msn[20]={"Hola"};
  char msn1[5]={"."}; 
  word cont1X;
  word cont2X;

  cont2X=0;
  while(cont2X<=5000)
  {
    cont2X++;
    cont1X=0;
    while(cont1X<=100)
    {
      asm BRN *;
      cont1X++;    
    }    
  }

  SCI0BD = 12;

  SCI0CR1 = 0x00;

  SCI0CR2 = 0x04;

  vfnSCITxMsg(msn);
  COPCTL=71;
  
  for(;;) {
  cont2X=0;
  while(cont2X<=5000)
  {
    cont2X++;
    cont1X=0;
    while(cont1X<=100)
    {
      asm BRN *;
      cont1X++;    
    }    
  }
  vfnSCITxMsg(msn1);
  } /* loop forever */
  /* please make sure that you never leave main */
}
0 项奖励
回复