2022-05-05 04:56 AM
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?
2022-05-17 07:19 AM
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.