MPC563XM Reference Manual, Rev. 1
Freescale Semiconductor
1327
Preliminary—Subject to Change Without Notice
Timer interrupts can be disabled by setting the TIE bits to zero. The timer interrupt flags (TIF) are set to 1
when a timeout occurs on the associated timer, and are cleared to 0 by writing a 1 to that TIF bit.
The PIT_RTI generates a real time interrupt when the selected interrupt time period elapses. The RTI
interrupt is disabled locally by setting the TIE bit to zero. The real time interrupt flag (TIF) is set to 1 when
a timeout occurs, and is cleared by writing a 1 to the TIF bit. (The flag will be set regardless whether the
interrupt is enabled.)
The RTI can be used for periodic wakeup from a low power mode. It can also be used to generate a general
purpose interrupt.
29.7
Initialization and Application Information
29.7.1
Example Configuration
In the example configuration:
•
the PIT clock has a frequency of 50 MHz
•
the RTI clock has a frequency of 10 MHz
•
the RTI shall be set up to create a wakeup interrupt every 500 ms
•
timer 1 shall create an interrupt every 5.12 ms
•
timer 3 shall create a trigger event every 30 ms
First the PIT module needs to be activated by writing a 0 to the MDIS bit in the PITCTRL register.
The 50 MHz clock frequency equates to a clock period of 20 ns and the 10 MHz frequency equates to a
clock period of 100 ns. Therefor the RTI timer needs to trigger every 500 ms/100 ns = 5000000 cycles.
Timer 1 needs to trigger every 5.12 ms/20 ns = 256000 cycles and timer 3 every 30 ms/20 ns = 1500000
cycles. The value for the LDVAL register trigger would be calculated as (period / clock period) -1.
This means that RTI LDVAL will be written with 004C4B3F hex, LDVAL1 with 0003E7FF hex and
LDVAL3 with 0016E35F hex.
To generate the wakeup interrupt, the interrupt line must be enabled by writing a 1 to the RTI TIE bit in
the TCTRL register. To start the RTI, the TEN in the RTI TCTRL register must also be set.
The interrupt for Timer 1 is enabled by setting TIE in the TCTRL1 register. The timer is started by writing
a 1 to bit TEN in the TCTRL1 register.
Timer 3 shall be used only for triggering. Therefore Timer 3 is started by writing a 1 to bit TEN in the
TCTRL3 register, bit TIE stays at 0.
The following example code matches the described setup:
// turn on PIT
PIT_CTRL = 0x00;
// RTI
PIT_RTI_LDVAL = 0x004C4B3F; // setup RTI for 5000000 cycles
PIT_RTI_TCTRL = PIT_TIE; // let RTI generate interrupts
PIT_RTI_TCTRL |= PIT_TEN; // start RTI