Difference between revisions of "STM32 Timer PWM Input Capture"

From Stm32World Wiki
Jump to navigation Jump to search
Line 5: Line 5:
  
 
The source of the complete example is [https://github.com/lbthomsen/blackpill/tree/master/pwm_ic here].
 
The source of the complete example is [https://github.com/lbthomsen/blackpill/tree/master/pwm_ic here].
 +
 +
== Wiring ==
 +
 +
== STM32CubeMX Setup ==
 +
 +
== Code ==
  
 
[[File:PWM Input Capture example - clock settings.png|1000px]]
 
[[File:PWM Input Capture example - clock settings.png|1000px]]

Revision as of 04:00, 13 March 2022

The timers in STM32 MCUs are incredible powerful. We have used them before to generate PWM Signals and to decode signals from rotary encoders. In this example we will use them to determine frequency an duty cycle of an external PWM signal.

For the example we will be using a Black Pill development board and we will be using the same MCU to both generate and to decode the PWM signal.

The source of the complete example is here.

Wiring

STM32CubeMX Setup

Code

PWM Input Capture example - clock settings.png

PWM Input Capture example - Timer 4 configuration.png

PWM Input Capture example - Timer 2 confriguration.png

PWM Input Capture example - wiring.jpg

Miscellaneous Links