Introduction

The PWM timer is driven by a 16-bit auto-reload counter and a 16-bit programmable prescaler. It can be used for measuring the pulse frequency of input signals (input capture), generating a single pulse (one-pulse mode), and outputting PWM waveforms.

The channels of the PWM timer are independent of each other. Different channels of the same PWM timer share the same counter, and can output waveforms with different duty cycles and phases. Pulse length and waveform period can be adjusted between 25ns and 107s.

The PWM timer supports the following modes and functions:

  • Input capture mode: latches the current counter value when an active edge of TRGI arrives. It can be used for pulse width measurement, frequency calculation and signal period detection. Each channel has its own capture register, and different channels can be configured with different polarities to capture different edges of TRGI.

  • PWM mode: outputs edge-aligned PWM waveforms with adjustable frequency and duty cycle. The output polarity can be configured by software as active-high or active-low.

  • One-pulse mode: a special case of PWM mode. The counter is started by an active edge of TRGI, and a pulse of programmable length is generated after a programmable delay.

  • Phase shift function: provides each channel with an independent channel Counter, so that the waveforms output by different channels are shifted in phase. It only applies to PWM mode and one-pulse mode.

Features

  • Clock source: XTAL40M

  • Resolution: 16-bit

  • Prescaler: 16-bit

  • Count mode: Up-counting

  • Supports one-pulse mode

  • Supports PWM mode with polarity selection

  • Interrupt generation

  • Sleep mode

  • Duty cycle range: 0 to 100%

  • Supports phase shift function

RTL8721Dx:
  • Quantity: {{IC_PARAM_PWMTIMER_QUANTITY}}

  • Number of Channels: {{IC_PARAM_PWMTIMER_CHANNEL_NUM}}

Block Diagram

The PWM timer is mainly composed of a counter, a preload register, a prescaler, and capture/compare registers. Different channels of the same PWM timer share the same counter, and different channels can output waveforms with different duty cycles and phases. The block diagram is shown below.

RTL8721Dx:
../../../_images/pwm_timer_block_diagram.svg