An example of a basic timer is illustrated in Figure 10.1. This timer has
four components – a controller, a prescaler (PSC), an “auto-reload” register
(ARR) and a counter (CNT). The function of the prescaler is to divide a
reference clock to lower frequency. The STM32 timers have 16-bit prescaler
registers and can divide the reference clock by any value 1..65535. For example,
the 24Mhz system clock of the STM32 VL Discovery could be used to generate
a 1 Mhz count frequency with a prescaler of 23 (0..23 == 24 values). The
counter register can be configured to count up, down, or up/down and to be
reloaded from the auto reload register whenever it wraps around (an “update
event”) or to stop when it wraps around. The basic timer generates an output
event (TGRO) which can be configured to occur on an update event or when
the counter is enabled (for example on a GPIO input).