ST10F276E
General purpose timer unit
10.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 additionally 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 software overhead.
The capture trigger (timer T5 to CAPREL) may also be generated upon transitions of GPT1
timer T3 inputs T3IN and/or T3EUD. This is advantageous when T3 operates in Incremental
Interface Mode.
Table 48 and Table 49 list the timer input frequencies, resolution and periods for each pre-
scaler option at 40 MHz and 64 MHz CPU clock respectively.
Table 48. GPT2 timer input frequencies, resolutions and periods at 40 MHz
Timer input selection T5I / T6I
fCPU = 40MHz
000b
001b
010b
011b
100b
101b
110b
111b
Prescaler factor
Input frequency
Resolution
4
8
16
32
64
128
256
512
10 MHz
100ns
6.55ms
5 MHz
200ns
13.1ms
2.5 MHz 1.25 MHz 625 kHz 312.5 kHz 156.25 kHz 78.125 kHz
400ns
0.8µs
1.6µs
3.2µs
6.4µs
12.8µs
Period maximum
26.2ms
52.4ms
104.8ms 209.7ms
419.4ms
838.9ms
Table 49. GPT2 timer input frequencies, resolutions and periods at 64 MHz
Timer input selection T5I / T6I
fCPU = 64MHz
000b
001b
010b
011b
100b
101b
110b
111b
Prescaler factor
Input frequency
Resolution
4
8
16
32
64
128
256
512
16 MHz
62.5ns
4.1ms
8 MHz
125ns
8.2ms
4 MHz
250ns
16.4ms
2 MHz
0.5µs
1 kHz
1.0µs
65.5ms
500 kHz
2.0µs
250 kHz
4.0µs
128 kHz
8.0µs
Period maximum
32.8ms
131.1ms
262.1ms
524.3ms
Doc ID 12303 Rev 3
87/235