TIM Capture Block Description
This block enables PWM signal measurement using the TIM peripheral in STM microcontrollers.

Table of Contents
Inputs
This block has no inputs.
Outputs
| Output Name | Type | Description |
|---|---|---|
| New data CH* | uint8 | New measurement from channel CH*. Returns:1 new measurement available0 no new measurement |
| Duty CH* | double | Duty cycle of the PWM signal on channel CH*. |
| Period CH* [sec] | double | Period of the PWM signal on channel CH*. |
CH* - the * symbol in the output name represents the channel number configured in the block parameters. Depending on the block settings, multiple outputs may exist for different channels.
Block Parameters
| Parameter | Description |
|---|---|
| Timer | The timer number that will be used to measure the PWM signal. |
| Timer clock (MHz) | The timer clock frequency in MHz set within the CubeMX file. |
| Prescaler | The timer prescaler value. This parameter can be configured inside the block instead of the CubeMX configuration. |
| Show signal properties | Enables the display of timer properties to facilitate correct calculations. |

| Parameter | Description |
|---|---|
| Combined channels | Configures combined channels for full PWM signal measurement:(Disable) - option is disabledPWM input on CH1 - measured PWM signal input on channel CH1PWM input on CH2 - measured PWM signal input on channel CH2 |
| CHANNEL_* | Timer channel configuration for PWM signal measurement (PWM Input mode):Disable – channel is disabledInput capture direct mode – direct mode; the PWM signal is connected to the physical pin associated with this channel (e.g., CH1 for IC1)Input capture indirect mode – indirect mode; the channel measures the signal routed internally from the adjacent pin (e.g., CH2 for IC1) |
CHANNEL_* - the * symbol in the parameter name represents the channel number configured in the block parameters. Depending on the block settings, multiple parameters may exist for different channels.

CubeMX Configuration for a Given MCU Model
H7
CubeMX Settings
| No. | Name | Path | Setting | Description | Screenshot |
|---|---|---|---|---|---|
| 1 | Clock Source | Pinout & Configuration > TIM* > Mode > Clock Source | Internal Clock | Selects the clock source for the timer. | ![]() |
| 2 | Channel* / Combined Channels Configuration | Pinout & Configuration > TIM* > Mode > Channel* / Combined Channels | Setting matching the block parameters configuration | Selects the timer channel operating mode or configures the Combined Channels option. These options are mutually exclusive. | ![]() |
| 3 | Global interrupt / Update interrupt | Pinout & Configuration > TIM* > NVIC Settings > Global interrupt / Update interrupt | Enabled | Enables timer interrupts. Some timers feature a Global or Update interrupt; one of these options must be enabled. | ![]() ![]() |
| 4 | Polarity Selection | Pinout & Configuration > TIM* > Parameter Settings > PWM Input CH* > Polarity Selection | Direct channel as Rising Edge, indirect channel as Falling Edge | Conditional setting When Combined Channels mode is selected, the polarity of the Direct channel should be set to Rising Edge, and the indirect channel to Falling Edge. | ![]() |
TIM* / Channel* - the * symbol in the parameter name represents the timer or channel number configured in the block parameters. Depending on the block settings, multiple parameters may exist for different timers or channels.
See Also
Last updated on





