This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Initializing PWM with specific duty cycle

Hi,

I am using PWM to control LED power.

The code i use for initializing the PWM is-

app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_2CH(1000L, PIN1, PIN2);
err_code = app_pwm_init(&PWM1,&pwm1_cfg,vHAL_pwm_ready_callback);
APP_ERROR_CHECK(err_code);
app_pwm_enable(&PWM1);
while (app_pwm_channel_duty_set(&PWM1, 0, 0) == NRF_ERROR_BUSY);
while (app_pwm_channel_duty_set(&PWM1, 1, 0) == NRF_ERROR_BUSY);

The issue i have is that the PWM starts with 100% duty cycle which cause the LED to be on for a brief moment.

Is there is a way to initialize it with 0% duty cycle?

Thanks,

Shaked. 

Related