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

what is difference between pwm driver and pwm library example

Hi.

In SDK 14.0 examples, there are two examples for pwm. I analyzed both example. pwm driver example source looks like that it use pwm peripheral driver source. And pwm library source looks like that it use timer and ppi and gpio drivers.

Is it right? If so, what method should be used? which one is better?

could you please compare the two way of PWM ?

thanks!!

  • Hi Choi,

    you are correct. The PWM driver (nrf_drv_pwm.c) uses the PWM peripheral, while the PWM library(app_pwm.c) uses the TIMER, PPI and GPIOTE peripherals.

    Thus, the difference is that the PWM driver uses one dedicated hardware peripheral to create PWM signal, while the PWM library uses multiple peripherals to do the same.

    I recommend using the PWM peripheral, i.e. the nrf_drv_pwm.c driver. If you need more than 12 PWM channels then you can use the app_pwm.c library to create additional signals.

    Best regards

    Bjørn

Related