
Modem Timer Information
MC1321x Reference Manual, Rev. 1.1
Freescale Semiconductor
6-5
NOTE
It is important to realize that not all bits of the timer compare value are
updated simultaneously within the SPI. To prevent the Event Timer from
generating a false match to a partially updated timer compare value, the
compare hardware is inhibited temporarily. The inhibit feature initiates
when the address of the MSB location of the timer compare field is decoded
on a SPI write, and ends when a write to the LSB field is completed. Thus,
once an SPI write to the MSB location starts, the comparator is disabled
until an SPI write to the LSB location is completed. The preferred procedure
for software to change a timer compare value within the MC1321x is to
perform a 2-word recursive write of the timer compare field starting at the
MSB address.
6.7
Intended Event Timer Usage
It is intended that the system utilize the “current time” value and the timer compare functions of the Event
Timer to schedule system events, including:
Generating time-based interrupts
Exiting Doze Mode
Triggering transceiver operations
NOTE
The timer_compare functions exit reset with the timer function enabled but
with the interrupts masked off. Users should disable all timers and clear the
IRQ_Status Register via a read as part of system initialization after reset.
6.7.1
Generating Time-Based Interrupts
Generating time-based interrupts is accomplished by setting timer compare values relative to the “current
time”, allowing the Event Timer counter to increment until a timer compare match is generated, and using
this match to generate an interrupt to the host. The general procedure is as follows:
1. Disable the timer compare. This clears the status flag if already set.
2. Enable the timer compare interrupt mask.
3. Read the “current time” value from et[23:0].
4. Add an offset to this value to equal desired “future time”.
5. Program the appropriate timer_compare value to “future time”.
6. Program the appropriate tmr_cmpx_dis bit to enable the compare.
7. Allow a timer compare match to set the status register bit and generate an interrupt. The appropriate
internal status register bit is always set upon a timer_compare match. An external interrupt is
generated when the corresponding SPI interrupt mask bit, Register 5, Bits 3, 2, 1, or 0, is set.
8. Program the appropriate tmr_cmpx_dis bit to disable the compare function. If this is not done, the
compare function will continue to run and generate another interrupt every time the counter rolls
over and again matches the comparator.