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

NRF PWM LIBRARY UNABLE TO SET VALUE

Hi,

I'm currently trying to use the PWM Library in the LED Button Example, I was able to get the LED to blink with the PWM library when USE_WITH_SOFTDEVICE=0, but ofcourse I then cannot control the LED from my phone, the real problems is once i've set USE_WITH_SOFTDEVICE=1 The LED just stays fully on regardless of what values I set it too. `

int main(void){

timers_init();
gpiote_init();
buttons_init();
  pwm_init();
ble_stack_init();
scheduler_init();    
gap_params_init();
advertising_init();
services_init();
conn_params_init();
sec_params_init();
// Start execution
timers_start();

advertising_start();
// Enter main loop
for (;;)
{
    app_sched_execute();
    power_manage();
}
}


static static void pwm_init(void){


pwm_config.mode             = PWM_MODE_LED_100;
pwm_config.num_channels     =2;
pwm_config.gpio_num[1]      = IR_LED;
pwm_config.gpio_num[0]      = SHOELACE_LED; 
nrf_pwm_init(&pwm_config);
nrf_pwm_set_value(0,255);
nrf_pwm_set_value(1,255);
}

The PWM_INIT() method should initialize PWM on the two LEDs and then turn them off but instead they stay fully on.

Thanks for your reply, and if you need anymore details feel free to let me know.

Parents
  • How are you assigning PPI channels for the PWM? Are you using the sd_ calls through the softdevice or are you writing directly to the PPI? If you are enabling the softdevice you must use the softdevice functions to access the ppi channels.

    Do you see that the device is advertising or is it hanging in the initialization? I'm just trying to understand where it stops when you enable the softdevice.

Reply
  • How are you assigning PPI channels for the PWM? Are you using the sd_ calls through the softdevice or are you writing directly to the PPI? If you are enabling the softdevice you must use the softdevice functions to access the ppi channels.

    Do you see that the device is advertising or is it hanging in the initialization? I'm just trying to understand where it stops when you enable the softdevice.

Children
No Data
Related