This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is there an example code for using PWM on the nRF51822 with a SoftDevice?

I'm looking to add PWM functionality to my design to drive an LED. Examples exist for other devices, and those don't use the SoftDevice. Is there an example or some reference design for making the PWM module work with the nRF51822 and SD?

Parents
  • Hi all

    Please have a look at the attached example. It allows you to configure up to 3 IO's to run PWM, and gives you some different modes to pick from (varying base frequency, resolution).

    It will work with or without the SoftDevice, as long as you make sure torun the pwm_init() function before enabling the SoftDevice.

    This should not be considered an official Nordic example by the way ;)

    Best regards Torbjørn

    Simple PWM v1.0.zip

  • Something strange is happening with this code. When I use PWM_NUM_CHANNELS 3 and use nrf_pwm_init(14, 8, 10, PWM_MODE_MTR_100); I get output on pin 14. But when I use PWM_NUM_CHANNELS 3 and nrf_pwm_init(14, PWM_MODE_MTR_100); for some reason the output is on pin 19! (LED_1 on the Evaluation Kit.) This is with the example above (not my own code).

Reply
  • Something strange is happening with this code. When I use PWM_NUM_CHANNELS 3 and use nrf_pwm_init(14, 8, 10, PWM_MODE_MTR_100); I get output on pin 14. But when I use PWM_NUM_CHANNELS 3 and nrf_pwm_init(14, PWM_MODE_MTR_100); for some reason the output is on pin 19! (LED_1 on the Evaluation Kit.) This is with the example above (not my own code).

Children
No Data
Related