
EM358x
Rev. 0.4
165
10 General Purpose Timers (TIM1 and TIM2)
10.1 Introduction
Each of the EM358x’s two general-purpose timers consists of a 16-bit auto-reload counter driven by a
programmable prescaler. They may be used for a variety of purposes, including measuring the pulse lengths of
input signals (input capture) or generating output waveforms (output compare and PWM). Pulse lengths and
waveform periods can be modulated from a few microseconds to several milliseconds using the timer prescaler.
The timers are completely independent, and do not share any resources. They can be synchronized together as
described in the Timer Synchronizationsection.
The two general-purpose timers, TIM1 and TIM2, have the following features:
16-bit up, down, or up/down auto-reload counter.
Programmable prescaler to divide the counter clock by any power of two from 1 through 32768.
4 independent channels for:
Input capture
Output compare
PWM generation (edge- and center-aligned mode)
One-pulse mode output
Synchronization circuit to control the timer with external signals and to interconnect the timers.
Flexible clock source selection:
Peripheral clock (PCLK at 6 or 12 MHz)
32.768 kHz external clock (if available)
1 kHz clock
GPIO input
Interrupt generation on the following events:
Update: counter overflow/underflow, counter initialization (software or internal/external trigger)
Trigger event (counter start, stop, initialization or count by internal/external trigger)
Input capture
Output compare
Supports incremental (quadrature) encoders and Hall sensors for positioning applications.
Trigger input for external clock or cycle-by-cycle current management.
Figure 10-1 shows an overview of a timer’s internal structure.
Note:
Because the two timers are identical, the notation TIMx refers to either TIM1 or TIM2. For example,
TIMx_PSC refers to both TIM1_PSC and TIM2_PSC. Similarly, “y” refers to any of the four channels of a
given timer, so for example, OCy refers to OC1, OC2, OC3, and OC4.
Содержание EMBER EM358 series
Страница 2: ...EM358x 2 Rev 0 4 ...
Страница 7: ...EM358x Rev 0 4 7 ...