CC2430
Peripherals : MAC Timer (Timer2)
13.7.4.1
General
The Timer can be started and stopped
synchronously with the 32kHz clock rising
edge. Note this event is derived from a 32kHz
clock signal, but is synchronous with the
32MHz system clock and thus has a period
approximately equal the 32kHz clock period.
At the time of a synchronous start the timer is
reloaded with new calculated values for the
timer and overflow count such that it appears
that the timer has not been stopped (e.g. im
PM1/2 mode).
13.7.4.2
Timer synchronous stop
After the timer has started running, i.e. entered
timer RUN mode it is stopped synchronously
by writing 0 to T2CNF.RUNwhen T2CNF.SYNC
is 1. After T2CNF.RUN has been set to 0, the
timer will continue running until the 32kHz
clock rising edge is sampled as 1. When this
occurs the timer is stopped and the current
Sleep timer value is stored.
13.7.4.3
When the timer is in the IDLE mode it is
started synchronously by writing to
Timer synchronous start
time when the 32kHz clock rising edge is
sampled high. The synchronous start and stop
function requires that the system clock
frequency is selected to be 32MHz. If the
16MHz clock is selected, there will be an offset
added to the new calculated value.
1
T2CNF.RUN when T2CNF.SYNC is 1. After
T2CNF.RUN has been set to 1, the timer will
remain in the IDLE mode until the 32kHz clock
rising edge is detected. When this occurs the
timer will first calculate new values for the 16-
bit timer value and for the 20-bit timer overflow
count, based on the current and stored Sleep
timer values and the current 16-bit timer
values. The new MAC Timer and overflow
count values are loaded into the timer and the
timer enters the RUN mode. This synchronous
start process takes 75 clock cycles from the
The method for calculating the new MAC
Timer value and overflow count value is given
below. Due to the fact that the MAC Timer
clock
and
Sleep
timer
clocks
are
asynchronous with a non-integer clock ratio
there will be an error of maximum ±1 in
calculated timer value compared to the ideal
timer value.
Calculation of new timer value and overflow count value:
Nc = CurrentSleepTimerValue
Ns = StoredSleepTimerValue
Kck = ClockRatio = 976.5625 10
stw = SleepTimerWidth = 24
P = Timer2Period
Nt = Nc − Ns
Nt ≤ 0 ⇒ Nd = 2stw + Nt ;Nt > 0 ⇒ Nd = Nt
C = Nd ⋅ Kck +TC +TOH (Rounded to nearest integer value)
T = C mod P
C −T
)
O =
+ OC
Oc = CurrentOverflowCountValue
P
Timer2Value = T
Tc = CurrentTimerValue
TOH = Overhead = 75
Timer2OverflowCount = O
10
Clock ratio of MAC Timer clock frequency (32 MHz - XOSC) and Sleep timer clock frequency
(32.768 kHz - XOSC)
(220 −1)× P +TOH
For a given Timer 2 period value, P, there is a
TST (max)
≤
maximum
duration
between
Timer2
Kck
synchronous stop and start for which the timer
value is correctly updated after starting. The
maximum value is given in terms of the
number of Sleep Timer clock periods, i.e.
The maximum period controlled by T2CAPHPH
and T2CAPHPL is defined when thes registers
are 0x0000. When operation in power modes
PM1 or PM2 this will always result in an
overflow and both overflow and timer counter
will be sett to 0xFFFF. The value 0x0000 in
32kHz clock periods, TST(max)
:
CC2430 Data Sheet (rev. 2.1) SWRS036F
Page 112 of 211