
Periodic Interrupt Timer (PIT)
MPC5644A Microcontroller Reference Manual, Rev. 6
Freescale Semiconductor
1633
The PIT 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 of 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.
34.6
Initialization and application information
34.6.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 PITMCR.
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. Therefore 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 0x004C_4B3F, LDVAL1 with 0x0003_E7FF and
LDVAL3 with 0x0016_E35F.
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 bit in the RTI TCTRL register must also be set.
The interrupt for Timer 1 is enabled by setting the TIE bit 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
// Timer 1
PIT_LDVAL1 = 0x0003E7FF; // setup timer 1 for 256000 cycles
PIT_TCTRL1 = TIE; // enable Timer 1 interrupts
Содержание MPC5644A
Страница 2: ...MPC5644A Microcontroller Reference Manual Rev 6 2 Freescale Semiconductor...
Страница 24: ...MPC5644A Microcontroller Reference Manual Rev 6 24 Freescale Semiconductor...
Страница 26: ...MPC5644A Microcontroller Reference Manual Rev 6 26 Freescale Semiconductor...
Страница 52: ...Introduction MPC5644A Microcontroller Reference Manual Rev 6 52 Freescale Semiconductor...
Страница 56: ...Memory Map MPC5644A Microcontroller Reference Manual Rev 6 56 Freescale Semiconductor...
Страница 130: ...Device Performance Optimization MPC5644A Microcontroller Reference Manual Rev 6 130 Freescale Semiconductor...
Страница 204: ...Multi Layer AHB Crossbar Switch XBAR MPC5644A Microcontroller Reference Manual Rev 6 204 Freescale Semiconductor...
Страница 212: ...Peripheral Bridge PBRIDGE MPC5644A Microcontroller Reference Manual Rev 6 212 Freescale Semiconductor...
Страница 558: ...System Integration Unit SIU MPC5644A Microcontroller Reference Manual Rev 6 558 Freescale Semiconductor...
Страница 582: ...Frequency modulated phase locked loop FMPLL MPC5644A Microcontroller Reference Manual Rev 6 582 Freescale Semiconductor...
Страница 766: ...Enhanced Time Processing Unit eTPU2 MPC5644A Microcontroller Reference Manual Rev 6 766 Freescale Semiconductor...
Страница 1228: ...Decimation Filter MPC5644A Microcontroller Reference Manual Rev 6 1228 Freescale Semiconductor...
Страница 1236: ...System Information Module and Trim SIM MPC5644A Microcontroller Reference Manual Rev 6 1236 Freescale Semiconductor...
Страница 1250: ...Cyclic Redundancy Checker CRC Unit MPC5644A Microcontroller Reference Manual Rev 6 1250 Freescale Semiconductor...
Страница 1336: ...Deserial Serial Peripheral Interface DSPI MPC5644A Microcontroller Reference Manual Rev 6 1336 Freescale Semiconductor...
Страница 1388: ...Enhanced Serial Communication Interface ESCI MPC5644A Microcontroller Reference Manual Rev 6 1388 Freescale Semiconductor...
Страница 1440: ...FlexCAN Module MPC5644A Microcontroller Reference Manual Rev 6 1440 Freescale Semiconductor...
Страница 1624: ...FlexRay Communication Controller FlexRay MPC5644A Microcontroller Reference Manual Rev 6 1624 Freescale Semiconductor...
Страница 1670: ...JTAG Controller JTAGC MPC5644A Microcontroller Reference Manual Rev 6 1670 Freescale Semiconductor...
Страница 1692: ...Nexus Port Controller NPC MPC5644A Microcontroller Reference Manual Rev 6 1692 Freescale Semiconductor...
Страница 1701: ...Development Trigger Semaphore DTS MPC5644A Microcontroller Reference Manual Rev 6 Freescale Semiconductor 1701...
Страница 1702: ...Development Trigger Semaphore DTS MPC5644A Microcontroller Reference Manual Rev 6 1702 Freescale Semiconductor...