Capture

TIM Capture BLOCK

This block supports PWM signal measurement using Timer peripheral on STM microcontrollers.

Contents

Inputs

None

Outputs

  • New data CHx – new measurement flag (0 – no new measurement, 1 – new measurement)
  • Duty CHx – measured PWM signal duty
  • Period CHx [sec] – measured PWM signal period

Block parameters

  • Timer – timer peripheral number
  • Timer clock (MHz) – timer base clock
  • Prescaler – timer base clock prescaler (timer clock is base/prescaler)
  • Combined channels – timer combined channels configuration
  • CHANNEL_x – timer channel x mode
  • Sample time (sec) – timer combined channels configuration

CubeMX settings

  • Timers->TIMx->Clock Source->Internal clock
  • Timers->TIMx->NVIC Settings Tab->TIMx global interrupt/TIMx update interrupt
  • Timers->TIMx->Channelx/Combined Channels->set as configured in block
  • For combined channels, the channel inputs should be set: direct channel as 'Rising Edge’ and indirect channel as 'Falling Edge’