16-bit general purpose timers (TIM2, TIM3, TIM5) RM0016
216/449 Doc ID 14587 Rev 8
18 16-bit general purpose timers (TIM2, TIM3, TIM5)
18.1 Introduction
This chapter describes TIM2 and TIM3 which are identical timers, with the exception that
TIM2 has three channels and TIM3 has two channels. TIM5 is also described below. It is
identical to TIM2 except that it has two additional registers to support timer synchronization
and chaining.
Each timer consists of a 16-bit up-counting auto-reload counter driven by a programmable
prescaler.
It may be used for a variety of purposes, including:
● Time base generation
● Measuring the pulse lengths of input signals (input capture)
● Generating output waveforms (output compare, PWM and One-pulse mode)
● Interrupt capability on various events (capture, compare, overflow)
● Synchronization with other timers or external signals (external clock, reset, trigger and
enable) (in devices with TIM5).
The timer clock can be sourced from internal clocks.
Only the main features of the general purpose timers are given in this chapter.
Refer to the corresponding paragraphs of Section 17: 16-bit advanced control timer (TIM1)
on page 136 for more details on each feature.
18.2 TIM2/TIM3 main features
TIM2/TIM3 features include:
● 16-bit up counting auto-reload counter.
● 4-bit programmable prescaler allowing the counter clock frequency to be divided “on
the fly” by any power of 2 from 1 to 32768.
● 3 independent channels for:
– Input capture
– Output compare
– PWM generation (edge-aligned mode)
● Interrupt request generation on the following events:
– Update: counter overflow, counter initialization (by software)
– Input capture
– Output compare