-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pwm: Update PWM API for dynamic prescaler computation #6958
Comments
This needs rethinking after introduction of the PWM capture API functions, which also use the |
Is there a detection mechanism to log error that the provided |
If I understand correctly with current implementation there is impossible to have e.g. LED blinking with higher period that 250ms using PWM based driver (as in https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/basic/blinky_pwm). It limits some applications or makes a need for weird workarounds. @carlescufi, @anangl, is it planned for development? Do you have any estimations? Edit: Even with the proposed change limitations caused by the min PWM clock at 125kHz and max COUNTERTOP of 32767 still hold. Workarounds are needed for slow blinking use case anyway. |
Hi @anangl, This issue, marked as an Enhancement, was opened a while ago and did not get any traction. Please confirm the issue is correctly assigned and re-assign it otherwise. Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason. @erwango you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you. Thanks! |
I'm trying to generate audio tones with timer output compare on STM32 and the fixed prescaler prevents me from generating accurate frequencies on 16-bit timers while also limiting the range of tones I can generate. Has there been any progress on this? |
No. |
As discussed in #5469, current PWM API prevents dynamic prescaler computation.
Indeed, using get_cycles_per_sec in pin_set prevents to adjust PWM prescaler to the requested cycle duration and hence imposes to set it before compilation. Hence PWM application is limited to work in the duration range matching harcoded prescaler value.
I propose to remove function get_cycles_per_sec from API and let driver compute it internally inside pin_set. It seems this function is not used today (not in PWM tests/samples at least).
Drivers should be able to handle directly pwm_pin_set_usec.
The text was updated successfully, but these errors were encountered: