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

PWM Uninit not working

app_pwm_uninit is hanging the code. The control goes to pwm_dealloc() and then in nrf_drv_ppi_channel_free() it hangs.

Using SDK10. I want to change the PWM frequency and have to call app_ pwm_init every time for re-initializing the channel time period. The code doesnt run pwm init twice. Hence, I figured pwm uninit should be done. But its not working.

PAN-73 workaround is there in pwm_enable and disable. Still, I am unable to figure out the issue.

Parents
  • The difference i find is that after app_pwm_init I call app_pwm_enable, then app_pwm_disable, and then uninit. Still I dont understand how that creates an issue. I am adding the pwm snippets I use below :

    Init

    err_code = app_pwm_init(&PWM1,&pwm1_cfg,pwm_ready_callback);
    APP_ERROR_CHECK(err_code);
    

    PWM use:

     app_pwm_enable(&PWM1);
     app_pwm_channel_duty_set(&PWM1, 0,duty);
     nrf_timer_delay_us(45);    //This is my function
     app_pwm_disable(&PWM1);
    

    Uninit:

    err_code = app_pwm_uninit(&PWM1);
    APP_ERROR_CHECK(err_code);    
    

    Then I want to run the sequence again with different frequency. So I call init again. But the code is getting stuck at uninit.

Reply
  • The difference i find is that after app_pwm_init I call app_pwm_enable, then app_pwm_disable, and then uninit. Still I dont understand how that creates an issue. I am adding the pwm snippets I use below :

    Init

    err_code = app_pwm_init(&PWM1,&pwm1_cfg,pwm_ready_callback);
    APP_ERROR_CHECK(err_code);
    

    PWM use:

     app_pwm_enable(&PWM1);
     app_pwm_channel_duty_set(&PWM1, 0,duty);
     nrf_timer_delay_us(45);    //This is my function
     app_pwm_disable(&PWM1);
    

    Uninit:

    err_code = app_pwm_uninit(&PWM1);
    APP_ERROR_CHECK(err_code);    
    

    Then I want to run the sequence again with different frequency. So I call init again. But the code is getting stuck at uninit.

Children
No Data
Related