zephyr/drivers/pwm/Kconfig.nrfx
Krzysztof Chruściński 0261d7d96d drivers: pwm: nrfx: Add option to glitch free 100% duty cycle
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 <krzysztof.chruscinski@nordicsemi.no>
2025-06-10 10:24:16 -04:00

33 lines
1.2 KiB
Plaintext

# Copyright (c) 2018, Cue Health Inc
# SPDX-License-Identifier: Apache-2.0
config PWM_NRFX
bool "nRF PWM nrfx driver"
default y
depends on DT_HAS_NORDIC_NRF_PWM_ENABLED
select NRFX_PWM0 if HAS_HW_NRF_PWM0
select NRFX_PWM1 if HAS_HW_NRF_PWM1
select NRFX_PWM2 if HAS_HW_NRF_PWM2
select NRFX_PWM3 if HAS_HW_NRF_PWM3
select NRFX_PWM20 if HAS_HW_NRF_PWM20
select NRFX_PWM21 if HAS_HW_NRF_PWM21
select NRFX_PWM22 if HAS_HW_NRF_PWM22
select NRFX_PWM120 if HAS_HW_NRF_PWM120
select NRFX_PWM130 if HAS_HW_NRF_PWM130
select NRFX_PWM131 if HAS_HW_NRF_PWM131
select NRFX_PWM132 if HAS_HW_NRF_PWM132
select NRFX_PWM133 if HAS_HW_NRF_PWM133
select PINCTRL
help
Enable support for nrfx Hardware PWM driver for nRF52 MCU series.
config PWM_NRFX_NO_GLITCH_DUTY_100
bool "No glitches when using 100% duty"
depends on $(dt_compat_any_has_prop,$(DT_COMPAT_NORDIC_NRF_PWM),idleout-supported,True)
default y
help
Due to how IDLEOUT feature in PWM works it is possible to see a glitch on a channel
with 100% duty cycle when all other channels switches to 0% or 100%. Enabling this
option ensures that there are no glitches but it also means that 100% duty cycle
on any channels requires PWM peripheral to be active.