General purpose timer unit
ST10F296E
11.2
GPT2
The GPT2 module provides precise event control and time measurement. It includes two
timers (T5, T6) and a capture/reload register (CAPREL). Both timers can be clocked with an
input clock which is derived from the CPU clock via a programmable prescaler or with
external signals. The count direction (up/down) for each timer is programmable by software
or may additionally be altered dynamically by an external signal on a port pin (TxEUD).
Concatenation of the timers is supported via the output toggle latch (T6OTL) of timer T6
which changes its state on each timer overflow/underflow.
The state of this latch may be used to clock timer T5, or it may be output on a port pin
(T6OUT). The overflow/underflow of timer T6 can also be used to clock the CAPCOM timers
T0 or T1, and to cause a reload from the CAPREL register. The CAPREL register may
capture the contents of timer T5 based on an external signal transition on the corresponding
port pin (CAPIN), and timer T5 may optionally be cleared after the capture procedure. This
allows absolute time differences to be measured or pulse multiplication to be performed
without a software overhead.
The capture trigger (timer T5 to CAPREL) may also be generated upon transition of the
GPT1 timer T3 inputs, T3IN and/or T3EUD. This is advantageous when T3 operates in
incremental interface mode.
Table 55 and
Table 56 list the timer input frequencies, resolution and periods for each pre-
scaler option at 40 MHz and 64 MHz CPU clock respectively. This also applies to the gated
timer mode of T6 and to the auxiliary timer T5 in timer and gated timer mode.
Figure 25 shows the block diagram of the GPT2.
Table 55.
GPT2 timer input frequencies, resolution, and period at 40 MHz
fCPU = 40 MHz
Timer Input Selection T5I / T6I
000b
001b
010b
011b
100b
101b
110b
111b
Prescaler factor
4
8
16
32
64
128
256
512
Input frequency
10 MHz
5 MHz
2.5 MHz
1.25 MHz
625 kHz
312.5 kHz 156.25 kHz
78.125 kHz
Resolution
100 ns
200 ns
400 ns
0.8 s
1.6 s
3.2 s
6.4 s
12.8 s
Period maximum
6.55 ms
13.1 ms
26.2 ms
52.4 ms
104.8 ms
209.7 ms
419.4 ms
838.9 ms
Table 56.
GPT2 timer input frequencies, resolution, and period at 64 MHz
fCPU = 64 MHz
Timer Input Selection T5I / T6I
000b
001b
010b
011b
100b
101b
110b
111b
Prescaler factor
4
8
16
32
64
128
256
512
Input frequency
16 MHz
8 MHz
4 MHz
2 MHz
1 kHz
500 kHz
250 kHz
128 kHz
Resolution
62.5 ns
125 ns
250 ns
0.5 s
1.0 s
2.0 s
4.0 s
8.0 s
Period maximum
4.1 ms
8.2 ms
16.4 ms
32.8 ms
65.5 ms
131.1 ms
262.1 ms
524.3 ms