From 65e63ffbbbcea3a283be25ad0fb885736e804345 Mon Sep 17 00:00:00 2001 From: chrysn Date: Tue, 29 Sep 2020 14:08:26 +0200 Subject: [PATCH] cpu/nrf52: Don't touch pin modes on PWM startup Once PWM is running, the active PWM module overrides the PIN_CNF state; only when PWM is stopped the pin returns into its PIN_CNF state (which, then, the board may set to whatever idle means there). (Moreover, the code there only worked for P0 registers, not eg. the P1.09 of the nrf52840dongle's RGB LED). --- cpu/nrf52/periph/pwm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/cpu/nrf52/periph/pwm.c b/cpu/nrf52/periph/pwm.c index f66a423e9c..4c86dd01f2 100644 --- a/cpu/nrf52/periph/pwm.c +++ b/cpu/nrf52/periph/pwm.c @@ -90,9 +90,6 @@ uint32_t pwm_init(pwm_t pwm, pwm_mode_t mode, uint32_t freq, uint16_t res) /* pin configuration */ for (unsigned i = 0; i < PWM_CHANNELS; i++) { - if (pwm_config[pwm].pin[i] != GPIO_UNDEF) { - NRF_P0->PIN_CNF[pwm_config[pwm].pin[i]] = PIN_CNF_SET; - } /* either left aligned pol or inverted duty cycle */ pwm_seq[pwm][i] = (POL_MASK & mode) ? POL_MASK : res; dev(pwm)->PSEL.OUT[i] = pwm_config[pwm].pin[i];