HCS08 -> No MTIM Interrupt after COP Reset...

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

HCS08 -> No MTIM Interrupt after COP Reset...

1,624 Views
adac0815
Contributor I
Hey everybody, I have a problem...
After POR Reset the Timer Interrupt fires.
After a COP Reset at least the Timer Interrupt (12) does not fire anymore.
What is going wrong, any help ??

this ist the init routine i use.
thx

/* --- CLOCK Module --- */
  //ICSC2 - ICS Control Register 2
  ICSC2_BDIV = 0;

  /* --- COP Module --- */
  SOPT1_COPE    = 1;  /*COP enable*/
  SOPT1_COPT    = 1;  /*COP enable*/
  SOPT2_COPCLKS = 0; /*internal 1kHZ for COP Timeout*/
 
  __RESET_WATCHDOG(); /* feeds the dog */
 
  /* --- Low voltage int --- */  
  SPMSC3_LVWV   =1;
  SPMSC3_LVWACK =1;
 
  /* --- MTIM Module --- */  
  MTIMCLK_PS   = 5;   // MTIM clock source ÷ 32 (1ms)
  MTIMMOD      = (0xFF-6); // Modulo-Register, siehe xls-Tabelle!
  MTIMCLK_CLKS = 0;   // CLK-Src -> BUSCLK

  /* reset and start MTIM, enable ints */  
  MTIMSC_TSTP  = 0;
  MTIMSC_TRST  = 1;
  MTIMSC_TOIE  = 1;


  EnableInterrupts; /* enable Interrupts */

Labels (1)
0 Kudos
4 Replies

364 Views
alexkerr
Contributor I
This is strange....
the busclock is running @ 8MHz 
- MTIM enabled 1ms Period
- Serial RX and TX (RIE=1 TIE=1) enabled 9600BD
everything running fine.

When I force a Watchdog-Reset, the System resets but the MTIM is not running anymore!

I had no idea what to do so i tried the CW-Plugin Device initialization.
Same settings as above, Busclock @8MHz but accidentally I forgot to enable the serial RX/TX.
Watchdog reset and the system is running fine.
Then I enabled the serial RX/TX lines and there it is again, the same problem as described above.

Then I reconfigured the CPU to a Busclock @4MHz and reconfigured the peripherials
(MTIM 1ms, Serial 9600BD ...) everything running fine again.

When I force a Watchdog-Reset, the System resets and the MTIM running!!!
System is O.k. Im fine for now, but what the hell is this?!?!


0 Kudos

364 Views
Ake
Contributor II
Hi,
I tried your code but found nothing unusual.
The MTIM interrupt was running every 1 ms , the output period is 2 ms, and got stopped and restarted every 253 ms. That means that the COP interrupts the MCU every 4 Hz.
The MTIM did not stop to run at all by the COP. See the oscilloscope picture where the the top trace is the MTIM interrupt and the lower trace is the reset signal.
Sorry, but I must have missed something.
 
Regards,
Ake
0 Kudos

364 Views
alexkerr
Contributor I
Hi there,

You have to enable the serial RX/TX to get the problem, this is not done in the init-code from above.
So set TE and RE and RIE bits in the SCIC2 Register. I you have not set the serial to run there will be no problem at all!

thx and greetings

0 Kudos

364 Views
Ake
Contributor II
Hello,
I added
        SCIC2 = SCIC2_RE_MASK
                |SCIC2_TE_MASK
                |SCIC2_RIE_MASK;
                 
 EnableInterrupts; // enable Interrupts
and wrote
void interrupt VectorNumber_Vscirx vscirx_isr(void)
{
unsigned char dummy;
        dummy = SCIS1;
        x = SCID;
}
;
But it did not change anything.
The reset interrupts appeared every 256 ms  and the MTIM every 1 ms.
 
It seems there is something that I have missed.
 
Regards,
Ake
0 Kudos