Hi, I'm running nRF5 SDK v15.2, and tried to run the led softblink example on port 1 of a nRF52840, which did not seem to work. I found a problem in low_power_pwm.c, which causes incorrect pin configurations. The code is located in the function low_power_pwm_init, and looks like this:
while (bit_mask)
{
if (bit_mask & 0x1UL)
{
nrf_gpio_cfg_output(pin_number);
}
pin_number++;
bit_mask >>= 1UL;
}
As you can see above, the call to nrf_gpio_cfg_output does not take the port into consideration, it was supplied through the p_pwm_config struct. The code below fixes the problem for me, but will of course not work if you have more than 2 ports.
uint32_t portNr = (p_pwm_config->p_port == NRF_P0) ? 0 : 1;
while (bit_mask)
{
if (bit_mask & 0x1UL)
{
nrf_gpio_cfg_output(NRF_GPIO_PIN_MAP(portNr, pin_number));
}
pin_number++;
bit_mask >>= 1UL;
}
I would appreciate if this could be fixed in the next revision of the SDK.