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
  • I am having problems reproducing this issue. Can you upload a simple piece of code that reproduces it? Here is my modifications to SDK 10 PWM example, where app_pwm_uninit() is called after a short time one iteration of the original main loop. Using a debugger I see that the call to app_pwm_uninit() is successful in this case. How does yours differ?

    --- a/examples/peripheral/pwm/main.c
    +++ b/examples/peripheral/pwm/main.c
    @@ -70,8 +70,15 @@ int main(void)
                 APP_ERROR_CHECK(app_pwm_channel_duty_set(&PWM1, 1, value));
                 nrf_delay_ms(25);
             }
    +
    +        break;
         }
    
    +    err_code = app_pwm_uninit(&PWM1);
    +    APP_ERROR_CHECK(err_code);
    +
    +    while(1){}
    +
     }
    
Reply
  • I am having problems reproducing this issue. Can you upload a simple piece of code that reproduces it? Here is my modifications to SDK 10 PWM example, where app_pwm_uninit() is called after a short time one iteration of the original main loop. Using a debugger I see that the call to app_pwm_uninit() is successful in this case. How does yours differ?

    --- a/examples/peripheral/pwm/main.c
    +++ b/examples/peripheral/pwm/main.c
    @@ -70,8 +70,15 @@ int main(void)
                 APP_ERROR_CHECK(app_pwm_channel_duty_set(&PWM1, 1, value));
                 nrf_delay_ms(25);
             }
    +
    +        break;
         }
    
    +    err_code = app_pwm_uninit(&PWM1);
    +    APP_ERROR_CHECK(err_code);
    +
    +    while(1){}
    +
     }
    
Children
No Data
Related