I need to create a backlight fade-in/out effect. For this I'm using the latest nrf_pwm lib form here together with the S110 Softdevice. Using the scheduler and an application timer I'm updating every ~31.25ms the duty cycle using nrf_pwm_set_value() in order to create the fade effect. This basically works, however once in a while during a fade I'm seeing glitches and often the duty cycle seems to get inverted and screws up the fading.
Searching this forum I came along these questions that seem to address the same issue, but I still don't know how to solve this problem: Question,Qeustion,Question
I then tried using the functions provided in nrf_pwm_noglitch.h (also from here). Here the problem with that appears that it doesn't update the duty cycly with every call to nrf_pwm_set_value() and the resulting fade isn't looking smooth anymore.
I need some hints how to solve this problem or what I'm doing wrong ...
This how I'm initializing the pwm lib:
nrf_pwm_config_t pwm_config = PWM_DEFAULT_CONFIG;
pwm_config.mode = PWM_MODE_LED_1000;
pwm_config.num_channels = 1;
pwm_config.gpio_num[0] = LIGHT_DIM;
// Initialize the PWM library
nrf_pwm_init(&pwm_config);
nrf_pwm_set_value(0,0);