Page 1 of 1

Timer0 Match Interrupt

Posted: Wed Jul 09, 2014 9:13 pm
by danlee58
I have a SuperPro. I have set up Timer0 to Interrupt on Match 0xFFFFFF. This takes a few seconds after a reset for the Interrupt procedure to run and print some text to the terminal. Once the procedure begins to run, it will run continuously. I expect it to take a few more seconds to Match 0xFFFFFF again.

This is the code to reset Timer0.

T0_TCR = 2; //Reset Timer 0
T0_TCR = 1; //Enable Timer 0

Re: Timer0 Match Interrupt

Posted: Wed Jul 09, 2014 10:05 pm
by olzeke51
there was some timer changes recently - Apr???
http://www.coridiumcorp.com/forum/viewt ... tick#p2471
is my search -- check your kernel versions/dates
'
what is your clock source/freq for the Timer0??
'
are you getting the first INT message but not the 2nd??

Re: Timer0 Match Interrupt

Posted: Wed Jul 09, 2014 11:57 pm
by danlee58
The clock source is PCLK. I have Timer0 clocking at full rate (Prescale = 0). I get the first interrupt message, but then it seems to repeat, as if Timer0 interrupt was not cleared or the timer was not reset.

There should be dead time between messages. It's to be used as a watchdog timer to keep another operation from rollover.

Re: Timer0 Match Interrupt

Posted: Thu Jul 10, 2014 12:17 am
by danlee58
I think that it's working now. I used this code:

T0_IR = 0x1; //Reset Channel 0 Interrupt.
T0_TCR = 2; //Reset Timer 0
T0_TCR = 1; //Enable Timer 0

However, I don't get a message from the Main Program in between the Timer0 Interrupt messages.

Re: Timer0 Match Interrupt

Posted: Thu Jul 10, 2014 2:00 am
by basicchip
Take a look at the TIMER1 interrupt example in BASIC, same general operations have to be done

Code: Select all


INTERRUPT SUB TIMER1IRQ
  T1_IR = 1	      ' Clear interrupt
ENDSUB

SUB ON_TIMER ( msec, dothis )
   TIMER1_ISR   = dothis + 1              'in C you don't need to do this if the vector already points to dothis
   VICIntEnable or= (1<<2)  'Enable interrupt
  T1_MR0 = msec-1 ' set up match number of ms
  T1_MCR = 3      ' Interrupt and Reset on MR0
  T1_IR  = 1      ' clear interrupt
  T1_TC  = 0      ' clear timer counter
  T1_TCR = 1      ' TIMER1 Enable
ENDSUB

main:
  ON_TIMER(2000, ADDRESSOF TIMER1IRQ)

Re: Timer0 Match Interrupt

Posted: Thu Jul 10, 2014 10:52 am
by danlee58
It appears that the Main loop stops executing, once the Timer0 Interrupt runs. Timer0 continues to run, however.

Re: Timer0 Match Interrupt

Posted: Fri Jul 11, 2014 1:49 pm
by danlee58
I caught this message on y Terminal Program;

FaultISR 0xFFFFFFF1 SCB->CFSR=0x00020000

Any idea what this means?

Re: Timer0 Match Interrupt

Posted: Fri Jul 11, 2014 2:43 pm
by olzeke51
this thread might shed some light on it..
http://www.coridiumcorp.com/forum/viewt ... t=244#p628