From d21382ba4edc2f6fe4dbfcfac3f23e989b724364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Stasiak?= Date: Tue, 7 Jan 2025 14:51:23 +0100 Subject: [PATCH] [nrf fromlist] drivers: pwm: nrfx: Add idle output to PWM driver. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fast PWM120 prevents GPIO from driving pin with low/high state when PWM duty is 0% or 100%. Idleout feature needs to be used. It can be configured when PWM is disabled and works while it is enabled. Upstream PR #: 83652 Signed-off-by: MichaƂ Stasiak --- drivers/pwm/pwm_nrfx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index 065784ed80f..79ecfd4c813 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -233,7 +233,13 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, out_level ^= 1; } +#if NRF_PWM_HAS_IDLEOUT + nrfx_pwm_stop(&config->pwm, true); + nrfy_pwm_channel_idle_set(config->pwm.p_reg, channel, out_level); + nrfy_pwm_enable(config->pwm.p_reg); +#else nrf_gpio_pin_write(psel, out_level); +#endif } data->pwm_needed &= ~BIT(channel);