Skip to content

drivers: pwm: nrfx: Add option to glitch free 100% duty cycle #90781

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

Merged
merged 2 commits into from
Jun 10, 2025

Conversation

nordic-krch
Copy link
Collaborator

@nordic-krch nordic-krch commented May 29, 2025

IDLEOUT presence in PWM means that there are 3 sources from which PWM pin can be driven:

  • GPIO setting when PWM peripheral is disabled.
  • IDLEOUT setting when PWM is enabled.
  • PWM Sequence when it is in use.

IDLEOUT setting cannot be changed after enabling PWM so it is configured to the initial state of the pin. It means that if duty cycle is 100% and pin is normal, GPIO output is set to 1 but initial pin state was 0 (IDLEOUT setting) there will be a glitch between disabling a PWM sequence and disabling a PWM peripheral.

By default, PWM driver tries to disable PWM peripheral if all channels are 0% or 100% duty cycle to safe power. When IDLEOUT feature is present there will be a short glitch on channels with 100% duty cycle.

In order to avoid that CONFIG_PWM_NRFX_NO_GLITCH_DUTY_100 option is added (enabled by default). When option is enabled 100% duty cycle is achieved by PWM sequence and not by driving a GPIO pin. It will consume more power in cases where all channels are 0% or 100% with at least one channel set to 100% duty cycle.

@nordic-krch nordic-krch requested a review from anangl May 29, 2025 06:31
@nordic-krch
Copy link
Collaborator Author

fyi @mstasiaknordic

Copy link

github-actions bot commented May 29, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-hal_nordic DNM (manifest) This PR should not be merged (controlled by action-manifest) labels May 29, 2025
kl-cruz
kl-cruz previously approved these changes Jun 2, 2025
anangl
anangl previously approved these changes Jun 3, 2025
@fabiobaltieri fabiobaltieri added DNM This PR should not be merged (Do Not Merge) and removed DNM This PR should not be merged (Do Not Merge) labels Jun 3, 2025
@nordic-krch nordic-krch dismissed stale reviews from anangl and kl-cruz via 35fbf01 June 4, 2025 06:29
@github-actions github-actions bot removed the DNM (manifest) This PR should not be merged (controlled by action-manifest) label Jun 4, 2025
Copy link

sonarqubecloud bot commented Jun 6, 2025

Add property which indicates that PWM instance supports IDLEOUT
feature. Add property to all instances that supports it.

Signed-off-by: Krzysztof Chruściński <[email protected]>
IDLEOUT presence in PWM means that there are 3 sources from which
PWM pin can be driven:
- GPIO setting when PWM peripheral is disabled.
- IDLEOUT setting when PWM is enabled.
- PWM Sequence when it is in use.

IDLEOUT setting cannot be changed after enabling PWM so it is
configured to the initial state of the pin. It means that if duty
cycle is 100%, GPIO output is set to 1 but initial pin state was 0
(IDLEOUT setting) there will be a glitch between disabling a PWM
sequence and disabling a PWM peripheral.

By default, PWM driver tries to disable PWM peripheral if all channels
are 0% or 100% duty cycle to safe power. When IDLEOUT feature is
present there will be a short glitch on channels with 100% duty cycle.

In order to avoid that CONFIG_PWM_NRFX_NO_GLITCH_DUTY_100 option is
added (enabled by default). When option is enabled 100% duty cycle
is achieved by PWM sequence and not by driving a GPIO pin. It will
consume more power in cases where all channels are 0% or 100% with
at least one channel set to 100% duty cycle.

Signed-off-by: Krzysztof Chruściński <[email protected]>
@nordic-krch
Copy link
Collaborator Author

@anangl can you re-approve? hal_nordic was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: PWM Pulse Width Modulation platform: nRF Nordic nRFx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants