Tutorial : Input Capture for measuring frequency with a STM32L0 (PART1)

Document created by jean-christophe Toussaint on May 11, 2018Last modified by Brian Kling on Jun 5, 2018
Version 3Show Document
  • View in full screen mode

This tutorial is dedicated to students at phelma  in the frame of the first year projects

and newbies too with STM32.

The Input Capture technique is used to capture a timer value based upon an event on an input pin.

The IC features are useful in applications that require frequency (time period) and pulse measurements.


The following equipment is used

-  nucleo-l053r8 Board or equivalent which owns only 16 bits timers.

-  Eclipse with the necessary packages for Nucleo boards installed

-  openocd or STLink USB Driver - stm32cubemx 4.25.1


In this tutorial (PART1), one measures the time period between two rising edges of a PWM signal generated by the timer TIM21. The channel 2 of the timer TIM2 is configured for capturing a rising edge.

In a second part of the tutorial which will be published later, one will study a technique to bypass

the 16 bits timer limitations.


Jean-Christophe Toussaint phelma  Grenoble-INP

full professor at Phelma Grenoble-INP University

3 people found this helpful