Skip to content
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: No clear semantics to stop a PWM leads to diverse implementations #9507

Closed
vaussard opened this issue Aug 17, 2018 · 4 comments
Closed
Labels
area: API Changes to public APIs area: PWM Pulse Width Modulation Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug

Comments

@vaussard
Copy link
Contributor

The PWM API does not mention how one can stop the timer from generating the PWM, which is critical to minimize the power consumption when going into low-power states.

The implementations of the .pin_set callback show a very diversified picture:

  • STM32 and i.MX does not provide a way to completely turn off the timer
  • QSMI and DW will turn off the timer by passing 'pulse_cycle = 0'
  • nrf5_sw will turn off the timer by passing 'pulse_cycle = 0' or 'pulse_cycles == period_cycles' and set the GPIO to low/high respectively

The lack of a way to turn off the STM32 timer is probably a short-coming of the driver, but the diversity of the implementations make it difficult to write portable userland code.

@pfalcon pfalcon added the area: PWM Pulse Width Modulation label Aug 20, 2018
@pfalcon
Copy link
Contributor

pfalcon commented Aug 20, 2018

STM32 and i.MX does not provide a way to completely turn off the timer

@erwango, @MaureenHelm : FYI

@nashif nashif added bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug labels Aug 23, 2018
@carlescufi carlescufi added the area: API Changes to public APIs label Sep 18, 2018
@rljordan-zz rljordan-zz added Enhancement Changes/Updates/Additions to existing features and removed bug The issue is a bug, or the PR is fixing a bug labels Mar 5, 2019
@carlescufi carlescufi changed the title [PWM] No clear semantics to stop a PWM leads to diverse implementations pwm: No clear semantics to stop a PWM leads to diverse implementations May 28, 2019
@gmarull
Copy link
Member

gmarull commented Jun 15, 2020

FYI, this PR #24569 disables the timer output when pulse_cycles is set to 0, but not the timer itself as multiple channels may be used concurrently.

@henrikbrixandersen
Copy link
Member

I think we need to distinguish between turning off the PWM output (driving it to an inactive state) and turning off the PWM controller (in order to reduce power consumption).

The former was clarified in the API documentation in 31ae13e and a4337bd, but some driver may not have caught up yet. The latter requires power management support in the given PWM controller driver.

@carlescufi
Copy link
Member

The former was clarified in the API documentation in 31ae13e and a4337bd, but some driver may not have caught up yet. The latter requires power management support in the given PWM controller driver.

Given the above I will close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: PWM Pulse Width Modulation Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

7 participants