I'm trying to measure the duty-cycle of the 0-5V electrical PWM signal I have generated from the any source. How can I do this? Anyone can help me?

  • IDE: Keil
  • Microcontroller: STM32F103C8T6
  • \$\begingroup\$ that information belongs in the question above .... use the edit button to add it, then delete the comment \$\endgroup\$
    – jsotola
    Commented Nov 3, 2018 at 23:06

1 Answer 1


The process is described in detail in the Reference Manual, look for PWM input mode.

Don't forget to check the input pin in the pin definitions table of the Datasheet. If it's not marked as 5 Volt Tolerant (FT in the I/O Level column), then place a suitable voltage divider between the signal source and the input pin.

  • \$\begingroup\$ berendi , I reviewed the article you submitted but I couldn't create enough time to work. Can you share with me if you have code about this situation? \$\endgroup\$
    – Nickname
    Commented Nov 4, 2018 at 17:08
  • 1
    \$\begingroup\$ There are step-by-step instructions in the Reference Manual I've linked. I can't do it any better than that. \$\endgroup\$ Commented Nov 4, 2018 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.