RIT TImer

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

RIT TImer

633 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nkarakotas on Tue Jun 21 08:39:59 MST 2011
Hi,

Im trying to get the RIT timer to generate a 1mS interrupt. I have used the RITtimer.c file to set it up. What value to I need to put in order to generate a 1mS interrupt on the LPC17xx?
 init_rit_timer( TIME_INTERVAL );


Reagrds,
Nick
0 Kudos
5 Replies

365 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nkarakotas on Tue Jun 21 13:37:50 MST 2011
Yes its OK now, it just seemed that it was generating an interrupt randomly due to the value of 0x0F in the RICOUNTER.
I compared the value with the SysTick and in generates the required interrupt.

Thanks a lot.
0 Kudos

365 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Jun 21 13:26:25 MST 2011

Quote:

... there is an interrupt always generated on the RIT...

Wasn't that the whole point of the exercise, to generate RIT Timer interrupt?


Quote:
...when I debug it...

Did you set a breakpoint in RIT_IRQHandler ?
0 Kudos

365 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nkarakotas on Tue Jun 21 13:22:33 MST 2011

Quote: nkarakotas
HI,

Thanks for the reply. I set the value to what you have posted but when I debug it there is an interrupt always generated on the RIT. Even if RICOMPVAL is not equal to RICOUNTER.
For example RICOUNTER is 0x0f and the RICOUNTER is 0x61a7 it will interrupt.

Nick



Unless that is the timer running but was reset to 0x00.  A few cycles until interrupt routine?
0 Kudos

365 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nkarakotas on Tue Jun 21 13:11:58 MST 2011
HI,

Thanks for the reply. I set the value to what you have posted but when I debug it there is an interrupt always generated on the RIT. Even if RICOMPVAL is not equal to RICOUNTER.
For example RICOUNTER is 0x0f and the RICOUNTER is 0x61a7 it will interrupt.

Nick
0 Kudos

365 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Jun 21 08:51:42 MST 2011
User manual:

Quote:

Following reset, the counter begins counting up from 00000000h. Whenever the counter value equals the value programmed into the RICOMPVAL register the interrupt flag will be set.

So you have to set a value like
[INDENT]  (PCLK_RIT / desired_frequency) -1
[/INDENT]Example: 1ms / 1kHz at 100Mhz clock and PCLK_RIT = 25MHz
[INDENT] (25E6 / 1E3) -1 =  24999[/INDENT]
0 Kudos