9S12DJ64 timer module does not generate interrupt on stop?

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

9S12DJ64 timer module does not generate interrupt on stop?

696 Views
68HC912B32Guy
Contributor I

Hello.  I seem to be unable to get the timer module to wake up the processor after a STOP instruction.  However, after a WAI instruction, the timer will wake up the processor and service the interrupt.  Is the timer module not able to generate an interrupt in STOP mode?

The code that initializes the timer channel looks like this and allows me to capture the waveform I have on the IC0 pin just fine:
  clr          TIE                                      ;disable interrupts
  movb     #%00000101,TSCR2    ;output compare resolution is 8 us, prescaler=32, 4 MHz clock
  movb     #$02,TCTL4                    ;init IC0 for falling edge detection
  clr          TIOS                                  ;select channel 0 to act as input capture (IC)
  movb     #$80,TSCR1                   ;enable timer, runs during BDM and in wait, clears flags normally


The code that I use right before I stop the processor looks like this:
  movb     $03,TCTL4                ;init IC0 for rising and falling edges detection
  bset       TIE,#$01                     ;enable TM0 interrupt
  ldaa       TFLG1
  movb     #$FF,TFLG1              ;clear any interrupts on the timer channels
  andcc    #$7F                           ;enable CPU standby mode via STOP
  cli                                               ;enable global interrupts
  stop

Am I making a mistake leading up to the STOP instruction?  No amount of activity on timer channel 0 wakes up the processor.

Thank you!

Labels (1)
0 Kudos
Reply
1 Reply

349 Views
kef
Specialist I

Timer requires clock to run. And since STOP mode shuts off all clocks, timer can't operate.

0 Kudos
Reply