Skip to main content
NPal.2
Associate III
May 5, 2022
Question

STM32MP1 Timer

  • May 5, 2022
  • 1 reply
  • 767 views

Hi all,

I was wondering whether we can achieve a PWM frequence of 1-3Hz with the existing timer which we have. I am targeting to generate a PWM signal within the same frequency range but using A7 as primary.

How can we achieve that ??

I do have some idea looking at the blog here : https://wiki.st.com/stm32mpu/wiki/PWM_overview

What shall be the reference period value here? How can we perform calculation for any period value?

This topic has been closed for replies.

1 reply

PatrickF
Technical Moderator
May 17, 2022

Hi @NPal.2​ 

Did you experiment using https://wiki.st.com/stm32mpu/wiki/PWM_overview#How_to_use_PWM_with_sysfs_interface ?

1/Frequency is the Period (converted in ns) to be provided. e.g. pwm0/period (sysfs interface)

Duty_cycle is the output pulse active duration (in ns) within the Period time. e.g. pwm0/duty_cycle (sysfs interface)

I'm not expert, but I guess values in ns is limited by Linux to 32-bits, so probably 4 second period max (around 0.25Hz min).

Linux driver will compute TIM prescaler/divider/compare values according to clock provided to the timer and requested period/duty_cycle, so some rounding are present (especially on 16-bits timers).

Regards.

In order to give better visibility on the answered topics, please click on 'Best Answer' on the reply which solved your issue or answered your question.Tip of the day: Try Sidekick STM32 AI agent